Shipping reliable AI apps, part 10 of 11
Agent skills explained: when a SKILL.md beats a longer prompt
Why a growing system prompt costs more and works worse, and how agent skills load instructions only when a task needs them.
After this video
You can decide what goes in a skill, the always-loaded file or the prompt, and write a SKILL.md whose description actually triggers.
The short version
A system prompt that carries every procedure is sent with every request, and models get less reliable as their input grows. An agent skill is a folder with a SKILL.md: only its name and description sit in the system prompt, the body is read when a task matches, and extra files and scripts load only when needed. The description is the trigger, so it says what the skill does and when to use it, with the trigger words first. Facts every task needs go in CLAUDE.md or AGENTS.md, one-off asks stay in the prompt, and skills from outside get audited like a dependency.
Skill, not prompt
Everything in the system prompt is sent and read on every request, and accuracy drops as input grows. A skill keeps a procedure out of the context until a task needs it.
Five procedures. Five 4,000-token procedures in the prompt: 20,000 tokens per request. As skills: about 500 tokens of descriptions plus the one 4,000-token body the task needs.
One SKILL.md
A skill is a folder with a SKILL.md. Frontmatter holds a name (lowercase, hyphens, up to 64 characters) and a description (up to 1,024 characters); below it are plain Markdown steps.
release-notes. description: Writes release notes from merged PRs. Use when someone asks for release notes or a changelog.
Three levels
Level 1, name and description, is always loaded. Level 2, the SKILL.md body, loads when a task matches. Level 3, other files and scripts, loads only when the body points to them; a script's code never enters the context, only its output.
A label check. A TypeScript script finds merged PRs with no label; only "3 PRs have no label" comes back.
The description
The model matches requests against descriptions, so a vague one never loads. Write it in third person with real trigger words first: tools trim descriptions when many skills are installed.
Skill or prompt
Needed every time: the always-loaded file (CLAUDE.md or AGENTS.md). Needed sometimes: a skill. Needed once: just ask. Skills and instruction files guide the model; a hook is what blocks an action.
Write it well, trust it carefully
Only write what the model can't know, keep the body under 500 lines, link files one level deep, and test on three real tasks before and after. A skill can ship scripts, so install from trusted sources and audit the rest.
Check yourself
Your agent needs the team's test command on every task. Skill or always-loaded file?
The always-loaded file (CLAUDE.md or AGENTS.md): it is needed every time, and a skill would only add a step to find and load it.
Your skill never loads when someone asks "what shipped this week?". What do you change first?
The description: say what it does and when to use it, with the words people actually say (release notes, changelog, what shipped) first.
Why move a counting or checking step into a script inside the skill?
The script runs and only its output enters the context, and code gives the same answer every run; generating it with tokens costs more and can vary.
Sources
Every claim in this video was checked against these pages. Open one to see the claims it backs and the exact words they rest on.
anthropic.com/…/equipping-agents-for-the-real-world-with-agent-s
- A skill is a folder that contains a SKILL.md file.
At its simplest, a skill is a directory that contains a SKILL.md file
- At startup the agent loads every installed skill's name and description into its system prompt.
At startup, the agent pre-loads the name and description of every installed skill into its system prompt.
- The full SKILL.md body is read into context only when the model decides the skill is relevant.
If Claude thinks the skill is relevant to the current task, it will load the skill by reading its full SKILL.md into context.
- Install skills only from trusted sources.
We recommend installing skills only from trusted sources.
- A malicious skill can direct the agent to exfiltrate data or take unintended actions.
direct Claude to exfiltrate data and take unintended actions
- Audit a less-trusted skill before use: read its files, scripts and network calls.
When installing a skill from a less-trusted source, thoroughly audit it before use.
- Anthropic published Agent Skills as an open standard.
We've published Agent Skills as an open standard for cross-platform portability.
- Code is deterministic, so a script step is consistent and repeatable.
And because code is deterministic, this workflow is consistent and repeatable.
- Sorting a list by generating tokens costs far more than running a sort.
sorting a list via token generation is far more expensive than simply running a sorting algorithm
- Skills can bundle reference files, scripts and templates, like an onboarding guide for a new hire.
Building a skill for an agent is like putting together an onboarding guide for a new hire.
- Monitor how the model uses a skill and iterate; watch the name and description most.
Pay special attention to the name and description of your skill.
- The metadata is the first level of progressive disclosure.
This metadata is the first level of progressive disclosure
- Skills are meant to complement MCP servers by teaching workflows that use external tools.
how Skills can complement Model Context Protocol (MCP) servers by teaching agents more complex workflows that involve external tools and software
- A skill is a folder that contains a SKILL.md file.
docs.claude.com/…/overview
- SKILL.md starts with frontmatter that needs a name and a description.
Required fields: name and description
- Extra files in the skill folder are read only when needed.
Claude accesses these files only when referenced.
- A bundled script runs, and only its output enters the context, not its code.
Scripts run through bash, and only their output enters context.
- Files a task doesn't need stay on disk and cost zero tokens.
The rest stay on the filesystem and cost zero tokens.
- The description is what the model matches the request against, so it must say what the skill does and when to use it.
The description is what Claude matches your request against when determining whether to trigger the Skill, so it must say both what the Skill does and when to use it.
- Claude Code skills live in ~/.claude/skills/ or a project's .claude/skills/.
place them in ~/.claude/skills/ (personal) or .claude/skills/ (project)
- Treat installing a skill like installing software.
Treat like installing software
- Skills that fetch from external URLs are risky: fetched content can carry malicious instructions.
Skills that fetch data from external URLs pose particular risk, as fetched content might contain malicious instructions.
- SKILL.md starts with frontmatter that needs a name and a description.
agentskills.io/specification
- That metadata is about 100 tokens per skill.
Metadata (~100 tokens): The name and description fields are loaded at startup for all skills
- The SKILL.md body is recommended to stay under 5,000 tokens.
Instructions (< 5000 tokens recommended): The full SKILL.md body is loaded when the skill is activated
- A description can be at most 1,024 characters.
Max 1024 characters. Non-empty.
- A skill name is at most 64 characters: lowercase letters, numbers and hyphens.
Max 64 characters. Lowercase letters, numbers, and hyphens only.
- That metadata is about 100 tokens per skill.
docs.claude.com/…/best-practices
- Write the description in third person; it is injected into the system prompt.
The description is injected into the system prompt, and inconsistent point-of-view can cause discovery problems.
- Vague descriptions like 'Helps with documents' are to be avoided.
Avoid vague descriptions such as these
- Only add context the model doesn't already have; every paragraph must justify its token cost.
Does this paragraph justify its token cost?
- Keep the SKILL.md body under 500 lines.
Keep the SKILL.md body under 500 lines for optimal performance.
- Keep references one level deep from SKILL.md.
Keep references one level deep from SKILL.md
- Build evaluations before writing extensive skill documentation.
Create evaluations BEFORE writing extensive documentation.
- Run the model on representative tasks without the skill first, then build three test scenarios.
Build three scenarios that test these gaps.
- The model picks from possibly 100+ skills using the descriptions.
Claude uses it to choose the right Skill from potentially 100+ available Skills.
- Use one term consistently throughout a skill.
Choose one term and use it throughout the Skill
- Write the description in third person; it is injected into the system prompt.
code.claude.com/…/skills
- With many skills, Claude Code drops some descriptions to fit a character budget, least-used skills first.
When the listing overflows, Claude Code drops descriptions starting with the skills you invoke least, so the skills you use most keep their full text.
- Make a skill when you keep pasting the same instructions or procedure; a skill's body loads only when used.
Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat
- Long reference material in a skill costs almost nothing until it is needed.
so long reference material costs almost nothing until you need it
- A skill can be set to run only when you invoke it: disable-model-invocation: true.
Add disable-model-invocation: true to prevent Claude from triggering it automatically.
- Claude Code's skill listing budget scales at 1% of the model's context window.
The budget scales at 1% of the model’s context window.
- With many skills, Claude Code drops some descriptions to fit a character budget, least-used skills first.
developers.openai.com/…/skills
- Codex shortens skill descriptions first when many skills are installed.
If many skills are installed, Codex shortens skill descriptions first.
- OpenAI's Codex and ChatGPT skills build on the open agent skills standard.
Skills build on the open agent skills standard
- Codex's skill list uses at most 2% of the context window by default.
By default, this list uses at most 2% of the model’s context window
- Codex shortens skill descriptions first when many skills are installed.
research.trychroma.com/context-rot
- Model performance degrades as input length increases, even on simple tasks.
model performance degrades as input length increases, often in surprising and non-uniform ways
- Chroma's context rot report tested 18 models.
we evaluate 18 LLMs
- Model performance degrades as input length increases, even on simple tasks.
arxiv.org/…/2307.03172
- Models struggle most with information buried in the middle of a long context.
significantly degrades when models must access relevant information in the middle of long contexts
- Models struggle most with information buried in the middle of a long context.
code.claude.com/…/memory
- CLAUDE.md files are read at the start of every session.
Claude reads them at the start of every session.
- Instruction files are context, not enforced configuration; to hard-block an action, use a hook.
Claude treats them as context, not enforced configuration.
- Instructions like 'never delete' are context, not enforcement.
To block an action regardless of what Claude decides, use a PreToolUse hook instead.
- Claude Code's own docs say to add to CLAUDE.md when it makes the same mistake a second time.
Claude makes the same mistake a second time
- Specific, concise instructions are followed more consistently.
The more specific and concise your instructions, the more consistently Claude follows them.
- CLAUDE.md files are read at the start of every session.
docs.claude.com/…/working-with-messages
- The Messages API is stateless: every request sends the whole conversation again.
The Messages API is stateless, which means that you always send the full conversational history to the API.
- Each new chat request carries only what you send; the model keeps no memory between calls.
The Messages API is stateless, which means that you always send the full conversational history to the API.
- The Messages API is stateless: every request sends the whole conversation again.
docs.claude.com/…/pricing
- Prompt caching cuts the price of a repeated prompt.
Instead of reprocessing the same large system prompt, document, or conversation history on every request, the API reads from cache at a fraction of the standard input price.
- Prompt caching cuts the price of a repeated prompt.
docs.claude.com/…/glossary
- Higher temperature gives more varied outputs; lower gives more predictable ones.
Lower temperatures result in more conservative and deterministic outputs that stick to the most probable phrasing and answers.
- Even at temperature 0, outputs are not fully deterministic.
Even with temperature set to 0, the results will not be fully deterministic, and identical inputs might produce different outputs across API calls.
- Higher temperatures lead to more diverse outputs.
Higher temperatures lead to more creative and diverse outputs
- Higher temperature gives more varied outputs; lower gives more predictable ones.
thinkingmachines.ai/…/defeating-nondeterminism-in-llm-inference
- In one test, 1,000 runs of the same prompt at temperature 0 gave 80 different answers.
Surprisingly, we generate 80 unique completions, with the most common of these occuring 78 times.
- A cause: the server batches your request with others, and the result depends on the batch size.
to depend on the batch size of our forward pass
- In one test, 1,000 runs of the same prompt at temperature 0 gave 80 different answers.
developers.openai.com/…/advanced-usage
- OpenAI offers a seed parameter for mostly deterministic outputs; outputs are non-deterministic by default.
Chat Completions are non-deterministic by default
- OpenAI offers a seed parameter for mostly deterministic outputs; outputs are non-deterministic by default.
genai.owasp.org/…/llm062025-excessive-agency
- OWASP calls it excessive agency: damaging actions from unexpected or wrong model output.
Excessive Agency is the vulnerability that enables damaging actions to be performed in response to unexpected, ambiguous or manipulated outputs from an LLM
- A common trigger is plain hallucination from a harmless prompt.
hallucination/confabulation caused by poorly-engineered benign prompts
- OWASP's first fix: give the agent only the tools it needs.
Limit the extensions that LLM agents are allowed to call to only the minimum necessary.
- OWASP example: a document tool that deletes without asking the user is excessive autonomy.
performs deletions without any confirmation from the user
- OWASP calls it excessive agency: damaging actions from unexpected or wrong model output.
code.claude.com/…/permissions
- Claude Code deny rules block a tool, and deny is checked before allow.
Rules are evaluated in order: deny, then ask, then allow.
- A Bash deny rule matches the command text Claude usually writes; it is not a security boundary around the program.
a deny or ask rule covers the invocation Claude usually produces and isn’t a security boundary around the program
- Claude Code deny rules block a tool, and deny is checked before allow.
code.claude.com/…/sandboxing
- Sandboxed commands can write only to the working directory and a temp directory by default.
By default, commands inside the sandbox can write to the working directory, a per-user temp directory
- Sandboxed commands can write only to the working directory and a temp directory by default.
developers.openai.com/…/agent-approvals-security
- Codex in its Auto preset asks before editing files outside the workspace.
Codex asks for approval to edit files outside the workspace or to run commands that require network access.
- Codex in its Auto preset asks before editing files outside the workspace.
developers.openai.com/…/agents-md
- Codex reads AGENTS.md before doing any work.
Codex reads AGENTS.md files before doing any work.
- Codex reads AGENTS.md before doing any work.
agents.md
- AGENTS.md is an open format used by over 60,000 open-source projects.
used by over 60k open-source projects
- AGENTS.md is a README for agents: a predictable place for project instructions.
a dedicated, predictable place to provide the context and instructions to help AI coding agents work on your project
- AGENTS.md is an open format used by over 60,000 open-source projects.
code.claude.com/…/hooks
- A PreToolUse hook runs before a tool call executes and can block it.
PreToolUse Before a tool call executes. Can block it
- A PreToolUse hook runs before a tool call executes and can block it.
Spotted a mistake? Say so in the video's comments. Fixes are listed on corrections.