Topic 5 of 5 · 4 min read
Progressive disclosure with indexes and skills
Goal: Restructure a large instruction set into a short index plus on-demand files so the agent loads detail only when needed.
Show the agent a short index of what exists, and load the full file only when the task needs it. This is progressive disclosure: the cheap layer always, the expensive layer on demand.
Check yourself · 1 of 3
In progressive disclosure, what does the agent see before it opens a skill's full instructions?
Why it matters
A single instruction file that grows to cover testing, deployment, database rules, frontend style and incident steps is read on every task, even when the task is a typo fix. The agent pays for all of it and may follow the wrong part. Splitting it keeps the always-loaded part small and relevant.
The three layers
- Index. A name and one-line description per item. Always loaded. Cheap.
- Body. The full instructions for one item, loaded when the agent judges the task matches.
- Resources. Scripts, templates and reference files the body points to, opened only if that step needs them.
Claude Code skills work this way: each skill is a folder with a SKILL.md file, and the description in its header is what the agent sees up front, with the full text read when the skill is used. Project instruction files can also point to other files with paths instead of repeating their content.
How to restructure
- List the sections of the big file and mark which apply to every task and which only to some.
- Keep the every-task part in the main file, short and plain.
- Move each situational part to its own file, named by its job (
docs/db-migrations.md). - In the main file, add one line per moved file saying when to read it.
- Test with a few real tasks: does the agent open the right file, and only that one?
Before and after
Weak:
CLAUDE.md (900 lines): code style, test rules, deploy steps, DB migration rules,
release checklist, incident runbook, API conventions ...
Better:
CLAUDE.md (35 lines): build and test commands, code style basics, then:
- Changing the database schema: read docs/db-migrations.md first.
- Cutting a release: read docs/release-checklist.md.
- Production incident: read docs/incident-runbook.md.
- Adding an API route: read docs/api-conventions.md.
What goes wrong
- Vague triggers. "See docs/ for details" tells the agent nothing about when to open what. Name the situation.
- Descriptions that do not match the task. If a skill's one-liner is generic, the agent never selects it, or selects it for everything.
- Hiding must-follow rules. A rule that applies to every task (never edit generated files) belongs in the always-loaded part.
- Deep chains. An index that points to an index that points to a file makes the agent spend turns just navigating.
Examples
Splitting an oversized instruction file
A team's single file mixes everything. They keep 30 lines (commands, style, never-edit-generated rules) and create four situational files with one-line triggers. A typo fix now loads 30 lines. A schema change loads those 30 plus the migration guide. Cost follows the task.
Writing a skill description that gets selected
Weak: description: Helps with database stuff.
Better: description: Use when writing or reviewing SQL migrations: naming, rollback steps and zero-downtime rules for our Postgres setup.
The second says what it covers and when to use it, so the agent can match it to a task.
Key points
- Always load a short index; load the full body of a file or skill only when the task matches.
- An index entry is a name plus a one-line description that says when to use the item.
- Keep rules that apply to every task in the always-loaded file; move situational detail out.
- Point to files by path with a clear trigger, such as "when changing the schema, read docs/db-migrations.md".
- Test the structure with real tasks and check which files the agent actually opens.
Common mistakes
- Leaving one giant instruction file that loads in full on every task.
- Writing triggers like "see docs for more" that do not say when to open a file.
- Moving a universal rule into an on-demand file where it will be skipped.
- Building index-of-index chains that cost extra turns before any real work.
Check yourself · 2 of 3
Which line in a main instruction file is the best pointer to a moved file?
Check yourself · 3 of 3
A rule says "never edit files in generated/". Where should it live?
Practice items, not counted towards your mastery.
Start here
- Effective context engineering for AI agents (Anthropic) (opens in a new tab)ArticleFree
Defines just-in-time context, light references and the hybrid of pre-loaded data plus agent exploration.
- Context engineering for agents (LangChain) (opens in a new tab)ArticleFree
A vendor-neutral map of writing, selecting, compressing and isolating context for agents.
- Best practices for Claude Code (Claude Code docs) (opens in a new tab)DocsFree
Practical advice on instruction files, exploring code and verifying work with a coding agent.
More for this topic
- Extend Claude with skills (Claude Code docs) (opens in a new tab)DocsFree
Shows how skills expose a short description first and load full instructions when used.