build-skill
Scaffolds a new Claude Code skill with enforced quality gates for description, naming, and context budget. Use when the user asks to create a new skill, add a skill, or extend automation.
SKILL.md
| Name | build-skill |
| Description | Scaffolds a new Claude Code skill with enforced quality gates for description, naming, and context budget. Use when the user asks to create a new skill, add a skill, or extend automation. |
name: "build-skill" description: "Scaffolds a new Claude Code skill with enforced quality gates for description, naming, and context budget. Use when the user asks to create a new skill, add a skill, or extend automation." user-invocable: true allowed-tools: ["Read", "Write", "Glob", "Grep"]
Build a New Claude Code Skill
Follow these steps to scaffold a new Claude Code skill with enforced quality gates.
Step 1: Gather Requirements
Ask the user for:
- Skill Name — What to call the skill (will be validated)
- Purpose — What the skill does and when it should be invoked
- Target Output Directory — Where generated files should be written
- Required Tools — Which tools the skill needs access to
- Template — Whether there is an existing template to follow
Step 2: Validate Skill Name
Enforce naming conventions:
- Format — Lowercase letters and hyphens only (e.g.,
new-proposal,format-resume) - Length — 1 to 64 characters
- No reserved words — Must not conflict with built-in commands (help, clear, exit, quit, init, config)
- Uniqueness — Use Glob to check
.claude/skills/*/SKILL.md— the name must not already exist
If validation fails, explain the issue and ask for a corrected name.
Step 3: Validate Description
Enforce description quality:
- Minimum length — At least 50 characters
- "Use when..." clause — Must contain a "Use when" clause explaining trigger conditions
- Third person — Must be written in third person (no "you" or "I")
- Keyword variants — Should include synonyms and alternative phrasings for discoverability
- No special characters — Avoid characters that could break YAML parsing
If validation fails, suggest improvements and ask for confirmation.
Step 4: Check Context Budget
Read all existing skill descriptions to calculate total character count:
- Use Glob to find all
.claude/skills/*/SKILL.mdfiles - Read each file and extract the
descriptionfield from frontmatter - Sum total characters across all descriptions
- Warn if approaching 15,000 characters — Claude Code has a context budget for skill descriptions; exceeding it may cause skills to not be discovered
Report: "Current total description characters: X / 15,000 (Y% used). This new skill will add Z characters."
Step 5: Generate SKILL.md
Create the SKILL.md file at .claude/skills/[name]/SKILL.md with:
Frontmatter
---
name: "[skill-name]"
description: "[validated description]"
user-invocable: true
allowed-tools: ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "Task"]
---
Adjust allowed-tools based on the skill's requirements.
Body
Generate the skill body following the standard pattern:
- Step 1: Load Context — Read patterns.md, relevant template, and style guide.
- Step 2: Check for Duplicates — Scan target directory for existing files.
- Step 3: Gather Required Context — Ask user for required information.
- Step 4: Generate Content — Produce the output following template structure.
- Step 5: Write the File — Save to the target directory with YAML frontmatter.
- Step 6: Log the Action — Append to skills-log.jsonl.
Adapt steps based on the skill's specific purpose (not all skills are content generation).
Step 6: Generate CLAUDE.md Reinforcement Snippet
Generate a snippet for addition to the project's CLAUDE.md file:
- When the user asks to [action description], use /[skill-name]
For example:
- When the user asks to create a new proposal, use /new-proposal
Output the snippet and instruct the user to manually add it to CLAUDE.md under the appropriate section.
Step 7: Output Summary
Present:
- Skill created — Path to the new SKILL.md file
- Name validation — Passed
- Description validation — Passed (character count)
- Context budget — Current usage and remaining capacity
- CLAUDE.md snippet — The snippet to add manually
- Next steps — Test the skill by invoking it with
/[skill-name]