|
| 1 | +--- |
| 2 | +name: create-skill |
| 3 | +description: "Create a new Claude Agent Skill. Auto-invoke when the user asks to create a skill, make a new skill, or scaffold a workflow automation. Do NOT invoke for general coding tasks." |
| 4 | +--- |
| 5 | + |
| 6 | +# Create Skill |
| 7 | + |
| 8 | +Scaffold a new Claude Agent Skill using the architecture below. |
| 9 | + |
| 10 | +## Skill Architecture |
| 11 | + |
| 12 | +Every skill lives at `.claude/skills/[SkillName]/` and uses |
| 13 | +progressive disclosure — Claude loads only what each task needs: |
| 14 | + |
| 15 | +- **Tier 1 — frontmatter (~100 tokens):** Always in memory |
| 16 | +- **Tier 2 — SKILL.md body (<5k tokens):** Loaded on trigger |
| 17 | +- **Tier 3 — Workflow + resource files:** Loaded on demand |
| 18 | + |
| 19 | +## Directory Layout |
| 20 | + |
| 21 | +``` |
| 22 | +
|
| 23 | +.claude/skills/[SkillName]/ |
| 24 | +├── SKILL.md ← required, entry point |
| 25 | +├── CONVENTIONS.md ← if the domain has style/format rules |
| 26 | +├── Workflows/ |
| 27 | +│ ├── [Action1].md ← one file per distinct task |
| 28 | +│ └── [Action2].md |
| 29 | +└── scripts/ ← optional, only if no existing scripts suffice |
| 30 | +└── [script].sh ← shell commands, never inline them |
| 31 | +
|
| 32 | +``` |
| 33 | + |
| 34 | +## What Goes in Each File |
| 35 | + |
| 36 | +**SKILL.md** — frontmatter + routing table + always-follow rules |
| 37 | +- `name`: kebab-case skill name |
| 38 | +- `description`: what it does, exact trigger phrases, and explicit |
| 39 | + exclusions ("Do NOT invoke for..."). |
| 40 | + **IMPORTANT:** The description MUST be a single-line quoted string, NOT a YAML |
| 41 | + multiline block (`>` or `|`). Multiline descriptions break skill detection. |
| 42 | + Example: `description: "Does X. Trigger phrases: a, b. Do NOT invoke for: c."` |
| 43 | +- Body: index of Workflows with links, and any rules that apply |
| 44 | + to ALL workflows |
| 45 | + |
| 46 | +**CONVENTIONS.md** — domain-specific rules Claude must always follow |
| 47 | +- Formatting, file naming, forbidden patterns |
| 48 | +- Write specific checkable rules, not vague guidance |
| 49 | +- Referenced in SKILL.md "Always Follow" so it's loaded every time |
| 50 | + |
| 51 | +**Workflows/[Action].md** — step-by-step instructions for one task |
| 52 | +- Numbered steps in order |
| 53 | +- Bash commands in code blocks, referencing scripts/ by path |
| 54 | +- "Common Pitfalls" section at the bottom |
| 55 | + |
| 56 | +**scripts/[script].sh** — actual shell commands (only if needed) |
| 57 | +- Before creating any script, search the repo for existing scripts, |
| 58 | + build tools, npm scripts, or Makefiles that already do the job |
| 59 | +- If an existing script exists (e.g., `docs/build.sh`, `npm run build`), |
| 60 | + reference it directly in Workflows instead of creating a duplicate |
| 61 | +- Only create a new script when no existing tool covers the need |
| 62 | +- When creating: start with `#!/bin/bash` and `set -e` |
| 63 | +- Always cd to project root: `cd "$(git rev-parse --show-toplevel)"` |
| 64 | +- Called from Workflows via: `bash .claude/skills/[SkillName]/scripts/[script].sh` |
| 65 | +- Scripts run via bash — their code never enters Claude's context, |
| 66 | + only their output does |
| 67 | + |
| 68 | +## Steps to Create a New Skill |
| 69 | + |
| 70 | +1. Ask the user: |
| 71 | + - What does the skill automate? (tool, project, or domain) |
| 72 | + - What are the distinct actions it needs to handle? (each = one Workflow) |
| 73 | + - Are there domain conventions to follow? (yes → CONVENTIONS.md) |
| 74 | + - When should it auto-invoke, and when should it stay dormant? |
| 75 | + |
| 76 | +2. Search the repo for existing shell scripts, npm scripts, Makefiles, |
| 77 | + and build tools that relate to the skill's domain. List what you find |
| 78 | + and plan to reference them in Workflows instead of creating duplicates. |
| 79 | + |
| 80 | +3. Summarize the planned structure and confirm with the user |
| 81 | + |
| 82 | +4. Create all files — SKILL.md first, then Workflows, then CONVENTIONS.md. |
| 83 | + Only create scripts/ if no existing scripts cover the need. |
| 84 | + |
| 85 | +4. After creating, tell the user: |
| 86 | + - The full file tree of what was created |
| 87 | + - Example prompts that will trigger the new Skill |
0 commit comments