Anatomy of Skills
Reusable skills, playbooks, references, and how to structure them.

Reusable, auto-activating capability packs that make Claude predictable and powerful.
TL;DRโ
- A Skill is a folder under
skills/containing instructions, scripts, references, and assets. - Claude auto-loads a skill when the user's intent matches its triggers.
- One skill = one job, done well.
- Skills make repeatable workflows deterministic and reviewable.
Why this mattersโ
Skills are like kitchen mise en place โ ingredients, tools, and recipes prepped before service. When the order comes in, you don't improvise; you execute.
Bottom line: Skills convert tribal knowledge into shippable AI behavior.
The Big Pictureโ
Bottom line: Trigger โ load โ execute โ audit.
Skill Anatomyโ
skills/code-review/
โโโ SKILL.md # Instructions & triggers
โโโ scripts/
โ โโโ analyze.sh # Executable automation
โ โโโ report.sh # Generates summary
โโโ references/
โ โโโ style-guide.md
โ โโโ checklist.md # Loaded on demand
โโโ assets/
โโโ pr-template.md
| Folder | Purpose |
|---|---|
SKILL.md | The skill's brain โ metadata, triggers, instructions |
scripts/ | Shell/Node/Python scripts the skill may run |
references/ | Long docs loaded on demand to save context |
assets/ | Static templates, diagrams, examples |
SKILL.md Structureโ
---
name: code-review
description: Review code quality, security, and tests on PRs.
triggers: ["review", "audit", "pr", "quality"]
auto_activation: true
requires: [git, node, grep]
---
## When to activate
When the user asks to review, audit, or check a PR.
## What it does
1. Run `scripts/analyze.sh` to diff against `main`.
2. Check tests & coverage.
3. Report findings with file:line refs.
## Output format
- Summary
- Risks & issues
- Missing tests
- Suggestions (file:line)
## Notes
Follow project rules in CLAUDE.md.
Step-by-Step Setupโ
1. Scaffold the skillโ
mkdir -p skills/code-review/{scripts,references,assets}
touch skills/code-review/SKILL.md
2. Write SKILL.md (see template above)โ
3. Add an executableโ
cat > skills/code-review/scripts/analyze.sh <<'EOF'
#!/usr/bin/env bash
git fetch origin main
git diff origin/main --stat
EOF
chmod +x skills/code-review/scripts/analyze.sh
4. Add references (loaded on demand)โ
echo "# Style guide ..." > skills/code-review/references/style-guide.md
5. Testโ
Ask Claude: "Review my last PR." โ the skill should auto-activate.
Variants for Different Team Settingsโ
๐ค Soloโ
One skill: code-review. That's enough.
๐ฅ Small teamโ
Add test-writer, docs-writer. Standardize triggers across the team.
๐ข Enterpriseโ
- Pin script versions and code-sign them.
- Require review for any skill change.
- Add an
audit_logfield toSKILL.md.
---
name: security-audit
audit_log: /var/log/claude/skills.log
---
๐ Open-sourceโ
- Ship skills inside the repo so forks inherit them.
- Add a
CONTRIBUTING-SKILLS.mdwith examples.
Bottom line: Same folder shape, escalating governance.
Trigger Examplesโ
Phrases that activate code-review:
- "review this PR"
- "audit the code"
- "check quality"
- "any issues?"
- "lint and review"
๐ก Tip: Add synonyms people actually use in your team.
Popular Skills (examples)โ
| Skill | Best for | Key tools | Outputs |
|---|---|---|---|
code-review | PR reviews, quality gates | Read, Bash, Grep | Review report |
test-writer | Unit & integration tests | Read, Bash, Edit | Tests + coverage |
docs-writer | Docs, API references | Read, Edit | Markdown docs |
security-audit | Vulnerabilities, secrets | Read, WebSearch | Risk report |
refactor | Code cleanup & design | Read, Edit, Bash | Refactored code |
bug-triage | Issue classification | Read, WebSearch | Triage summary |
Common Patterns & Recipesโ
Pattern 1 โ Multi-step skillโ
## What it does
1. Lint โ `scripts/lint.sh`
2. Test โ `scripts/test.sh`
3. Build โ `scripts/build.sh`
4. Report combined results.
Pattern 2 โ Reference-only skill (no scripts)โ
Use this for "always remind Claude of X" โ references/ loaded conditionally.
Pattern 3 โ Skill that calls a subagentโ
After analysis, delegate fixes to `@refactor` subagent.
Pattern 4 โ Trigger with exclusionsโ
triggers:
include: ["review", "audit"]
exclude: ["self-review"]
Best Practices โ โ
- One job per skill.
- Clear triggers & description.
- Keep
SKILL.mdconcise (< 200 lines). - Scripts must be deterministic.
- Reference
CLAUDE.mdinstead of duplicating rules. - Version skills with the repo.
Anti-Patterns โโ
- Mega-skill that does everything.
- Vague trigger words ("help", "do").
- Non-idempotent scripts.
- Skills with hard-coded secrets.
- No description โ impossible auto-routing.
Troubleshootingโ
| Symptom | Cause | Fix |
|---|---|---|
| Skill never activates | Trigger mismatch | Add synonyms |
| Wrong skill activates | Triggers too broad | Add exclude list |
| Script fails | Missing dependency | Add to requires: |
| Slow | Heavy script in hot path | Move work to subagent |
| Stale output | References outdated | Update + commit |
Skill Skeleton (copy this)โ
---
name: my-skill
description: Do one thing really well.
triggers: ["mytask", "synonym"]
requires: [bash]
---
## When to activate
<conditions>
## What it does
1. Step one
2. Step two
## Output format
- ...
## Notes
Follow CLAUDE.md.
๐ก Tip: Start tiny. Evolve as the skill proves valuable.
Glossaryโ
- Skill โ A folder Claude auto-loads to handle a specific task.
- Trigger โ A keyword or phrase that activates a skill.
- Auto-activation โ Skill loads without explicit user invocation.
- Reference โ A long doc loaded on demand (saves context budget).
- Asset โ A static template, image, or example file.
Further Readingโ
- Search: "Claude Code skills documentation"
- Search: "prompt engineering reusable patterns"
- Search: "awesome-claude-skills GitHub"