fix(skills): allow underscore directory names to match kebab-case skill names#4864
Open
MarceloCorreiaData wants to merge 5 commits intogoogle:mainfrom
Open
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.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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