fix(skills): allow underscore directory names to match kebab-case skill names#4864
Conversation
…validator Python cannot import modules whose names contain hyphens, but the ADK skill spec requires kebab-case names in SKILL.md frontmatter. This normalizes underscores to hyphens before validation, so both snake_case and kebab-case are accepted.
Allow snake_case directory names to match kebab-case frontmatter names in _load_skill_from_dir, _validate_skill_dir, _list_skills_in_dir, and _load_skill_from_gcs_dir.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Hi @MarceloCorreiaData , Thank you for your contribution through this pull request! This PR has merge conflicts that require changes from your end. Could you please rebase your branch with the latest main branch to address these? Once this is complete, please let us know so we can proceed with the review. |
|
Thanks for the review @rohityan! I see that the team has already addressed this with the SNAKE_CASE_SKILL_NAME feature flag approach in main, which is a deliberated option that I prefer not to use in my projects, but otherwise is a cleaner solution with explicit opt-in. I'll close this PR since the functionality is now covered. Happy to contribute in other areas! |
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
The ADK skill spec requires kebab-case names in SKILL.md frontmatter, but Python
cannot import modules whose names contain hyphens. This forces developers to
choose between valid skill names and valid Python module paths, with no
workaround. A skill directory named
my_skill(required for Python imports)must have
name: my-skillin its SKILL.md (required by ADK validation), butthe current code rejects this because the directory name does not exactly match
the frontmatter name.
Solution:
models.py: Normalize underscores to hyphens in the Frontmatternamevalidator before applying kebab-case validation, so both
my_skillandmy-skillare accepted and stored asmy-skill._utils.py: Normalize directory names with.replace("_", "-")in allfour name-matching checks (
_load_skill_from_dir,_validate_skill_dir,_list_skills_in_dir,_load_skill_from_gcs_dir).Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
Verified locally that skill directories using snake_case names (e.g.
my_skill/) load correctly when SKILL.md contains the equivalent kebab-casename (
name: my-skill). Previously this raised a ValidationError on theFrontmatter name field and a ValueError on the directory name mismatch.
Checklist