Sub topic 11
Progressive disclosure: metadata, instructions, resources
This chapter assumes you know what a context window is, have read the earlier chapters on skills and SKILL.md frontmatter, and can read simple YAML and Markdown. It covers how a skill's content reaches the model in stages, why that keeps skills cheap, and where the design breaks down.
File names, frontmatter fields, and loading details differ between products. The model described here is the common one. Check your tool's documentation for exact behavior.
The problem: many skills, one context window
Every token in the context window competes with the task itself. If you install twenty skills and each has 3,000 tokens of instructions, loading all of them at the start costs 60,000 tokens. Most of that text is irrelevant to any single request, and a crowded context can make the model less reliable at following the instructions that do matter.
Persistent project instructions, such as an AGENTS.md file, have this problem. They load on every request, so they must stay short. Skills avoid it by loading in stages.
Progressive disclosure means the agent reveals a skill's content only as far as the current task requires. A skill has three levels, and each level is loaded later and only if needed.
The three levels
| Level | What it is | When it loads | Typical size |
|---|---|---|---|
| 1. Metadata | `name` and `description` from the frontmatter | At startup, for every installed skill | Tens of tokens per skill |
| 2. Instructions | The body of `SKILL.md` | When the agent decides the skill matches the task | Hundreds to a few thousand tokens |
| 3. Resources | Reference files, templates, and scripts in the skill folder | Only when the instructions point to them and the task needs them | Unbounded, but read selectively |
The first level is the only one that costs something all the time. The cost is small and grows linearly with the number of skills, not with their size.
Level 1: metadata is the index
At startup the agent reads only the frontmatter of each skill. It places a short entry for each one in context, usually the name and description. The model then uses those entries as an index. When a request arrives, it decides whether any entry fits.
This has a direct consequence for how you write skills. The description is the only text the model sees when it decides whether to open the skill. If the description is vague, the skill is never selected. If it is too broad, the skill loads when it should not. Everything the model needs for that decision must fit in the description: what the skill does and when to use it.
Compare these two descriptions:
# Weak: says what the skill is, not when to use it
description: Helps with changelogs.
# Better: says what it does and names the triggers
description: Writes a changelog entry in the project's format. Use when the user asks to add, draft, or update a changelog or release note.Because every skill's description is always in context, a long description taxes every request. Aim for one or two sentences. Many products also cap the field's length.
Level 2: the SKILL.md body
When a request matches, the agent loads the body of SKILL.md. In most tools the model does this itself, by reading the file with its normal file-reading tool. In some tools the product injects the body for you. Either way, the instructions now sit in context and the model follows them like any other prompt.
Keep the body focused on the core procedure: the steps, the output format, and the rules that always apply. Move everything else out. A common guideline is to keep the body under a few hundred lines. If you find yourself pasting long tables, full style guides, or many examples, that content belongs in level 3.
Level 3: resources on demand
A skill folder can hold more than SKILL.md:
changelog-entry/
├── SKILL.md
├── reference/
│ └── format.md
└── scripts/
└── check_format.pyThe body of SKILL.md acts as a table of contents for these files. It names each resource and says when to use it:
---
name: changelog-entry
description: Writes a changelog entry in the project's format. Use when the user asks to add, draft, or update a changelog or release note.
---
# Changelog entry
1. Read the latest entries in CHANGELOG.md to match the format.
2. Group changes under Added, Changed, Fixed, or Removed.
3. Write one line per change, in the past tense.
4. If the entry covers a breaking change or a security fix, read reference/format.md first.
5. After editing, run `python scripts/check_format.py CHANGELOG.md`.Two kinds of resources behave differently.
- Reference files are read into context. They cost tokens when read, so the agent should read only the one it needs. Splitting a large reference by topic (for example,
reference/breaking-changes.mdandreference/security.md) lets the agent load one piece. - Scripts are run, not read. Only their output enters the context. A script that validates a file and prints
OKor a list of errors costs a few tokens, no matter how long the script is. This makes scripts a good place for work that must be exact, such as validation, parsing, or formatting.
Here is a small script that fits the skill above. It checks that each line in the changelog's newest section starts with a bullet and ends without trailing spaces.
import sys
from pathlib import Path
def check(path: str) -> list[str]:
errors = []
lines = Path(path).read_text(encoding="utf-8").splitlines()
for number, line in enumerate(lines, start=1):
if line.startswith("- ") and line != line.rstrip():
errors.append(f"line {number}: trailing whitespace")
return errors
if __name__ == "__main__":
problems = check(sys.argv[1])
if problems:
print("\n".join(problems))
sys.exit(1)
print("OK")Working through the token budget
Suppose you have 10 skills. Each has a 40-token description, a 1,500-token body, and one 4,000-token reference file.
- Loading everything up front: 10 × (40 + 1,500 + 4,000) = 55,400 tokens.
- With progressive disclosure, startup cost is 10 × 40 = 400 tokens.
- A task that uses one skill and needs its reference adds 1,500 + 4,000 = 5,500 tokens, for a total of 5,900.
The saving is the difference, roughly 49,500 tokens, which stay available for code, tool output, and conversation.
Gotchas and failure modes
The skill never triggers. Level 1 is the only gate. If the description does not use the words a user would use, the model does not open the skill. Test with realistic requests, not with the skill's own name.
Nested references. If SKILL.md points to a.md, and a.md points to b.md, the agent may read only part of the chain or skip it. Link every resource directly from SKILL.md, one level deep.
Hidden resources. A file that SKILL.md never mentions will not be read. The agent does not browse the folder on its own initiative reliably. Name each file and say when to use it.
Unconditional reads. A line such as "Read all files in reference/" removes the saving. Write conditions: "If the entry covers a security fix, read reference/security.md."
Bloated body. A 2,000-line SKILL.md loads in full every time the skill triggers. Level 2 is cheap only if you keep it small.
Instructions that drift out of attention. Once loaded, skill text is part of a long context. In long sessions, early instructions can be followed less closely. Put the most important rules near the top of the body.
Product differences. Some tools load only the description and require an explicit command to invoke the skill. Others let the model choose. Some inject the body automatically. Confirm which model your tool uses before relying on automatic selection.
A checklist for a well-layered skill
- The description states what the skill does and when to use it, in one or two sentences.
- The body holds the core steps and output format, and stays short.
- Every extra file is named in the body, with a condition for reading it.
- Reference files are one link away from
SKILL.md. - Exact, repeatable work lives in scripts that print short results.
- You tested with requests phrased the way a teammate would phrase them.
Exercise
A skill's SKILL.md is 1,800 tokens, and it also includes a 6,000-token style guide pasted into the body. Only about one request in five needs the style guide. Ten such skills are installed. Explain how you would restructure it, and estimate how many tokens you save per triggered use that does not need the guide.
Show answer
Move the style guide into a file such as reference/style.md and add a line to the body: "If the task involves X, read reference/style.md." The body shrinks to about 1,800 tokens. A triggered use that does not need the guide now costs 1,800 tokens instead of 7,800, saving about 6,000 tokens. Across the installed skills, the saving applies each time one of them triggers without needing its guide.
Exercise
Why does a validation script cost fewer tokens than a reference file that describes the same validation rules?
Show answer
A reference file is read into context, so its full text counts against the context window. A script is executed, and only its output (for example "OK" or a short error list) enters the context. The script's length does not matter to the token count.
Exercise
Your skill's description is "Helps with releases." Users ask "can you draft the notes for 2.4?" and the skill never loads. Rewrite the description and say why the change helps.
Show answer
For example: "Drafts release notes and version announcements from merged changes. Use when the user asks to write, draft, or update release notes, a changelog, or a version summary." The model decides at level 1 using only the description, so adding the user's likely words (draft, notes, changelog) and an explicit "use when" clause makes a match more likely.