Skip to main content

Anatomy of Skills

Reusable skills, playbooks, references, and how to structure them.

Skills

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
FolderPurpose
SKILL.mdThe 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_log field to SKILL.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.md with 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.


SkillBest forKey toolsOutputs
code-reviewPR reviews, quality gatesRead, Bash, GrepReview report
test-writerUnit & integration testsRead, Bash, EditTests + coverage
docs-writerDocs, API referencesRead, EditMarkdown docs
security-auditVulnerabilities, secretsRead, WebSearchRisk report
refactorCode cleanup & designRead, Edit, BashRefactored code
bug-triageIssue classificationRead, WebSearchTriage 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.md concise (< 200 lines).
  • Scripts must be deterministic.
  • Reference CLAUDE.md instead 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โ€‹

SymptomCauseFix
Skill never activatesTrigger mismatchAdd synonyms
Wrong skill activatesTriggers too broadAdd exclude list
Script failsMissing dependencyAdd to requires:
SlowHeavy script in hot pathMove work to subagent
Stale outputReferences outdatedUpdate + 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"