Blog / Authoring
Progressive Disclosure in Skills: references/ and scripts/
How a skill keeps context small: name and description always load, SKILL.md on trigger, references/ and scripts/ only on demand. Patterns, limits, an example.

A skill loads in three stages: name and description always, the SKILL.md body when it triggers, and everything else only when read or run. The folders you add are how you use that third stage.
Table of contents
- The short answer
- The three levels
- What goes in SKILL.md
- references/: files Claude reads on demand
- scripts/: code that runs without loading
- Three layout patterns
- A worked example
- Rules that keep it working
- How other tools treat the same folders
- What Ragspaces adds
- Common mistakes
- FAQ
The short answer
Put the instructions every run needs in SKILL.md, keep it under 500 lines, and move everything else into files that SKILL.md links to. Detailed documentation goes in a references/ folder (Claude reads a file only when the task needs it). Deterministic work goes in a scripts/ folder (Claude runs a script and only the output enters context, not the code).
Anthropic's documentation states the benefit directly: bundled files "don't consume context until accessed," so a skill "can include dozens of reference files, but if your task only needs the sales schema, that's the one file Claude loads" (Agent Skills overview, checked 2026-11-23). The name references/ and scripts/ is a convention. Cursor's docs use the same folder names, and the Anthropic examples use reference/ and scripts/, so nothing breaks if you pick one or the other, as long as SKILL.md links to the right path.
I build AI agents full-time and I read a lot of skills. The most common authoring mistake is one 900-line SKILL.md that loads in full every time it triggers. This article is the fix. It draws on Anthropic's docs, Claude Code's docs and Ragspaces catalog pages, all read on 2026-11-23.
The three levels
The overview defines three levels and gives each a cost:
| Level | When it loads | Token cost (Anthropic) | Content |
|---|---|---|---|
| 1. Metadata | Always, at startup | "~100 tokens per Skill" | name and description from the frontmatter |
| 2. Instructions | When the skill is triggered | "Under 5k tokens" | The body of SKILL.md |
| 3. Resources | "As needed" | "None until accessed" | Bundled files; scripts run and only their output enters context |
Source: Agent Skills overview.
Level 1 is why you can install many skills without a penalty: "until a Skill is triggered, only its name and description occupy context." Level 2 happens when Claude reads SKILL.md with a bash command, and only then does the body enter the context window. Level 3 is entirely under your control. Nothing loads unless a line in SKILL.md tells Claude to open a file or run a script, and Claude chooses to.
Claude Code adds details about what happens after level 2. The docs say "the rendered SKILL.md content enters the conversation as a single message and stays there across later turns," and Claude Code "does not re-read the skill file on later turns." So a long body is paid for on every later turn of that conversation, not only on the turn that triggered it. That is one reason when to use /clear and when to use /compact changes what a long session costs. When the conversation is compacted, Claude Code "re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each," within a combined budget of 25,000 tokens (Claude Code skills docs). A body that runs past roughly 5,000 tokens is therefore cut off after compaction. Trimming the body is not only a style point; it decides what survives.
What goes in SKILL.md
Anthropic describes SKILL.md as "an overview that points Claude to detailed materials as needed, like a table of contents in an onboarding guide" (best practices). Keep in it:
- the trigger context and the core workflow, in steps;
- the rules that apply on every run;
- one or two short examples of the output;
- links to the other files, each with a sentence saying when to open it.
Leave out anything only some runs need: long API listings, edge-case handling, background reading, big examples.
The best-practices page also asks you to challenge each line. "Does Claude really need this explanation?" "Does this paragraph justify its token cost?" Its example of a bad paragraph explains what a PDF is before telling Claude to use pdfplumber. Claude already knows what a PDF is.
The limits to remember: name is at most 64 characters (lowercase letters, numbers, hyphens), description is at most 1,024 characters, and the body should stay "under 500 lines for optimal performance." The 500-line figure is guidance, not an enforced cap.
references/: files Claude reads on demand
A reference file is plain markdown (or any text) that SKILL.md links to. The overview calls these "additional Markdown files containing specialized guidance and workflows" and lists the other typical content: "database schemas, API documentation, templates, or examples."
Claude loads a reference only when the instructions point at it and the task needs it. In Anthropic's example, a PDF skill's body says "For advanced form filling, see FORMS.md," and the file stays on disk when the user only wants text extracted.
Write the link so it says when to open the file, not only that the file exists:
## Advanced features
**Form filling**: When the user wants to fill a form, read [forms.md](forms.md).
**API reference**: For method signatures, see [reference.md](reference.md).
**Examples**: For common patterns, see [examples.md](examples.md).
Three rules from Anthropic's best practices make references work:
- Keep references one level deep. "Claude might partially read files when they're referenced from other referenced files," and may "use commands such as
head -100to preview content rather than reading entire files, resulting in incomplete information." Link every reference directly fromSKILL.md, not from another reference. - Add a table of contents to long files. "For reference files longer than 100 lines, include a table of contents at the top," so Claude sees the full scope even in a partial read.
- Name files by content. The docs prefer
form_validation_rules.mdtodoc2.md, andreference/finance.mdtodocs/file1.md.
Also use forward slashes in every path, "even on Windows." Backslash paths "cause errors on Unix systems."
scripts/: code that runs without loading
A script is a file Claude runs rather than reads. The overview says that when instructions mention executable scripts, "Claude runs them through bash and receives only the output (the script code itself never enters context)." The Claude Code docs describe scripts as "executed, not loaded," and ${CLAUDE_SKILL_DIR} points at the directory that holds SKILL.md, so a skill can refer to its own scripts regardless of where the user is working.
The best-practices page lists four advantages of shipping a script even when Claude could write one: it is "more reliable than generated code," it saves tokens ("no need to include code in context"), it saves time, and it "ensure[s] consistency across uses."
Be explicit about intent in SKILL.md, because the same file can be run or read:
- "Run
analyze_form.pyto extract fields" means execute. - "See
analyze_form.pyfor the field extraction algorithm" means read as a reference.
For most utility scripts, the docs prefer execution.
Three habits make scripts safe to rely on:
- Handle errors in the script. The docs call this "solve, don't defer": a script that creates a missing file or returns a clear message beats one that crashes and leaves Claude to guess.
- Justify constants. A bare
TIMEOUT = 47is a "voodoo constant"; add a comment saying why. - Make validators verbose. Error messages such as "Field 'signature_date' not found. Available fields: ..." let Claude fix the problem on the next try.
One security note. A script is code that runs with your permissions. The Claude Code docs say skills there have "the same network access as any other program on the user's computer." If you install a skill from somewhere else, read its scripts/ folder first. The overview's advice is to "audit thoroughly" every bundled file.
Three layout patterns
Anthropic's best practices describe three patterns. Pick by the shape of your content.
Pattern 1: high-level guide with references. One workflow, with optional depth. SKILL.md has a quick start and links to FORMS.md, REFERENCE.md and EXAMPLES.md. Use it when most runs need only the quick start.
Pattern 2: domain-specific organization. Several domains, one per file. A bigquery-skill/ has SKILL.md and a reference/ folder with finance.md, sales.md, product.md and marketing.md. The docs explain the point: "When a user asks about sales metrics, Claude only needs to read sales-related schemas, not finance or marketing data." Use it when a request touches one domain at a time.
Pattern 3: conditional details. Basic content inline, advanced content linked. A DOCX skill covers creating documents in the body and links REDLINING.md for tracked changes and OOXML.md for XML details, which Claude reads "only when the user needs those features." Use it when the advanced path is rare.
Patterns combine. A large skill might use pattern 2 for its data and pattern 3 for its edge cases.
A worked example
Suppose you wrote a skill that reviews pull requests, and it has grown to 700 lines: a review checklist, the team's style rules for four languages, a long list of security smells, and a script that counts changed files by directory.
Here is the same skill after restructuring:
pr-review/
SKILL.md
references/
style-python.md
style-typescript.md
style-go.md
style-sql.md
security-smells.md
scripts/
changed_files.py
And the SKILL.md:
---
name: pr-review
description: "How a skill keeps context small: name and description always load, SKILL.md on trigger, references/ and scripts/ only on demand. Patterns, limits, an example."
---
# PR review
1. Run `python scripts/changed_files.py` to list changed files by directory.
2. Read the diff for each changed file.
3. Check correctness first: logic errors, missing tests, broken edge cases.
4. For each language in the diff, read the matching style file:
- Python: [references/style-python.md](references/style-python.md)
- TypeScript: [references/style-typescript.md](references/style-typescript.md)
- Go: [references/style-go.md](references/style-go.md)
- SQL: [references/style-sql.md](references/style-sql.md)
5. If the diff touches authentication, input handling or secrets, read [references/security-smells.md](references/security-smells.md).
6. Report findings as a list, highest severity first.
What changed in cost. A Go-only pull request now loads the roughly 40-line body and style-go.md, and never loads the Python, TypeScript, SQL or security files. The counting script runs, and only its output enters context. Your numbers will depend on file sizes, and the structure matches Anthropic's pattern 2 and the loading rule in its overview: files "cost zero tokens" until read.
Keep each step's link beside the condition. "For each language in the diff" and "If the diff touches authentication" tell Claude when to open the file. A bare list of files at the bottom invites Claude to skip them or load them all.
Rules that keep it working
Test whether Claude opens the right files. Anthropic's guidance for iterating on a skill is to watch how Claude navigates it: "Unexpected exploration paths," "Missed connections" (Claude fails to follow a link, so make it more explicit), "Overreliance on certain sections" (move that content into SKILL.md), and "Ignored content" (if a bundled file is never opened, it may be unnecessary or poorly signaled).
Do not hide must-follow rules in a reference. If every run needs a rule, it belongs in the body. A reference is for things Claude may need.
Do not put the description's job in a reference. The description is the only part Claude sees before it triggers. Trigger phrases belong there.
Keep dependencies explicit. If a script needs a package, list it in SKILL.md. The best-practices page says: "Don't assume packages are available." In its package notes, the Claude API has no network access and no runtime package installation, so a script that installs from PyPI will fail there.
Mind the listing, not only the body. In Claude Code, "Every skill in the skill listing adds to your context on every turn." The combined description and when_to_use text is truncated at 1,536 characters, and the listing's budget "scales at 1% of the model's context window." Splitting a body into references does nothing for the listing, so keep descriptions tight too. The post on how skills cost tokens covers these figures.
How other tools treat the same folders
The folder names are a convention shared across tools. Cursor's skills documentation lists scripts/ as "Executable code that agents can run," references/ as "Additional documentation loaded on demand," and assets/ as "Static resources like templates, images, or data files," and recommends keeping SKILL.md focused (Cursor skills docs). Codex loads skills the same staged way, starting with the name and description, and its skill list "uses at most 2% of the model's context window" by default (Codex skills docs). A skill restructured this way therefore carries over. The post on agent skills vs Cursor rules vs Windsurf rules compares what each tool reads.
What Ragspaces adds
Ragspaces is an open catalog of 5,299 agent skills for Claude Code and Codex (home page count on 2026-11-23). A skill there is a folder with a SKILL.md "plus any scripts it needs," so the structure in this article is the structure Ragspaces stores. Free skills install into your own Claude Code or Codex with one command, and a hook uploads a skill when your agent saves it. API keys in files are blanked out before upload, which matters if a script in scripts/ contained one by accident (how it works).
Catalog pages as of 2026-11-23, which you can read to see how authors write descriptions and bodies:
- skill-creator by @erik_forge: "Create new skills, modify and improve existing skills, and measure skill performance."
- skill-creator by @kenjikhan: a guide for creating skills with specialized knowledge, workflows or tool integrations.
- skill-creator by @oscar_schmidt: a guide for creating effective skills.
- wcag by @aishac: a long advisory skill, the kind that benefits from splitting by topic.
- soc2 by @vera_963: another advisory skill covering five criteria, which maps naturally to pattern 2.
- agents-md by @mayaj: a small skill that keeps its instructions short.
The notes above describe what each page says, not how each folder is laid out.
Common mistakes
One huge SKILL.md. It loads whole, every trigger, and past 5,000 tokens it is truncated after compaction.
References that link to references. Claude may only preview the second file. Link everything from SKILL.md.
A list of files with no conditions. Claude cannot tell when to open each one.
A script that Claude is told to "see" when it should run it. Say "run" for execution.
Backslash paths. They break on macOS and Linux.
Splitting too early. A 60-line skill does not need a references/ folder. The overhead of extra files is only worth it when content is long and only sometimes needed.
Stuffing the description. The description is capped at 1,024 characters and the listing truncates at 1,536 for description plus when_to_use. Put the detail in the body or a reference.
Frequently asked questions
What is progressive disclosure in a skill?
It is staged loading. Claude always sees the name and description, reads the SKILL.md body when the skill triggers, and opens bundled files or runs scripts only when the instructions call for them. Anthropic lists the costs as about 100 tokens, under 5,000 tokens, and none until accessed.
What goes in references/ and what goes in scripts/?
Put documentation, schemas, templates and examples in references/. Claude reads them when needed. Put deterministic operations in scripts/. Claude runs them, and only the output enters context. Both folder names are conventions, not requirements.
How long should SKILL.md be?
Anthropic says to keep the body under 500 lines for optimal performance and to split content into separate files as you approach that. It also gives under 5,000 tokens as the level 2 figure. These are guidance, not enforced limits.
Why keep references one level deep?
When one reference links to another, Claude may preview the second with a command like head -100 and miss content. Anthropic says to link every reference directly from SKILL.md so Claude reads complete files when needed.
Do scripts cost context tokens?
The script's code does not. Anthropic says Claude "runs them through bash and receives only the output," so only the output consumes tokens. The script still has to be written and maintained, and you should audit scripts from others.
Does this work outside Claude Code?
The structure does. Cursor documents scripts/, references/ and assets/ folders, and Codex describes skills as using progressive disclosure. Check each tool's docs for the folders and frontmatter fields it reads.
Key takeaways
- Level 1 is always loaded, level 2 loads on trigger, level 3 loads only when read or run.
- Keep
SKILL.mdas an overview under 500 lines and link to detail files with a condition for each. - Use
references/for documents andscripts/for deterministic work, and link every file directly fromSKILL.md. - Add a table of contents to reference files over 100 lines and use forward slashes in paths.
- Watch which files Claude opens, and move content between the body and references based on what you see.
The bottom line
Write SKILL.md as the page every run reads and treat everything else as a library Claude visits only when a step sends it there. Split by domain when requests touch one area at a time, split by condition when the advanced path is rare, and put repeatable operations in scripts.
If you want to see how real skills are laid out, browse the Ragspaces catalog. Skill pages show the description, README and reviews with no account.
Related articles
- Skills vs subagents vs slash commands in Claude Code: what a skill costs in context and how it can run in a subagent.
- SKILL.md vs CLAUDE.md vs AGENTS.md: where instructions belong and what loads when.
- Agent skills vs Cursor rules vs Windsurf rules: the other tools that read these folders.
About this research
Dmitry Makarenko co-founded Zipy as VP R&D, leading 50+ engineers across five countries, and now builds AI agents full-time. (LinkedIn)
This article is based on Anthropic's Agent Skills overview and best practices, the Claude Code skills documentation, Cursor's skills documentation, OpenAI's Codex skills documentation and Ragspaces catalog pages, all read on 2026-11-23. Content reviewed and updated: 2026-11-26
Keep reading
Turning a CLAUDE.md Section Into a Skill
How to move a procedure out of CLAUDE.md into a SKILL.md: pick the section, write the description, split the body, test that it fires. With a worked example.
How to Test a Skill Before Publishing It
Test a skill in three layers before you publish: does it trigger, does it follow the steps, does it beat no skill. A practical checklist with eval examples.
How to Turn a Skill Into an MCP Tool Others Can Call
A skill can run as an MCP tool: callers send inputs and get a result, never the prompt or scripts. How the wrapper works, what to design, and ways to publish.