The anatomy of SKILL.md
A skill has two parts:
1. YAML frontmatter (between ---) — metadata. The most important field is description: the agent decides when to load the skill by reading exactly that.
2. A markdown body — the instructions the agent follows.
The directory name becomes the command name: .claude/skills/compose-review/SKILL.md creates the /compose-review command.
---
description: Reviews a Compose screen — recomposition, state hoisting, modifier order and previews. Use when the user asks for a Compose UI review or adds a new Composable.
allowed-tools: Read, Grep, Glob
---
## Changed files
!`git diff --name-only main -- '*.kt'`
## Review steps
Read the files above that contain Composables and check each one:
1. **State hoisting** — if the Composable holds its own state it cannot
be reused. The state should be hoisted.
2. **Recomposition** — is there computation directly in the Composable
body? It belongs in `remember` or the ViewModel.
3. **Modifier** — is it accepted as a parameter and applied first in
the modifier chain?
4. **Preview** — does every public Composable have a `@Preview`?
Report each finding as `file:line`. Do not modify files —
report only.A real skill. The `` !`git diff…` `` line is **dynamic context injection**: the command runs and its output is inlined before the agent reads the skill.
| Frontmatter field | What it does |
|---|---|
| `description` | What the skill does and when to use it. The agent's decision rests on this — the most important field. |
| `when_to_use` | Additional trigger phrases and example requests. |
| `allowed-tools` | Tools usable without a prompt while the skill runs. |
| `disallowed-tools` | Tools removed from the pool while the skill is active. |
| `disable-model-invocation` | `true` — only you can invoke it with `/name`, the agent cannot. |
| `model` / `effort` | The model and effort level while the skill is active. |
| `context: fork` | Runs the skill in a separate subagent context. |
| `paths` | Globs — the skill auto-loads only when matching files are in play. |
Write description in the user's words, not your own. "Reviews Compose" is weak; "Use when the user asks for a Compose UI review or adds a new Composable" is strong, because it matches real requests. description and when_to_use are truncated together past a certain length in the listing, so put the key use case first.
Extra mechanisms available in the body:
- Dynamic context injection — a `
!command` line runs before the agent reads the skill and its output is inlined. - Arguments —
$ARGUMENTS,$0,$1, or named arguments declared in frontmatter. - Variables —
${CLAUDE_PROJECT_DIR},${CLAUDE_SKILL_DIR}for referring to paths. - Supporting files —
reference.md,scripts/and so on in the skill folder, read only when the agent reaches for them.
📚 Sources and documentation
- Skill frontmatter referenceofficialcode.claude.com
All frontmatter fields, argument substitutions and dynamic context injection.
- Built-in commands and bundled skillsofficialcode.claude.com