Skills with scripts, templates and reference files
How to bundle scripts, templates and reference files in a skill, how progressive disclosure keeps them cheap, and when code execution is needed. 8 min
Read
Three levels of loading
Skills load in stages, which Anthropic calls progressive disclosure. At the start Claude sees only each skill's name and description, roughly 100 tokens per skill. When a request matches, it reads the body of SKILL.md, which Anthropic suggests keeping under 5,000 tokens. Every other file in the folder costs nothing until Claude opens it.
Scripts are cheaper still. When Claude runs a bundled script, only the output enters the conversation, never the code. A tested script is therefore more reliable and more economical than asking Claude to write the same code from scratch on every run.
The rule that follows: put the map in SKILL.md, and put the detail in files it points to.
Lesson notes: Skills with scripts, templates and reference files
Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You can lay out a multi-file skill so Claude loads only what each task needs.
Step 1 of 6 · Read
Three levels of loading
Skills load in stages, which Anthropic calls progressive disclosure. At the start Claude sees only each skill's name and description, roughly 100 tokens per skill. When a request matches, it reads the body of
SKILL.md, which Anthropic suggests keeping under 5,000 tokens. Every other file in the folder costs nothing until Claude opens it.Scripts are cheaper still. When Claude runs a bundled script, only the output enters the conversation, never the code. A tested script is therefore more reliable and more economical than asking Claude to write the same code from scratch on every run.
The rule that follows: put the map in
SKILL.md, and put the detail in files it points to.Step 2 of 6 · Read
A real layout
Here is an invoice checking skill for a small business owner. The body lists the steps and says exactly which file to open, or which script to run, at each point.
In Claude Code you can write the script path as
${CLAUDE_SKILL_DIR}/scripts/check_totals.py, so it works whichever folder you started in.Folder invoice-check/ SKILL.md reference/ suppliers.md vat-rules.md templates/ query-email.md scripts/ check_totals.pyinvoice-check/SKILL.md --- name: invoice-check description: Checks supplier invoices (PDF or CSV) against our supplier list and VAT rules, and drafts a query email for any mismatch. Use when the user uploads an invoice or asks to check one. --- # Invoice check 1. Run `python scripts/check_totals.py <invoice-file>`. It prints each line total, the VAT and any arithmetic errors. 2. Look up the supplier in [reference/suppliers.md](reference/suppliers.md) to confirm the agreed prices. 3. Only if VAT is charged at an unusual rate, read [reference/vat-rules.md](reference/vat-rules.md). 4. For each problem, fill in [templates/query-email.md](templates/query-email.md). Never send it. Show the draft to the user.
Step 3 of 6 · Sort
SKILL.md or a separate file?
Where should each piece of the invoice skill live?
- The four steps in order
- A 300 line table of supplier prices
- Arithmetic that must be exactly right every time
- The rule never to send the email without approval
- The standard wording of the query email
- Links telling Claude which file to read and when
Show the answers
- The four steps in order: In SKILL.md. This is the map Claude needs on every run.
- A 300 line table of supplier prices: In a bundled file or script. Long reference data. Claude opens it only when it needs a price.
- Arithmetic that must be exactly right every time: In a bundled file or script. A tested script gives the same answer on every run, and only its output uses context.
- The rule never to send the email without approval: In SKILL.md. A rule that applies to every run belongs where Claude always reads it.
- The standard wording of the query email: In a bundled file or script. A template keeps the wording consistent and stays out of the way until needed.
- Links telling Claude which file to read and when: In SKILL.md. Without these pointers Claude may never open the other files.
Step 4 of 6 · Read
Rules for bundled files
Keep links one level deep. Link every file directly from
SKILL.md. If one reference file points to another, Claude may only preview the second one and miss detail. Give any reference file over 100 lines a contents list at the top.Say run or read. "Run
check_totals.py" and "Seecheck_totals.pyfor the method" produce different behaviour, so be explicit.Make scripts solve the problem. Handle errors inside the script and print a clear message, instead of crashing and leaving Claude to guess. Explain any fixed value, such as a timeout. Use forward slashes in paths, even on Windows.
Step 5 of 6 · Read
When code execution is needed
Reading Markdown needs nothing special. Running scripts does. In the Claude app, skills need Code execution and file creation switched on, and whether a skill can reach the internet depends on your settings and your admin. Through the Claude API, skills run in a sandboxed container with no internet access and no installing packages while running, so only pre-installed libraries work.
In Claude Code, scripts run on your own computer with the same network access as any other program. Anthropic asks skill authors to install packages locally rather than globally, so a skill does not disturb the rest of your machine.
Design for the strictest place your skill will run. A script that calls a web API works in Claude Code but fails in the API container.
Step 6 of 6 · Quiz
Check your understanding
Your skill bundles a 40 page product manual as a separate file. A user asks something that needs only page 3. What did the manual cost in context before Claude opened it?
- Nothing until Claude read it
- About 100 tokens, like the description
- The whole manual, in every conversation
Show the answer
Nothing until Claude read it Bundled files cost no tokens until accessed. Split the manual by topic so Claude reads only the section it needs.