How do a Claude Code skill's description, SKILL.md body and supporting files each reach Claude's context, and when?
answer
- three layers, three moments
- the listing rides every turn
- body on invocation, then it stays
- linked files read on demand
- scripts run without being read
basics
~20 sBy default the description sits in the skill listing on every turn; the SKILL.md body enters context only when the skill is invoked, then stays; supporting files load only when Claude follows a pointer to them, and bundled scripts run without being read.
solid answer
~40 sClaude Code realises progressive disclosure in three layers. The skill listing, with each skill's name and `description` (plus `when_to_use`), is in context on every turn so Claude knows what exists, unless the skill is hidden from Claude. The `SKILL.md` body loads only when you or Claude invoke the skill; it then enters the conversation as one message and stays across later turns without being re-read from disk. Supporting files in the skill folder, such as `reference.md` or `examples.md`, load only when Claude reads them, which is why `SKILL.md` should say what each file holds and when to open it. Scripts in the folder are executed, so their source never has to enter context; reference them as `${CLAUDE_SKILL_DIR}/scripts/...` so the path resolves wherever the skill is installed.
go deeper
Recall the three layers: description always listed, body loaded when the skill is used, extra files only when Claude opens them.
Explain that the body arrives as one message and stays, why that makes body length a recurring cost, and how pointers and CLAUDE_SKILL_DIR make supporting files and scripts work.
Show how you would split a large procedure across description, body, supporting files and scripts, and justify each placement by when it is paid for.
Discuss the tradeoff between a lean body that relies on Claude choosing to open files and a fuller body that is always followed but always paid for.
## The idea in Claude Code terms **Progressive disclosure** means giving a model a short index of what is available and loading the detail only when it is needed. Claude Code builds skills on exactly this shape, and knowing which part of a skill costs what, and when, is what lets a team turn a 2,000-line migration handbook into a skill without paying for it on every turn. ## Three layers, three moments | Layer | What it contains | When it is in context | | :- | :- | :- | | Skill listing | Each skill's name, `description` and `when_to_use` | Every turn, from session start | | `SKILL.md` body | The instructions below the frontmatter | From the moment the skill is invoked, then on every later turn | | Supporting files | Other files in the skill's folder | Only when Claude reads one | | Bundled scripts | Executables in the folder, such as `scripts/check.py` | Never as source; only their output, when Claude runs them | A few qualifications keep the table honest: - A skill with `disable-model-invocation: true` is left out of the listing, so its description costs nothing until you invoke it by name. - The combined `description` and `when_to_use` text is capped by default at 1,536 characters per skill in the listing, and the listing has an overall budget that can drop descriptions when many skills are installed. Tuning those is a description-design concern; the point here is that the listing is the always-on layer. ## The body: loaded once, kept When the skill is invoked, Claude Code renders `SKILL.md` and adds it to the conversation as a **single message**. That content **stays** for the rest of the session: 1. Claude Code does not re-read the file on later turns, so guidance that must hold throughout a task should be written as standing instructions, not one-time steps. 2. If Claude invokes the same skill again and the rendered content is identical, Claude Code adds a short note that the skill is already loaded instead of a second copy. 3. Because it stays, every line of the body is a recurring token cost. The docs suggest keeping `SKILL.md` under 500 lines and moving detailed reference material into separate files. When the conversation is later compacted, invoked skills are carried forward only within a token budget, which keeps the start of each body; that is one more reason to put the most important rules at the top. ## Supporting files: the third layer A skill directory can hold anything: ``` db-migrations/ ├── SKILL.md # rules and navigation ├── backfills.md # loaded when needed ├── incidents.md # loaded when needed └── scripts/ └── lint.py # executed, not loaded ``` Claude does not scan the folder into context. It reads a supporting file with its normal file tools when it decides it needs it, so `SKILL.md` has to **point** at each file and say what it contains: "For backfill patterns on large tables, see backfills.md". A file nothing mentions gives Claude no reason to open it. **Scripts** are the cheapest layer of all: Claude runs them and sees only their output. Write the path with `${CLAUDE_SKILL_DIR}`, which Claude Code substitutes with the directory holding `SKILL.md`, so `python3 ${CLAUDE_SKILL_DIR}/scripts/lint.py` works whether the skill is installed as a personal, project or plugin skill and wherever the session's working directory has moved. ## Splitting the migration handbook A practical split for the wiki page: - **Description:** one or two sentences naming the task and the triggers (adding a column, writing a migration file). - **Body:** the ten rules nobody may break, the naming convention, and the pointers. - **Supporting files:** backfill recipes, lock-time tables per database engine, past incident write-ups. - **Scripts:** a linter that checks a migration file for destructive statements, run instead of described. Mistakes that undo the design: - Writing the whole handbook into the body "to be safe", which turns an on-demand cost into a per-turn cost for the rest of the session. - Leaving supporting files unmentioned, so Claude never opens them. - Describing what a script does in prose instead of running it, which spends context on instructions a program could follow. The result costs a few hundred characters per turn until someone touches migrations, a few hundred lines once they do, and the deep material only on the rare task that needs it.
- Why not paste the whole 2,000-line migration handbook into SKILL.md?Once invoked, the body stays in the conversation on every later turn, so every line is a recurring token cost for the rest of the session, and after compaction only the start of a long invoked skill is kept. Keep `SKILL.md` to the rules and pointers, under about 500 lines, and move the detail into supporting files Claude reads only when a task needs them.
- How should SKILL.md refer to a bundled script so it runs from any working directory?Use `${CLAUDE_SKILL_DIR}`, which Claude Code replaces with the directory containing `SKILL.md`: `python3 ${CLAUDE_SKILL_DIR}/scripts/lint.py`. A relative path like `./scripts/lint.py` resolves against the session's current working directory, which moves whenever Claude runs `cd`. In a plugin skill the variable points at the skill's own subdirectory, not the plugin root.
A library catalogue: the index card (the description) is always in the drawer, the book (the SKILL.md body) is fetched only when a card matches, and the appendices (supporting files) are opened only when the book sends you to them.
- Every file in the skill folder is loaded when the skill is invoked.
- Claude re-reads SKILL.md from disk on every turn after invoking it.
- A skill's body costs context on every turn even before anyone invokes it.
- A bundled script's source is read into context before Claude runs it.
- Supporting files load automatically, so SKILL.md never needs to mention them.