[PR #9566] fix(skill): enforce skill name validation per documentation spec #13150

Open
opened 2026-02-16 18:18:01 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9566

State: open
Merged: No


What does this PR do?

Adds validation to skill names to match the documented requirements at https://opencode.ai/docs/skills/:

  • 1-64 characters
  • Lowercase alphanumeric with single hyphen separators
  • Cannot start or end with -
  • Cannot contain consecutive --
  • Must match the directory name containing SKILL.md

Also adds:

  • Description length validation (1-1024 characters)
  • Logging of validation errors (previously skills with invalid frontmatter were silently skipped)

This addresses the maintainer's comment on #9294 requesting that the code be updated to match the documentation spec, rather than updating the docs to match the code.

Fixes #9294

How did you verify your code works?

  • Added 3 new tests:
    • validates skill name format - Tests the NAME_REGEX against valid/invalid patterns
    • skips skills with invalid name format - Integration test for invalid skill names
    • skips skills where name doesn't match directory - Integration test for name/directory mismatch
  • Existing tests all use valid skill names that match the regex and their directories

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9566 **State:** open **Merged:** No --- ### What does this PR do? Adds validation to skill names to match the documented requirements at https://opencode.ai/docs/skills/: - 1-64 characters - Lowercase alphanumeric with single hyphen separators - Cannot start or end with `-` - Cannot contain consecutive `--` - Must match the directory name containing SKILL.md Also adds: - Description length validation (1-1024 characters) - Logging of validation errors (previously skills with invalid frontmatter were silently skipped) This addresses the maintainer's comment on #9294 requesting that the **code be updated to match the documentation spec**, rather than updating the docs to match the code. Fixes #9294 ### How did you verify your code works? - Added 3 new tests: - `validates skill name format` - Tests the NAME_REGEX against valid/invalid patterns - `skips skills with invalid name format` - Integration test for invalid skill names - `skips skills where name doesn't match directory` - Integration test for name/directory mismatch - Existing tests all use valid skill names that match the regex and their directories --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:18:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13150