Python: skill name validation improvements#4530
Conversation
…e hyphens and enforce directory name match Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
|
@copilot fix the failed check: FAILED: lint in packages/core Found 1 error. |
…ll_metadata Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ports the skill validation improvements from the .NET implementation into the Python skills loader to tighten name rules and prevent misconfigured file-based skills from being discovered.
Changes:
- Updated skill name validation to reject consecutive hyphens.
- Improved
_validate_skill_metadataerror message to explicitly mention consecutive hyphens. - Enforced
SKILL.mdfrontmattername:to match the containing directory name for file-based skills, with tests covering both new validations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/core/agent_framework/_skills.py | Tightens VALID_NAME_RE, updates validation error text, and adds directory-name matching enforcement during file-based skill load. |
| python/packages/core/tests/core/test_skills.py | Adds unit tests ensuring consecutive-hyphen names and directory/name mismatches are skipped/rejected. |
|
@SergeyMenshykh is this still relevant? |
Yep, it's still needed, even though the code will be extracted to a separate class in one of the next PRs. |
VALID_NAME_REto reject consecutive hyphens_validate_skill_metadatato mention consecutive hyphens (split to stay within 120-char line limit)_read_and_parse_skill_file, enforce frontmatternamematches parent directory nameOriginal prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.