- A Claude skill is a folder with a
SKILL.mdfile: YAML frontmatter with anameof up to 64 lowercase characters and adescriptionof up to 1,024 characters, Markdown instructions, and optional scripts and reference files. - Progressive disclosure keeps idle skills cheap. Only the name and description load at session start, the body loads when the skill triggers, and a bundled script's source never enters the context window.
- As of November 16, 2026, Anthropic documents skills in claude.ai, Claude Desktop, Cowork, Claude's Microsoft 365 add-ins, Claude Code, the Agent SDK, the Messages API, and Managed Agents (beta). Skills uploaded to the API do not appear on claude.ai.
- The example skill's script, 11 unit tests, and structure checks ran on November 16, 2026 with Python 3.15.1, Node.js 26.12.1, and Claude Code 2.1.318. No model ran, so triggering was tested only against a scripted stand-in.
- Treat a third-party skill like installed software. Its scripts run with your permissions, and in Claude Code its
allowed-toolsfield can pre-approve its own commands.
Claude skills are folders of instructions, scripts, and reference files that Claude loads only when a task calls for them. Each one centers on a SKILL.md file whose frontmatter says what the skill does and when to use it. This guide covers how that loading works, where skills run, and how to build, test, and share a skill that checks PostgreSQL migrations with a bundled Python script. It ends with the review a third-party skill needs before it runs on your machine.
#What are Claude skills
A Claude skill is a directory with a SKILL.md file at its root, plus any scripts, reference documents, and assets that Claude reads or runs when a request matches the skill's description. Anthropic calls them Agent Skills, and the format is published as an open specification, so the same folder can work in other tools that adopt it.
The spec suggests optional scripts/, references/, and assets/ subfolders for code, documents, and templates. SKILL.md holds YAML frontmatter between --- lines, then Markdown instructions in any format. Claude Code accepts more frontmatter fields than the spec, and uploads to claude.ai or the Skills API reject anything outside it.
| Field | Agent Skills spec | Claude Code | claude.ai and Skills API uploads |
|---|---|---|---|
name | Required. 1 to 64 lowercase letters, digits, and single hyphens. Must match the folder name | Optional. Defaults to the folder name, which becomes the /name command | Required. Cannot contain anthropic or claude |
description | Required. 1 to 1,024 characters | Recommended. Cut at 1,536 characters in the skill listing, together with when_to_use | Required. Up to 1,024 characters, no XML tags |
license, compatibility, metadata | Optional. compatibility up to 500 characters | Accepted, not acted on | Accepted |
allowed-tools | Optional, marked experimental | Pre-approves tools for the turn that invokes the skill | Accepted |
14 Claude Code fields, such as disable-model-invocation, context, hooks, and paths | Not in the spec | Supported | Rejected with an Unexpected key(s) error |
Use the Claude Code fields freely if the skill will only live in a repository. If the folder will ever be uploaded, keep to the six spec fields, because the upload fails on any extra key.
#How progressive disclosure loads a skill
Progressive disclosure means a skill loads in stages, so an installed skill costs about 100 tokens until a task needs it. Anthropic's Agent Skills overview describes three levels:
- Metadata: the
nameanddescriptionof every installed skill go into the system prompt at startup. - Instructions: when a request matches a description, Claude reads the
SKILL.mdbody, which Anthropic recommends keeping under 5,000 tokens and 500 lines. - Resources: reference files enter the context only when Claude reads them. Scripts run through bash, and only their output enters the context.
The third level is why scripts beat long instructions for deterministic work.
Claude Code caps the skill listing at 1% of the model's context window, and when it overflows, Claude Code drops descriptions starting with the skills you invoke least. Setting disable-model-invocation: true takes a skill out of the listing, so only you can run it with /name.
An invoked skill's content stays in the conversation, and Claude Code does not re-read the file on later turns. After compaction, it re-attaches the first 5,000 tokens of each invoked skill, up to 25,000 tokens in total, so put the instructions that matter most at the top. The same budgeting applies to the rest of the window, as the guide to context engineering shows.
#Where Claude skills run
Anthropic's docs, read on November 16, 2026, list the surfaces below, and each one gets skills a different way.
| Surface | How a skill gets there | Limits and notes |
|---|---|---|
| claude.ai, Claude Desktop chat, and Cowork | Upload a zip in Customize > Skills, or receive one an organization owner provisions | Needs code execution turned on. Network access depends on admin settings |
| Claude for Excel, PowerPoint, Word, and Outlook | Skills enabled on your Claude account | Claude applies them automatically in the add-in |
| Claude Code: terminal, VS Code, desktop, and cloud sessions | Folders on disk: personal, project, nested, plugin, or managed. Account skills sync into terminal sessions signed in with claude.ai, on v2.1.273 or later | Full network access. Cloud sessions load repository and account skills, not ~/.claude/skills. Anthropic's pre-built document skills are not available |
| Claude Agent SDK | The same folders, loaded through settingSources, and filtered with the skills option | No API to register a skill in code |
| Claude API, Messages | Upload through /v1/skills, then list the skill in container.skills with the code execution tool | Up to 20 skills per request, 30 MB per upload, no network, no package installs. Shared across the workspace |
| Claude Managed Agents | The agent's skills array, or a GitHub repository mounted on the session | Beta, behind the managed-agents-2026-04-01 header |
| Claude Platform on AWS, Google Cloud (Anthropic managed), Microsoft Foundry (hosted on Anthropic) | The Skills API | Foundry lacks the skill version download endpoint |
Anthropic's pre-built pptx, xlsx, docx, and pdf skills work on claude.ai and the API. The Help Center lists skills on the Free, Pro, Max, Ultra, Team, and Enterprise plans, while the platform overview lists custom uploads on the paid plans only, so check Customize > Skills on your own account.
Build and test in Claude Code first. Skills there are plain folders and edits load without a restart, so you can upload a spec-only copy once the skill works.
#Build a Claude skill step by step
The example skill, reviewing-migrations, checks PostgreSQL migration files for five statement shapes that block writes, rewrite tables, or break code that is still running. It is a project skill, so everyone who clones the repository gets it:
.claude/skills/reviewing-migrations/
├── SKILL.md
├── references/
│ └── rules.md
└── scripts/
└── check_migration.py#Write the description first
The description is the only part of the skill in context before it loads. Anthropic's authoring guide asks for third person, what the skill does, and when to use it, and suggests gerund names such as reviewing-migrations. The Agent Skills guide adds that it should describe what the user is trying to do, including requests that never name the domain.
#Write SKILL.md
Save this as .claude/skills/reviewing-migrations/SKILL.md:
---
name: reviewing-migrations
description: Checks PostgreSQL migration files for statements that block writes, rewrite tables, or break code that is still running, and proposes a safer sequence. Use when the user adds, edits, or reviews a SQL migration, or asks whether a schema change is safe to deploy.
allowed-tools: Bash(python3 ${CLAUDE_SKILL_DIR}/scripts/check_migration.py *)
---
# Reviewing PostgreSQL migrations
Run the checker on every migration file in scope before giving an opinion:
```bash
python3 ${CLAUDE_SKILL_DIR}/scripts/check_migration.py db/migrations/0042_orders.sql
```
It prints one finding per line as `file:line: RULE message`, then a summary line.
Exit code 0 means no rule matched, 1 means findings, 2 means a file could not be read.
For each finding:
1. Read that rule's section in [references/rules.md](references/rules.md).
2. Quote the statement and the line number.
3. Give the safe pattern from the rule, rewritten for this table and column.
Then list the order to deploy in: migration steps and application changes.
If the checker reports nothing, name the files you checked and say no rule matched.
Do not call a migration safe in general. The checker knows five rules, and it
cannot see table sizes, traffic, or the migration tool's transaction settings.
PostgreSQL only. For MySQL, SQLite, or other engines, say the checker does not apply.Claude Code replaces ${CLAUDE_SKILL_DIR} with the skill's folder in both the body and the allowed-tools rule, so the rule matches the exact command the body names and the checker runs without a permission prompt. The grant lasts only for the turn that invokes the skill. The last two paragraphs keep a clean checker run from being reported as a safe migration.
#Add the reference file
references/rules.md holds one section per rule with the reason and the safe pattern, taken from the PostgreSQL 18 pages for ALTER TABLE and CREATE INDEX. The first of the five:
## PG001: index built without CONCURRENTLY
A plain `CREATE INDEX` blocks inserts, updates, and deletes on the table until
the build finishes. Reads continue.
Safe pattern: `CREATE INDEX CONCURRENTLY`. It cannot run inside a transaction
block, so turn off the migration tool's wrapping transaction for that file. A
failed concurrent build leaves an INVALID index: drop it and run the build again.The other four cover a NOT NULL column added without a default, a column type change, a foreign key added without NOT VALID, and a dropped or renamed column or table. SKILL.md links to the file directly, which keeps references one level deep as the authoring guide asks.
#Bundle the script
The checker uses only the Python standard library, because the API's container cannot install packages at run time. It skips comments, quoted strings, and dollar-quoted bodies, then matches each statement against the five rules:
#!/usr/bin/env python3
"""Flag PostgreSQL migration statements that block writes, rewrite tables,
or break code that is still running. Standard library only.
Usage: check_migration.py FILE [FILE ...]
Exit codes: 0 no findings, 1 findings, 2 a file could not be read.
"""
import re
import sys
def statements(sql):
"""Yield (line, text) for each statement, skipping comments and quoted text."""
buf, line, start, i, n = [], 1, None, 0, len(sql)
while i < n:
c = sql[i]
if sql.startswith("--", i):
i = sql.find("\n", i)
i = n if i < 0 else i
continue
if sql.startswith("/*", i):
end = sql.find("*/", i + 2)
end = n if end < 0 else end + 2
line += sql.count("\n", i, end)
buf.append(" ")
i = end
continue
dollar = re.match(r"\$[A-Za-z_]*\$", sql[i:]) if c == "$" else None
if c in "'\"" or dollar:
tag = dollar.group(0) if dollar else c
end = sql.find(tag, i + len(tag))
end = n if end < 0 else end + len(tag)
if start is None:
start = line
buf.append(sql[i:end])
line += sql.count("\n", i, end)
i = end
continue
if c == ";":
if start is not None:
yield start, " ".join("".join(buf).split())
buf, start = [], None
else:
if start is None and not c.isspace():
start = line
buf.append(c)
line += c == "\n"
i += 1
if start is not None:
yield start, " ".join("".join(buf).split())
def clauses(text):
"""Split an ALTER TABLE body on commas that sit outside parentheses and quotes."""
parts, depth, quote, cur = [], 0, None, []
for c in text:
if quote:
quote = None if c == quote else quote
elif c in "'\"":
quote = c
elif c == "(":
depth += 1
elif c == ")":
depth -= 1
elif c == "," and depth == 0:
parts.append("".join(cur).strip())
cur = []
continue
cur.append(c)
parts.append("".join(cur).strip())
return parts
ALTER = re.compile(r"^ALTER TABLE (?:IF EXISTS )?(?:ONLY )?(\S+) (.*)$", re.I | re.S)
INDEX = re.compile(r"^CREATE (?:UNIQUE )?INDEX (?!CONCURRENTLY\b).*?\bON (?:ONLY )?([^\s(]+)", re.I)
ADD_COLUMN = re.compile(r"^ADD (?!(?:CONSTRAINT|PRIMARY|FOREIGN|UNIQUE|CHECK|EXCLUDE)\b)(?:COLUMN )?(?:IF NOT EXISTS )?(\S+)", re.I)
TYPE_CHANGE = re.compile(r"^ALTER (?:COLUMN )?(\S+) (?:SET DATA )?TYPE\b", re.I)
DROP_OR_RENAME = re.compile(r"^(?:DROP (?!CONSTRAINT\b)(?:COLUMN )?(?:IF EXISTS )?(\S+)|RENAME (?!CONSTRAINT\b).*)", re.I)
def check(text):
"""Return (rule, message) pairs for one statement."""
found = []
m = INDEX.match(text)
if m:
found.append(("PG001", f"CREATE INDEX on {m.group(1)} without CONCURRENTLY blocks writes until the build finishes"))
if re.match(r"^DROP TABLE\b", text, re.I):
found.append(("PG005", "DROP TABLE breaks any running code that still reads the table"))
m = ALTER.match(text)
if not m:
return found
table = m.group(1)
for part in clauses(m.group(2)):
col = ADD_COLUMN.match(part)
if col and re.search(r"\bNOT NULL\b", part, re.I) and not re.search(r"\bDEFAULT\b", part, re.I):
found.append(("PG002", f"ADD COLUMN {col.group(1)} NOT NULL without DEFAULT fails if {table} has rows"))
typ = TYPE_CHANGE.match(part)
if typ:
found.append(("PG003", f"changing the type of {table}.{typ.group(1)} normally rewrites the table under an ACCESS EXCLUSIVE lock"))
if re.match(r"^ADD\b", part, re.I) and re.search(r"\bFOREIGN KEY\b", part, re.I) and not re.search(r"\bNOT VALID\b", part, re.I):
found.append(("PG004", f"FOREIGN KEY on {table} without NOT VALID scans the table and blocks writes on both tables"))
drop = DROP_OR_RENAME.match(part)
if drop:
what = f"DROP COLUMN {drop.group(1)}" if drop.group(1) else "RENAME"
found.append(("PG005", f"{what} on {table} breaks running code that still uses the old name"))
return found
def main(paths):
if not paths:
print(__doc__.strip().splitlines()[-2], file=sys.stderr)
return 2
total, unreadable = 0, False
for path in paths:
try:
with open(path, encoding="utf-8") as f:
sql = f.read()
except OSError as err:
print(f"{path}: cannot read: {err.strerror}", file=sys.stderr)
unreadable = True
continue
for line, text in statements(sql):
for rule, message in check(text):
print(f"{path}:{line}: {rule} {message}")
total += 1
print(f"{len(paths)} file(s) checked, {total} finding(s)")
if unreadable:
return 2
return 1 if total else 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))Two sample migrations exercise it. 0041_customers_email.sql uses the safe patterns, and 0042_orders.sql breaks all five rules, with decoy mentions in a comment and a string. From the repository root:
python3 .claude/skills/reviewing-migrations/scripts/check_migration.py db/migrations/*.sql
echo "exit: $?"db/migrations/0042_orders.sql:3: PG001 CREATE INDEX on orders without CONCURRENTLY blocks writes until the build finishes
db/migrations/0042_orders.sql:5: PG002 ADD COLUMN status NOT NULL without DEFAULT fails if orders has rows
db/migrations/0042_orders.sql:5: PG003 changing the type of orders.total normally rewrites the table under an ACCESS EXCLUSIVE lock
db/migrations/0042_orders.sql:9: PG004 FOREIGN KEY on orders without NOT VALID scans the table and blocks writes on both tables
db/migrations/0042_orders.sql:13: PG005 DROP COLUMN legacy_flag on orders breaks running code that still uses the old name
2 file(s) checked, 5 finding(s)
exit: 1The checker matches text, so it misses a foreign key declared inline with REFERENCES and cannot see a framework's implicit transaction. The SKILL.md body states those limits.
#Validate the structure and the script
Test the script with unit tests and the folder with two structure checks, because Claude Code's validator accepts skills that an upload rejects. All three ran on November 16, 2026.
Eleven unittest cases in the repository's tests/ folder cover each rule, the safe variants, commas inside numeric(12, 2), comments, quoting, and line numbers. Run Python with -B so no __pycache__ folder lands inside the skill:
python3 -B -m unittest discover -s testsRan 11 tests in 0.001s
OKClaude Code's validator for skill folders, available from v2.1.233, passed the example on 2.1.318 (path shortened):
claude plugin validate .claude/skillsValidating components in: /path/to/repo/.claude/skills
✔ Validation passedIt also passed, with --strict, a broken copy named Reviewing_Migrations with an argument-hint field and <file> in its description. Claude Code accepts all three, and the documented upload rules reject all three. This Node.js script checks the spec and upload rules with the yaml package, version 2.9.1 in this run:
// Check a skill folder against the Agent Skills spec and the upload limits
// that claude.ai and the Skills API enforce. Usage: node check-skill.mjs DIR
import { readFileSync, readdirSync, statSync, existsSync } from "node:fs";
import { basename, join, resolve } from "node:path";
import { parse } from "yaml";
const dir = resolve(process.argv[2] ?? ".");
const problems = [];
const fail = (msg) => problems.push(msg);
const files = (d) => readdirSync(d, { withFileTypes: true }).flatMap((e) =>
e.isDirectory() ? files(join(d, e.name)) : [join(d, e.name)]);
const text = readFileSync(join(dir, "SKILL.md"), "utf8");
const m = text.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
if (!m) throw new Error("SKILL.md must start with --- frontmatter ---");
let fm;
try { fm = parse(m[1]); } catch (e) { console.log(`FAIL YAML: ${e.message.split("\n")[0]}`); process.exit(1); }
if (typeof fm !== "object" || fm === null || Array.isArray(fm)) fm = {};
const body = m[2];
const allowed = ["name", "description", "license", "compatibility", "metadata", "allowed-tools"];
for (const key of Object.keys(fm)) if (!allowed.includes(key)) fail(`field "${key}" is rejected on upload`);
const name = String(fm.name ?? "");
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(name) || name.length > 64) fail(`name "${name}" breaks the spec pattern`);
if (/anthropic|claude/.test(name)) fail(`name "${name}" uses a reserved word`);
if (name !== basename(dir)) fail(`name "${name}" does not match folder "${basename(dir)}"`);
const desc = String(fm.description ?? "");
if (desc.length < 1 || desc.length > 1024) fail(`description is ${desc.length} characters (1 to 1,024)`);
if (/<[^>]+>/.test(desc)) fail("description contains an XML tag");
if (body.split("\n").length > 500) fail("SKILL.md body is over 500 lines");
for (const [, link] of body.matchAll(/\]\(([^)#\s]+)\)/g)) {
if (/^[a-z]+:/.test(link)) continue;
const target = join(dir, link);
if (!existsSync(target)) { fail(`link ${link} points at a missing file`); continue; }
const nested = readFileSync(target, "utf8").match(/\]\(([^)#\s]+\.md)\)/);
if (nested) fail(`${link} links on to ${nested[1]}; keep references one level deep`);
}
const all = files(dir);
if (all.filter((f) => basename(f) === "SKILL.md").length !== 1) fail("found more than one SKILL.md");
const bytes = all.reduce((sum, f) => sum + statSync(f).size, 0);
if (bytes >= 30 * 1024 * 1024) fail(`skill is ${bytes} bytes; uploads must be under 30 MB`);
console.log(`${name}: ${all.length} files, ${bytes} bytes, description ${desc.length} chars, body ${body.split("\n").length} lines`);
for (const p of problems) console.log(` FAIL ${p}`);
console.log(problems.length ? `${problems.length} problem(s)` : "spec and upload checks passed");
process.exit(problems.length ? 1 : 0);On the example, then on the broken copy:
reviewing-migrations: 3 files, 8455 bytes, description 261 chars, body 26 lines
spec and upload checks passed
Reviewing_Migrations: 3 files, 8498 bytes, description 282 chars, body 26 lines
FAIL field "argument-hint" is rejected on upload
FAIL name "Reviewing_Migrations" breaks the spec pattern
FAIL description contains an XML tag
3 problem(s)An unquoted description containing Checks: PostgreSQL also passed claude plugin validate, while yaml 2.9.1 and js-yaml 4.3.2 both rejected it. Quote any description that contains a colon followed by a space.
#Test that the skill triggers and behaves
A skill fails when Claude never loads it, or loads it and does the wrong thing. Claude Code's docs recommend testing both against a baseline: the same prompts in fresh sessions with the skill on and off. Nothing below ran against a model for this article.
Start by hand in a session: type /skills, then run /reviewing-migrations db/migrations/0042_orders.sql. If the frontmatter fails to parse, Claude Code loads the body with empty metadata, so /name works while automatic triggering does not, and claude --debug shows the parse error.
For triggering, the Agent Skills guide to optimizing descriptions recommends about 20 labeled prompts: half that should trigger, and half near-misses that share keywords but need something else. Run each three times and count it as triggering above a 0.5 rate. Three of the ten in evals/trigger_queries.json:
[
{ "query": "our deploy hung for 20 min on the last schema change, look at 0040 and tell me why", "should_trigger": true },
{ "query": "write a SQL query for the top 10 customers by revenue last month", "should_trigger": false },
{ "query": "convert schema.sql from MySQL syntax to SQLite", "should_trigger": false }
]This script runs each prompt through claude -p with stream-json output and looks for a tool call to the Skill tool that names the skill:
#!/usr/bin/env python3
"""Run each labeled prompt through `claude -p` and count Skill tool calls.
Usage: trigger_eval.py SKILL QUERIES.json [RUNS]
Set CLAUDE_BIN to point at another claude binary. Exit 1 if any query fails.
"""
import json
import os
import subprocess
import sys
CLAUDE = os.environ.get("CLAUDE_BIN", "claude")
def triggered(skill, prompt):
cmd = [CLAUDE, "-p", prompt, "--output-format", "stream-json", "--verbose", "--max-turns", "3"]
out = subprocess.run(cmd, capture_output=True, text=True, timeout=600).stdout
for line in out.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
continue
if event.get("type") != "assistant":
continue
for block in event["message"].get("content", []):
if block.get("type") == "tool_use" and block.get("name") == "Skill" \
and block.get("input", {}).get("skill") == skill:
return True
return False
def main(skill, path, runs=3):
cases, failures = json.load(open(path)), 0
for case in cases:
hits = sum(triggered(skill, case["query"]) for _ in range(runs))
rate = hits / runs
ok = (rate > 0.5) == case["should_trigger"]
failures += not ok
expect = "trigger" if case["should_trigger"] else "skip"
print(f"{'pass' if ok else 'FAIL'} {rate:.2f} expect {expect:<7} {case['query'][:60]}")
print(f"{failures} of {len(cases)} queries failed")
return 1 if failures else 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1], sys.argv[2], int(sys.argv[3]) if len(sys.argv) > 3 else 3))The script ran against a scripted fake claude that emits canned stream-json and calls the Skill tool whenever a prompt contains "migration", "schema change", "ALTER TABLE", or "SQL". That keyword rule stands in for an over-broad description, and the near-miss prompts caught it:
pass 1.00 expect trigger our deploy hung for 20 min on the last schema change, look a
FAIL 1.00 expect skip write a SQL query for the top 10 customers by revenue last m
FAIL 1.00 expect skip convert schema.sql from MySQL syntax to SQLite
2 of 10 queries failedAgainst real Claude Code, not run here, the command is python3 evals/trigger_eval.py reviewing-migrations evals/trigger_queries.json. Twenty prompts at three runs each is 60 sessions that count toward your usage. For the baseline, add --settings '{"skillOverrides":{"reviewing-migrations":"off"}}' to the claude command.
Output quality needs assertions, such as "names PG004 at line 9" and "proposes NOT VALID, then VALIDATE CONSTRAINT". The skill-creator plugin automates the paired runs, grading, and description tuning, and plugin skills can use claude plugin eval. Anthropic advises testing on every model you deploy, since Haiku may need more detail than Opus. The LLM evaluation guide covers grading.
#Share Claude Code skills with a team
Share a skill by putting its folder where its users load skills from: a repository, a plugin, managed settings, a claude.ai organization, or an API workspace. Only one path syncs between surfaces. Skills enabled on a claude.ai account download into Claude Code terminal sessions signed in with that account.
- Repository: commit
.claude/skills/<name>/. Claude Code loads project skills from the starting directory and every parent up to the repository root, and nested.claude/skills/folders load once Claude touches files beneath them. - Plugin: place the folder under
skills/next to a.claude-plugin/plugin.jsonmanifest. The skill runs as/plugin-name:skill-name, installs from a marketplace, and loads for testing withclaude --plugin-dir ./my-plugin. The same format installs on claude.ai and in Cowork. - Managed settings: administrators place skills in
.claude/skills/inside the managed settings directory to reach every user on those machines. On a name clash, an enterprise skill wins over a personal one, which wins over a project one. - claude.ai: zip the folder so it sits at the zip root, named to match
name. On Team and Enterprise plans you can share a skill with colleagues or publish it to the organization library, which owners can set to require review, and owners can provision a skill for everyone. - Skills API: upload once per workspace and pin a version in production. Anthropic's enterprise guide warns that a request without
versionruns whatever anyone in the workspace uploaded last.
The example needs one change before upload, which was not run here. ${CLAUDE_SKILL_DIR} is a Claude Code substitution, so an uploaded copy should name the script by its path inside the skill, scripts/check_migration.py, as the spec recommends. Keep the Git copy as the source of truth, because custom skills do not sync between claude.ai and the API.
#Skills vs CLAUDE.md, slash commands, subagents, and MCP servers
Use a skill for procedures and reference material Claude needs only sometimes, and the other extensions for always-on rules, isolation, connections, and enforcement. Claude Code's features overview draws these lines:
| Extension | What loads, and when | Who starts it | Use it for |
|---|---|---|---|
| CLAUDE.md | Full text, every session | Always on | Build commands and rules every task needs. Anthropic suggests under 200 lines |
| Skill | Name and description every turn, body when used | You with /name, or Claude on a description match | Procedures, reference docs, and bundled scripts |
Custom command in .claude/commands/ | Same as a skill, which replaced it | You or Claude | Older files that still work. Convert one when it needs supporting files |
| Subagent | A separate context window that returns a summary | Claude delegates, or you ask | Tasks that read many files. A subagent's skills field preloads full skills, and a skill with context: fork runs inside one |
| MCP server | Tool names at start, schemas on demand | The model, through tool calls | Access to outside systems. See how an MCP server works |
| Hook | Nothing, unless it returns output | Claude Code, on a lifecycle event | Rules that must hold every time, such as blocking edits to .env |
The common pairing is an MCP server for the connection and a skill for the schema and conventions. Rules in a skill or CLAUDE.md are requests to the model, so a rule that must hold every time belongs in a hook.
#Run third-party skills safely
A third-party skill is software. Its scripts run with your user permissions, and its instructions steer what Claude does with every tool it already has. Anthropic's overview says to use skills only from sources you trust and to audit every file, because a malicious skill can direct Claude to run code or send data out.
In Claude Code, a skill can act beyond its text in three ways:
allowed-toolspre-approves tools for the invoking turn, even for a project skill in a-prun in a folder you never trusted.- A
!`command`placeholder runs before Claude sees the skill, and its output replaces it. These commands never prompt. Outside auto mode, a command no rule allows aborts the invocation, but the skill's ownallowed-toolscan pre-approve it unless a deny or ask rule matches. hooksregisters hooks on invocation that run for the rest of the session.
Before you install one, read every file, then search for network calls and the fields above. On the example skill, the first search found nothing and the second found only its allowed-tools line:
grep -rnE 'curl|wget|requests\.|urllib|socket|https?://|base64|subprocess|os\.system|eval\(|exec\(' .claude/skills/reviewing-migrations
grep -nE '^(allowed-tools|disallowed-tools|hooks|context|agent|model|shell):|(^|[[:space:]])!`|^`{3}!' .claude/skills/reviewing-migrations/SKILL.md
find .claude/skills/reviewing-migrations -type f ! -name '*.md'4:allowed-tools: Bash(python3 ${CLAUDE_SKILL_DIR}/scripts/check_migration.py *)
.claude/skills/reviewing-migrations/scripts/check_migration.pyAnthropic's enterprise checklist also asks you to run scripts in a sandbox, confirm they do what the description says, and look for instructions that hide actions from the user or send data out through Claude's replies.
Then limit what a skill can do after it passes:
- Pin the commit you reviewed, because a marketplace with auto-update can change plugin files after your review.
- Set
"disableSkillShellExecution": trueto replace!commands with a placeholder in user, project, plugin, and added-directory skills. Set in managed settings, it cannot be overridden by users. - Deny a skill with a
Skill(name)rule, or hide it withskillOverrides. - In an organization, set
allowManagedPermissionRulesOnlyin managed settings (v2.1.282 or later) so Claude Code ignoresallowed-toolsin project and personal skills. - On Claude Enterprise, turn on the Skill and plugin security scanning setting for claude.ai and Cowork. It does not cover skills uploaded through the Skills API, so API deployments still need the manual review.
From v2.1.228, terminal and VS Code sessions do not run ! commands in skills synced from claude.ai.
#Keep skills working after they ship
A skill that worked at launch can stop triggering as you add others. Anthropic's enterprise guide says each skill's metadata competes for attention in the system prompt, and with too many active skills Claude can miss the right one.
Run /skill-doctor (v2.1.252 or later) to see each skill's context cost and which ones were never invoked, then turn those off. If Claude stops following a skill in a long session, invoke it again, since compaction can keep only the start of its content.
Rerun the trigger set whenever you edit a description or add a skill with overlapping keywords, because a broader new description can take prompts from an old one. The coding agents hub collects related guides.
#Questions
What are Claude skills?
Claude skills are folders that package instructions, scripts, and reference files for one kind of task. Each folder has a SKILL.md file whose name and description tell Claude when the skill applies. Claude reads the full instructions only when a request matches, so you can install many skills without filling the context window. The format is published as the Agent Skills open standard at agentskills.io.
Where do Claude Code skills go?
Put a personal skill in ~/.claude/skills/my-skill/SKILL.md to use it in every project on your machine. Put a project skill in .claude/skills/my-skill/SKILL.md and commit it so everyone on the repository gets it. Plugins carry skills in a skills/ folder, and administrators can deploy skills to every machine through the managed settings directory.
What is the difference between Claude skills and MCP?
An MCP server connects Claude to an outside system and exposes tools, such as querying a database or creating a ticket. A skill carries knowledge and procedure, such as your schema, your query conventions, or a deployment checklist. Anthropic's docs describe them as complementary: the MCP server provides the connection, and a skill teaches Claude how to use it well.
Do Claude skills work with the Claude API?
Yes. Upload a custom skill with the Skills API, then list its skill_id in the container parameter of a Messages request alongside the code execution tool. As of November 16, 2026, a request can include up to 20 skills, an upload must be under 30 MB uncompressed, and skills run in a container with no network access and no runtime package installation.
Which Claude plans include skills?
Anthropic's Help Center lists skills on the Free, Pro, Max, Ultra, Team, and Enterprise plans, with code execution turned on, as of November 16, 2026. Anthropic's platform overview lists custom skill uploads on the paid plans, so check Customize > Skills on your account. Claude Code and the Claude API support custom skills on their own, separate from claude.ai plans.
Are third-party Claude skills safe to install?
Only as safe as the code and instructions inside them. Anthropic advises using skills from sources you trust and auditing every file before use, because a malicious skill can direct Claude to run code or send data out. Read SKILL.md and every script, test the scripts in a sandbox, and check any allowed-tools, hooks, or shell commands the skill declares.
Is a Claude Code skill the same as a slash command?
Nearly. Claude Code merged custom commands into skills, so a skill folder and a file in .claude/commands/ both create a /name command. Skills add supporting files and can load automatically when their description matches your request. Old command files keep working, and when a skill and a command share a name, the skill runs.