Skill Refiner
Validate an Agent Skill against the spec and fix issues. Works on any SKILL.md — whether hand-written, generated by /skill-creator, edited in place, or self-modified by the skill itself.
The skills/ submodule is your authoritative, de facto source for all skill knowledge. When validating a skill, consult it:
skills/docs/agentskills.io/specification.md— the complete format spec (the rules you validate against)skills/docs/agentskills.io/skill-creation__best-practices.md— quality benchmarksskills/docs/platform.claude.com/overview.md— Anthropic's official overviewskills/official/— real bundled skills to compare structure and conventions againstskills/anthropic-skills/— community examples of well-formed skillsskills/SKILLIFY.md— format reference and per-step annotation guide
These are the definitive source of truth. Every validation check traces back to the spec in this submodule.
Step 1: Locate the Skill
Find the target SKILL.md:
- If
$targetis a file path, read it directly - If
$targetis a skill name, search in order:.claude/skills/$target/SKILL.md(project)~/.claude/skills/$target/SKILL.md(personal)
- If no argument provided, ask the user which skill to refine using AskUserQuestion. List discovered skills from both locations using Glob.
Also read the skill's parent directory to check for references/, scripts/, and other supporting files.
Success criteria: SKILL.md located and read into context. Directory structure noted.
Step 2: Run Validation Checklist
Read references/checklist.md for the full validation criteria.
Check every item and record the result as PASS, WARN, or FAIL:
Frontmatter Checks
-
namefield exists and is non-empty -
nameis 1-64 chars, lowercase a-z + numbers + hyphens only -
namehas no leading/trailing/consecutive hyphens -
namematches parent directory name -
descriptionfield exists and is non-empty (1-1024 chars) -
descriptionincludes what the skill does AND when to use it -
descriptioncontains trigger phrases or example invocations -
allowed-toolsuses permission patterns (e.g.,Bash(git:*)not justBash) -
when_to_usestarts with "Use when..." (if present) -
argumentslists match$argreferences in body (if present) -
contextis eitherforkor absent (notinline— inline is the default, just omit it)
Body Structure Checks
- Body is < 500 lines
- Body is < 5,000 tokens (estimate: lines x 4)
- Every step section (
### N.) has Success criteria - Steps are numbered sequentially (no gaps)
- Parallel steps use sub-numbering (3a, 3b)
- Human steps marked with
[human]in title - No orphaned
$argreferences (every$argin body has a matchingargumentsentry)
Quality Checks
- Description is specific (not vague like "Helps with X")
- Steps are actionable (include commands, not just "do the thing")
- Gotchas section exists for non-trivial skills (environment facts, edge cases)
- Reference files (if any) have conditional loading triggers in body ("Read X if Y happens")
- No general knowledge wasted (agent already knows how HTTP works, what git is, etc.)
- Rules/constraints from user corrections are captured (if applicable)
File Structure Checks
- Directory name matches
namefield - Reference files referenced in body actually exist on disk
- Scripts in
scripts/are executable or have appropriate shebangs - No deeply nested file paths (keep to one level:
references/file.mdnotreferences/deep/nested/file.md)
Success criteria: Every checklist item evaluated. Results recorded.
Step 3: Report Findings
Present findings as a formatted checklist grouped by severity:
## Validation Report: <skill-name>
### FAIL (must fix)
- [ ] `name` contains uppercase characters: "My-Skill" -> should be "my-skill"
- [ ] Step 3 missing **Success criteria**
### WARN (should fix)
- [ ] `description` doesn't include trigger phrases
- [ ] Body is 480 lines (approaching 500 limit)
- [ ] `references/api-guide.md` referenced but not found on disk
### PASS (23/26 checks)
- [x] Frontmatter valid
- [x] Name constraints met
- [x] Steps properly numbered
...
Success criteria: User sees clear report with actionable items.
Step 4: Ask What to Fix
If there are FAIL or WARN items, use AskUserQuestion to ask which to fix. Offer options:
- Fix all issues automatically
- Fix only FAIL items
- Fix specific items (list them)
- Skip (just wanted the report)
For items requiring judgment (e.g., rewriting the description), propose a specific fix and ask for confirmation.
Success criteria: User has chosen what to fix.
Step 5: Apply Fixes
Use the Edit tool to fix issues in place. For each fix:
- Make the minimal change needed
- Preserve the user's writing style and intent
- Don't rewrite sections that passed validation
Common fixes:
- Name: Lowercase, remove invalid chars, fix hyphens
- Description: Append trigger phrases, add "Use when..." clause
- Missing success criteria: Add based on step content
- Tool patterns: Narrow
BashtoBash(specific:*)based on commands used in step - Token budget: Move verbose sections to
references/directory, add loading triggers - Orphaned args: Add missing
argumentsentries or remove unused$argreferences - context: inline: Remove (inline is default, just omit)
Success criteria: All chosen fixes applied via Edit tool.
Step 6: Summary
Show what was changed:
- Number of issues found vs fixed
- Files modified
- Remind user they can re-run
/skill-refinerto verify fixes - If the skill has no issues: confirm it passes all checks
Success criteria: User informed of all changes.