Glossary/A/agent skill
Agent architecture Also called: Agent Skills, skill, SKILL.md, Claude skill, Claude Code skill

What is an agent skill?

An agent skill is a folder of instructions, with optional scripts and reference files, that an agent loads only when a task calls for it. The folder holds a SKILL.md file whose YAML frontmatter gives a name and a description. The agent keeps every installed skill's name and description in context and reads the rest of SKILL.md when a request matches the description. Bundled scripts run through the agent's shell, so only their output uses tokens.

What is an agent skill?

Product copy often uses "skills" for anything an assistant can do. In code the word is narrower. A skill is a directory in the Agent Skills format, which is published as an open specification at agentskills.io. The directory must contain SKILL.md, a Markdown file that starts with YAML frontmatter, and it may contain scripts/, references/, assets/ or any other files.

The frontmatter has two required fields. name is 1 to 64 characters of lowercase letters, digits and hyphens, cannot start or end with a hyphen or contain two in a row, and must match the parent directory name. description is 1 to 1024 characters and should say what the skill does and when to use it. The spec also defines optional license, compatibility, metadata and an experimental allowed-tools. The Markdown body after the frontmatter has no required format: it holds the steps, examples and edge cases the agent should follow.

How does a skill load into context?

Skills load in three stages, which Anthropic and the spec both call progressive disclosure. At startup the agent puts each skill's name and description into the system prompt, about 100 tokens per skill. When a request matches a description, the agent reads the SKILL.md body from the filesystem; the spec recommends keeping that body under 5,000 tokens and 500 lines. Files the body points to, such as references/STYLE.md, enter context only when the agent reads them, and scripts run through bash so that only their output enters context.

The description decides whether a skill fires. Claude matches your request against it, so "Helps with PDFs" rarely triggers, while a description that names the task and the words a user would type (PDFs, forms, document extraction) does. Because unread files cost nothing, a skill can bundle long reference material, and the spec advises keeping file references one level deep from SKILL.md.

How is a skill different from a prompt, a tool or an MCP server?

  • A system prompt is sent on every turn. A skill's body enters context only after it triggers, so you can install many skills and pay for their bodies only when used.
  • A tool is a function schema the model calls and your code runs. A skill defines no new function. The agent reads it with tools it already has, such as bash and file reads, which is why skills need a filesystem and code execution.
  • An MCP server exposes tools and data over a protocol from a separate process. A skill is a set of files. A skill can describe a workflow that uses tools an MCP server provides.

Where do skills run, and what changes in your code?

In Claude Code a skill is a directory on disk: ~/.claude/skills/<name>/SKILL.md for every project on your machine, or .claude/skills/<name>/SKILL.md for one repository. Claude invokes it when the description matches, and you can run it yourself with /name. Claude Code adds frontmatter fields the spec does not have, such as disable-model-invocation to make a skill manual only and context: fork to run it in a subagent.

On the Claude API you upload custom skills through the /v1/skills endpoints and list them in the request's container.skills array, alongside the code execution tool, with up to 20 skills per request. Anthropic's pre-built skills use the ids pptx, xlsx, docx and pdf. The API container has no network access and cannot install packages at runtime. Custom skills do not sync between Claude Code, the API and claude.ai, so you upload or copy them to each surface separately.

A skill can tell the agent to run code, so a malicious one can misuse tools or leak data. Anthropic's guidance is to use skills only from sources you trust, audit every bundled file before installing one, and treat a skill that fetches external URLs as higher risk.

A skill directory and the API request that loads it

release-notes/
├── SKILL.md
├── references/
│   └── STYLE.md
└── scripts/
    └── collect_prs.py

release-notes/SKILL.md:
---
name: release-notes
description: Drafts release notes from merged pull requests in the house style. Use when the user asks for release notes, a changelog entry or a summary of what shipped.
---

# Release notes

1. Run scripts/collect_prs.py with the previous tag to list merged PRs.
2. Group the PRs under Added, Changed and Fixed.
3. Follow references/STYLE.md for tone and length.

Using a skill uploaded through the Skills API, POST /v1/messages:
{
  "model": "claude-opus-5-5",
  "max_tokens": 4096,
  "container": {
    "skills": [
      {"type": "custom",
       "skill_id": "skill_01AbCdEfGhIjKlMnOpQrStUv",
       "version": "latest"}
    ]
  },
  "tools": [
    {"type": "code_execution_20250825", "name": "code_execution"}
  ],
  "messages": [
    {"role": "user", "content": "Write release notes for v2.4."}
  ]
}

The frontmatter name matches the directory name, and the description says both what the skill does and when to use it, because that is the text Claude matches against. Until the skill triggers, only those two fields are in context. The API request attaches the uploaded skill by skill_id and includes the code_execution tool, which the skill needs to read SKILL.md and run collect_prs.py. The directory layout follows the spec; the skill id is the placeholder from Anthropic's guide.

Common questions

Agent skills: frequently asked

Is an agent skill the same as a tool?

No. A tool is a function with a schema that the model calls and your code runs. A skill is a folder of instructions and files that the agent reads with tools it already has, such as bash. That is why the Claude API requires the code execution tool before it will load skills.

Do installed skills use tokens when they are not used?

A little. Each skill's name and description sit in the system prompt from startup, about 100 tokens per skill in Anthropic's figures. The SKILL.md body loads only when the skill triggers, and other bundled files load only when the agent reads them.

Can I use the same skill in Claude Code and on the API?

Yes, with two catches. Skills do not sync between surfaces, so you upload the folder to the API separately from where it lives on disk for Claude Code. The API and claude.ai accept only the six frontmatter fields in the open spec, and Claude Code-only fields such as context or disable-model-invocation cause a validation error on upload.

Is it safe to install a skill from a public repository?

Treat it like installing software. A skill can direct the agent to run scripts and call tools, so a malicious one could exfiltrate data or act outside its stated purpose. Read SKILL.md and every bundled script first, and be wary of skills that fetch content from external URLs, since that content can change after you audit it.

Sources

Where these facts come from