In Claude Code, how do you write a skill's description so Claude loads the skill on the requests it should, and only those?
answer
- the listing, not the body
- lead with the use case
- words a user would type
- 1,536 characters with when_to_use
- broken YAML hides the description
basics
~20 sLead the description with what the skill does and when to use it, in the words users actually type; Claude matches requests against the listed description plus when_to_use, cut at 1,536 characters by default, never against the body.
solid answer
~40 sClaude decides whether to load a skill from the skill listing: each skill's name and its `description`, with `when_to_use` appended. The body plays no part until the skill is chosen. So the description must say what the skill does and when to use it, in the phrases people actually type ("fails in CI", "passes on retry"), with the key use case first, because the combined `description` and `when_to_use` text is cut at 1,536 characters by default (`skillListingMaxDescChars`). If a skill never fires, check its keywords, ask Claude "What skills are available?", and run with `--debug`: frontmatter that doesn't parse loads the skill with no fields, so `/name` works but matching cannot. If it fires on everything, make the description more specific, or set `disable-model-invocation: true` when it should only run by hand.
code
yaml · 10 lines---
name: flaky-test-triage
description: Triages a flaky test by rerunning it in isolation, comparing passing and failing runs, and naming the likely cause. Use when a test fails intermittently or passes locally but fails in CI.
when_to_use: Phrases such as "flaky test", "fails sometimes", "passes on retry", "only fails in CI", "intermittent failure".
---
## Steps
1. Rerun the failing test alone, then with its neighbours.
2. Compare timing, ordering and shared state between runs.
3. Report the likely cause and the evidence for it.go deeper
Remember that Claude chooses a skill from its description, not its body, and that typing /name always lets you run a user-invocable skill directly.
Explain the listing entry: description plus when_to_use, cut at 1,536 characters by default, key use case first, and what unparseable frontmatter does to matching.
Describe a debugging pass on a skill that never or always fires: keywords, parse errors with --debug, the listing budget, narrowing or disable-model-invocation, then should and should-not prompt sets.
Talk about description hygiene across many authors: overlapping descriptions compete, so someone reviews new descriptions against existing ones and tracks hit rates over time.
## How Claude chooses a skill In a normal session Claude Code places a **skill listing** in Claude's context every turn: for each skill Claude may invoke, its name and its `description`, with the optional `when_to_use` text appended. When a request arrives, Claude compares the task against those entries and, when one fits, loads that skill through the **Skill tool**. The `SKILL.md` body takes no part in that decision; Claude reads it only after the skill is chosen. If descriptions are vague or overlap, Claude may load the wrong skill or miss the one that would help. So the description is a routing rule written in prose. If you leave it out, Claude Code uses the first non-empty line of the body, which is rarely a good trigger. ## What a description that triggers looks like - **Key use case first.** The combined `description` and `when_to_use` text is truncated at **1,536 characters** in the listing by default, a cap you can change with the `skillListingMaxDescChars` setting. Anything decisive written after the cut is invisible to Claude. - **What it does, then when.** The docs' own example reads "Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff." - **The user's vocabulary.** People type "flaky", "passes on retry", "only fails in CI", not your internal tool names. Put those words in. - **`when_to_use` for extra trigger phrases.** It is appended to the description in the listing and counts toward the same cap. - **Distinct from its neighbours.** Two skills whose descriptions both say "helps with tests" compete for every testing request. Say what this one does that the other does not. ## Diagnosing a skill that never fires 1. Check that the description includes keywords users would naturally say. 2. Ask Claude "What skills are available?" to confirm the skill is loaded at all. 3. Rephrase the request closer to the description. If that makes it fire, the description is too narrow. 4. Invoke it with `/name` to confirm the body itself works. 5. Check the frontmatter parses. Claude Code reads frontmatter only when the opening `---` is the file's first line, and if the YAML doesn't parse the skill loads with **no fields set**: `/name` still works, but Claude has no description to match. `--debug` shows the parse error, and `claude plugin validate .claude/skills` finds `SKILL.md` files whose frontmatter doesn't parse. 6. Check field names. They are hyphenated except `when_to_use`, and Claude Code silently ignores a field it doesn't recognise, so `when-to-use:` never reaches the listing. 7. Consider the listing budget. With many skills installed, Claude Code may have dropped this skill's description to fit, starting with the least-used skills. ## Diagnosing a skill that fires too often - **Make the description more specific**; this is the documented first fix. - **Limit it by file**: the `paths` frontmatter field takes glob patterns, and Claude then loads the skill automatically only when working with matching files. - **Make it manual**: `disable-model-invocation: true` stops Claude from loading the skill on its own and removes it from the listing, so only `/name` runs it. Use this for skills with side effects. ## A worked rewrite A skill described only as `description: Testing helper` gives Claude almost nothing to match: it may never load on "this test only fails in CI", or it may load on every request that mentions tests. Rewritten as "Triages a flaky test by rerunning it in isolation, comparing passing and failing runs, and naming the likely cause. Use when a test fails intermittently or passes locally but fails in CI", it names the action, the situation and the words a user would type, all well inside the cap. ## Measuring instead of guessing | What you want to know | How | | :- | :- | | Does it fire on the right requests? | A set of should-trigger prompts, each run in a fresh session | | Does it stay quiet on the wrong ones? | A set of should-not-trigger prompts | | Did a description edit help? | Re-run the same sets and compare the hit rate | The skill-creator plugin automates this as **description tuning**: it generates should-trigger and should-not-trigger prompts, measures the hit rate and proposes description edits. For a skill shipped in a plugin, `claude plugin eval` with a `tool_used` grader on the Skill tool measures how often it fired across realistic prompts after each description change.
- Your description and when_to_use add up to 2,000 characters. What does Claude actually see?Only the first 1,536 characters of the combined text, the default `skillListingMaxDescChars`; the rest is cut in the listing. Anything decisive after the cut never influences Claude's choice. Move the key use case and trigger phrases to the front and push detail into the body, or raise the cap knowing every extra character is paid on every turn.
- A teammate wrote `when-to-use:` with hyphens. What happens?Claude Code ignores frontmatter fields it doesn't recognise, without reporting an error. Field names are hyphenated except `when_to_use`, so the hyphenated key is silently dropped and its trigger phrases never reach the listing. The skill still loads and matches on its `description` alone.
- How would you check that a description change actually improved triggering?Write a handful of prompts that should trigger the skill and a few that should not, phrased as users type them, and run each in a fresh session before and after the change. The skill-creator plugin automates this as description tuning with a measured hit rate; for a plugin's skill, `claude plugin eval` with a `tool_used` grader on the Skill tool counts how often it fired.
A skill's description is the index card in a library catalogue: the librarian decides which book to fetch from the card alone, so a card that names the wrong subject, or is cut off before the subject, means the book stays on the shelf however good it is.
- Claude reads every skill's full body to decide which one applies.
- A longer description always triggers more reliably.
- Trigger phrases belong in the body, where Claude reads them.
- If /name works, the frontmatter must be fine.
- A skill that fires too often needs a bigger listing budget.