Extend agents with skills
--- a/skills.md
+++ b/skills.md
@@ -17,7 +17,7 @@
## Use skills with the Agent SDK
-Set the `skills` option on `query()` to control which skills Claude can invoke in the session. When omitted, discovered skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to let Claude invoke every discovered skill, a list of skill names to allow only those, or `[]` to let Claude invoke none. For example, to let Claude invoke only two named skills:
+Set the `skills` option on `query()` to control which skills Claude can invoke in the main conversation. When omitted, discovered skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to let Claude invoke every discovered skill, a list of skill names to allow only those, or `[]` to let Claude invoke none. For example, to let Claude invoke only two named skills:
Python
@@ -29,7 +29,7 @@
### Set up skills in a session
-When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers skills from the filesystem and invokes them when relevant to the user’s request. The following example enables every discovered skill in a session and pre-approves the tools that skills commonly need. The example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
+When you set `skills`, the SDK adds the skills you enable to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers skills from the filesystem and invokes them when relevant to the user’s request. The following example enables every discovered skill in a session and pre-approves the tools that skills commonly need. The example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
Python
@@ -81,7 +81,7 @@
* **Plugin skills** : `plugin:skill`
* **Name clashes in`additionalDirectories` or `add_dirs`**: a skill in one of those directories gets a [prefixed name](</docs/en/skills#how-a-skill-gets-its-command-name>) when its name clashes with an enterprise, personal, or project skill, or one in a directory added earlier. List it by that name. With a `verify` skill in `../api` and `../web`, added in that order, and no other `verify` skill, list them as `verify` and `web:verify`. Requires Claude Code v2.1.309 or later
-The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
+The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict subagents or dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
## Commands in Agent SDK sessions
--- a/skills.md
+++ b/skills.md
@@ -133,7 +133,10 @@
Send a command by including it in your prompt string, the same way you send regular text. Dispatch doesn’t depend on the `skills` option. Sending `/<name>` runs a user-invocable skill even when your `skills` list omits it. Commands that act on conversation history, such as `/compact`, need prior messages to work with. A `/<name>` that matches neither a command in the session nor a built-in Claude Code command doesn’t fail the query. Claude Code sends the prompt to Claude as an ordinary message, with a note that the command didn’t run, so the query spends a model turn and returns Claude’s reply. Before v2.1.274, a `/<name>` that matched nothing returned `Unknown command: /<name>` as the result without a model turn. A `/<name>` that matches a built-in Claude Code command that isn’t available in the session, such as `/theme`, returns `/theme isn't available in this environment.` as the result without a model turn.
-A command can hit the `maxTurns` / `max_turns` limit like any other prompt, ending the query with an error result instead of `success`. For the error-result contract, see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>). If your command might hit the limit, wrap the loop in a `try`/`catch` in TypeScript or `try`/`except` in Python, as shown in [Single Message Input](</docs/en/agent-sdk/streaming-vs-single-mode#single-message-input>), or set `maxTurns` high enough for the work to complete.
+When a command reaches the `maxTurns` / `max_turns` limit, the query ends with an error result instead of `success`. For the error-result contract, see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>). If your command might hit the limit, do one of these:
+
+ * Set `maxTurns` high enough for the work to complete.
+ * Wrap the `query()` loop in `try`/`catch` in TypeScript or `try`/`except` in Python.
### Compact history with `/compact`
Show diff (250 lines)
--- a/skills.md
+++ b/skills.md
@@ -1,10 +1,6 @@
Agent Skills extend Claude with specialized capabilities that Claude invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. This page also covers commands in Agent SDK sessions. For more information about skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
-##
-
-
-
-How skills work with the Agent SDK
+## How skills work with the Agent SDK
When using the Claude Agent SDK, skills are:
@@ -19,11 +15,7 @@
Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. The project source also covers `<dir>/.claude/skills/` in each directory you pass through `additionalDirectories` (TypeScript) or `add_dirs` (Python), because the SDK passes those directories to Claude Code as [`--add-dir`](</docs/en/skills#skills-from-additional-directories>). If you set `settingSources` explicitly, include `'project'` to keep project and added-directory skills and `'user'` to keep your personal skills, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
-##
-
-
-
-Use skills with the Agent SDK
+## Use skills with the Agent SDK
Set the `skills` option on `query()` to control which skills Claude can invoke in the session. When omitted, discovered skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to let Claude invoke every discovered skill, a list of skill names to allow only those, or `[]` to let Claude invoke none. For example, to let Claude invoke only two named skills:
@@ -35,11 +27,7 @@
const options = { skills: ["pdf", "docx"] };
-###
-
-
-
-Set up skills in a session
+### Set up skills in a session
When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers skills from the filesystem and invokes them when relevant to the user’s request. The following example enables every discovered skill in a session and pre-approves the tools that skills commonly need. The example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
@@ -81,19 +69,11 @@
console.log(message);
}
-###
-
-
-
-Confirm skills loaded
+### Confirm skills loaded
Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your skills loaded before Claude starts working. The array includes the user-invocable skills that you have defined with a `description` or `when_to_use` frontmatter field, along with [bundled skills included with Claude Code](</docs/en/skills#bundled-skills>). The array lists user-invocable skills only. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude, but doesn’t appear in the array. The array lists the same skills whether or not they’re in your `skills` list.
-###
-
-
-
-Allow only specific skills
+### Allow only specific skills
To let Claude invoke only specific skills, pass their names in the `skills` list:
@@ -103,11 +83,7 @@
The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
-##
-
-
-
-Commands in Agent SDK sessions
+## Commands in Agent SDK sessions
This section is the SDK’s command documentation. A command is anything you run by sending `/<name>` in a prompt. Entries on the command surface differ in what backs them:
@@ -118,11 +94,7 @@
By default, both you and Claude can invoke any skill. You can restrict either path through the skill’s [frontmatter](</docs/en/skills#control-who-invokes-a-skill>). For definitions of command and skill, see the glossary’s [Command](</docs/en/glossary#command>) and [Skill](</docs/en/glossary#skill>) entries. See [Commands in Claude Code](</docs/en/commands>) for every built-in and [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
-###
-
-
-
-Discover available commands
+### Discover available commands
You can dispatch commands that work without an interactive terminal through the SDK. The `system/init` message lists the ones available in your session in its `slash_commands` field. Commands that need an interactive terminal, such as `/theme` and `/terminal-setup`, don’t appear in the list. Access the field when your session starts:
@@ -157,21 +129,13 @@
A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter doesn’t appear in this list or in the `skills` array from Confirm skills loaded. Sessions that configure [MCP servers](</docs/en/agent-sdk/mcp>) can also expose [MCP prompts as commands](</docs/en/mcp#use-mcp-prompts-as-commands>).
-###
-
-
-
-Dispatch commands by name
+### Dispatch commands by name
Send a command by including it in your prompt string, the same way you send regular text. Dispatch doesn’t depend on the `skills` option. Sending `/<name>` runs a user-invocable skill even when your `skills` list omits it. Commands that act on conversation history, such as `/compact`, need prior messages to work with. A `/<name>` that matches neither a command in the session nor a built-in Claude Code command doesn’t fail the query. Claude Code sends the prompt to Claude as an ordinary message, with a note that the command didn’t run, so the query spends a model turn and returns Claude’s reply. Before v2.1.274, a `/<name>` that matched nothing returned `Unknown command: /<name>` as the result without a model turn. A `/<name>` that matches a built-in Claude Code command that isn’t available in the session, such as `/theme`, returns `/theme isn't available in this environment.` as the result without a model turn.
A command can hit the `maxTurns` / `max_turns` limit like any other prompt, ending the query with an error result instead of `success`. For the error-result contract, see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>). If your command might hit the limit, wrap the loop in a `try`/`catch` in TypeScript or `try`/`except` in Python, as shown in [Single Message Input](</docs/en/agent-sdk/streaming-vs-single-mode#single-message-input>), or set `maxTurns` high enough for the work to complete.
-###
-
-
-
-Compact history with `/compact`
+### Compact history with `/compact`
The `/compact` command reduces the size of your conversation history by summarizing older messages while preserving important context. Compaction needs an existing conversation with enough prior messages to summarize. This example has a conversation first, then compacts it and reads the `compact_boundary` system message that reports the result:
@@ -248,30 +212,18 @@
A `compact_boundary` message only arrives when compaction ran. When a continued session has messages but nothing `/compact` can summarize, the run still ends with a `success` result rather than an error, and no `compact_boundary` message arrives. The result text then carries the reason, for example `Not enough messages to compact.` when the session holds a prompt but no reply from Claude yet. A fresh one-shot `query()` call starts with empty context, so use this pattern in a session with prior turns, for example in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>) or when resuming a session.
-###
-
-
-
-Reset context with `/clear`
+### Reset context with `/clear`
The `/clear` command resets the conversation to an empty context, so subsequent prompts start with no prior conversation history. The previous conversation remains on disk. You can return to that conversation by passing its session ID to the [`resume` option](</docs/en/agent-sdk/sessions#resume-by-id>). `/clear` is useful in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), where you send multiple prompts over a single connection. For one-shot `query()` calls, each call already starts with empty context, so sending `/clear` has no practical effect. Start a new `query()` instead.
-##
-
-
-
-Create skills
+## Create skills
Create each skill as a directory containing a `SKILL.md` file with YAML frontmatter and Markdown content. The `description` field determines when Claude invokes your skill. **Example directory structure** :
.claude/skills/security-check/
└── SKILL.md
-###
-
-
-
-Choose a discovery level
+### Choose a discovery level
Save skills at either of the two most common [discovery levels](</docs/en/skills#where-skills-live>):
@@ -280,11 +232,7 @@
If you have existing custom command files in `.claude/commands/`, they keep working. A command file at `.claude/commands/deploy.md` creates `/deploy` and works the same way as a skill at `.claude/skills/deploy/SKILL.md` would. If a command file and a skill share a name, see [Resolve skills that share a name](</docs/en/skills#resolve-skills-that-share-a-name>) for which one runs. The SDK loads `.claude/commands/` and `~/.claude/commands/` files from the same two scopes as skills. See [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
-###
-
-
-
-Create and dispatch your first skill
+### Create and dispatch your first skill
To see the full flow, create `.claude/skills/security-check/SKILL.md`:
@@ -339,11 +287,7 @@
Claude Code includes bundled `code-review` and `verify` skills. If you name a `.claude/commands/` file after one of them, for example `.claude/commands/code-review.md`, the file’s command shadows the bundled skill and `slash_commands` lists the name once.
-##
-
-
-
-Pre-approve tools for skills
+## Pre-approve tools for skills
In SDK sessions, you can pre-approve tools for a project or personal skill with the skill’s [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>) frontmatter or with the `allowedTools` option (`allowed_tools` in Python) in your query configuration. If your organization sets [`allowManagedPermissionRulesOnly`](</docs/en/settings-reference#allowmanagedpermissionrulesonly>) in managed settings, Claude Code ignores both. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
@@ -384,17 +328,9 @@
In the stream, the skill invocation appears as a Skill tool use, followed by Read calls on the project files. The run ends with a `success` result whose text carries the findings. The list pre-approves the named tools rather than restricting the others. For the full permission flow, including permission modes and the `canUseTool` callback, see [Permissions](</docs/en/agent-sdk/permissions>).
-##
-
-
-
-Troubleshooting
-
-###
-
-
-
-Skills not found
+## Troubleshooting
+
+### Skills not found
**Check settingSources configuration** : the SDK discovers skills through the `user` and `project` setting sources. If you set `settingSources`/`setting_sources` explicitly and omit those sources, the SDK doesn’t load skills:
@@ -451,19 +387,11 @@
# Check personal skills
ls ~/.claude/skills/*/SKILL.md
-###
-
-
-
-Skill not being used
+### Skill not being used
**Check the`skills` option**: if you passed a `skills` list, confirm the skill’s name is included. When Claude tries to invoke an unlisted skill, the Skill tool returns `Skill <name> is not in this session's skills allowlist`. Add the name to your list, or dispatch the skill directly by sending `/<name>` in a prompt, which works without listing. **Check the description** : ensure it’s specific and includes relevant keywords. See [Agent Skills best practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#writing-effective-descriptions>) for guidance on writing effective descriptions.
-###
-
-
-
-Invalid skill name error
+### Invalid skill name error
When a name in your `skills` list can’t work as an exact skill name, `query()` rejects the list before starting the Claude Code process. Names that trigger the rejection include:
@@ -490,19 +418,11 @@
An empty name reports `Skill names must be non-empty strings`.Before Python Agent SDK 0.2.129, the SDK didn’t run this check.
-###
-
-
-
-Additional troubleshooting
+### Additional troubleshooting
For general skills troubleshooting, such as YAML syntax errors and debugging, see the [Claude Code skills troubleshooting section](</docs/en/skills#troubleshooting>).
-##
-
-
-
-Next steps
+## Next steps
The [Claude Code skills guide](</docs/en/skills>) covers authoring in depth. Its guidance applies to SDK sessions. Start with these sections:
@@ -511,11 +431,7 @@
* [Inject dynamic context](</docs/en/skills#inject-dynamic-context>): `!`command`` lines that run before Claude sees the skill content
* [Choose where skills load](</docs/en/skills#where-skills-live>): every skill location, plugin namespacing, and which skill runs when two share a name
-##
-
-
-
-Related resources
+## Related resources
* [Commands in Claude Code](</docs/en/commands>): the full command surface, including every built-in
* [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): conceptual overview, benefits, and architecture
--- a/skills.md
+++ b/skills.md
@@ -95,7 +95,13 @@
Allow only specific skills
-To let Claude invoke only specific skills, pass their names in the `skills` list. Names match the `name` field in `SKILL.md` or the skill’s directory name. Use `plugin:skill` for plugin-provided skills. The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
+To let Claude invoke only specific skills, pass their names in the `skills` list:
+
+ * **Your own skills** : the skill’s directory name
+ * **Plugin skills** : `plugin:skill`
+ * **Name clashes in`additionalDirectories` or `add_dirs`**: a skill in one of those directories gets a [prefixed name](</docs/en/skills#how-a-skill-gets-its-command-name>) when its name clashes with an enterprise, personal, or project skill, or one in a directory added earlier. List it by that name. With a `verify` skill in `../api` and `../web`, added in that order, and no other `verify` skill, list them as `verify` and `web:verify`. Requires Claude Code v2.1.309 or later
+
+The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
##
--- a/skills.md
+++ b/skills.md
@@ -501,7 +501,7 @@
The [Claude Code skills guide](</docs/en/skills>) covers authoring in depth. Its guidance applies to SDK sessions. Start with these sections:
* [Frontmatter reference](</docs/en/skills#frontmatter-reference>): every supported field
- * [Pass arguments to skills](</docs/en/skills#pass-arguments-to-skills>): `$ARGUMENTS`, `$0`, `$1`, and skill stacking. The [full substitution table](</docs/en/skills#available-string-substitutions>) adds named arguments and the `${CLAUDE_*}` variables
+ * [Pass arguments to skills](</docs/en/skills#pass-arguments-to-skills>): `$ARGUMENTS`, `$0`, and `$1`. The [full substitution table](</docs/en/skills#available-string-substitutions>) adds named arguments and the `${CLAUDE_*}` variables
* [Inject dynamic context](</docs/en/skills#inject-dynamic-context>): `!`command`` lines that run before Claude sees the skill content
* [Choose where skills load](</docs/en/skills#where-skills-live>): every skill location, plugin namespacing, and which skill runs when two share a name
--- a/skills.md
+++ b/skills.md
@@ -1,4 +1,4 @@
-Agent Skills extend Claude with specialized capabilities that Claude invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. This page also covers commands in Agent SDK sessions. For comprehensive information about skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
+Agent Skills extend Claude with specialized capabilities that Claude invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. This page also covers commands in Agent SDK sessions. For more information about skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
##
--- a/skills.md
+++ b/skills.md
@@ -240,7 +240,7 @@
asyncio.run(main())
-A `compact_boundary` message only arrives when compaction ran. With nothing to summarize, `/compact` reports the reason instead of raising. The run still ends with a `success` result and no `compact_boundary` message, and the result text carries the reason, for example `Not enough messages to compact.` after a single short exchange. A fresh one-shot `query()` call starts with empty context, so use this pattern in a session with prior turns, for example in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>) or when resuming a session.
+A `compact_boundary` message only arrives when compaction ran. When a continued session has messages but nothing `/compact` can summarize, the run still ends with a `success` result rather than an error, and no `compact_boundary` message arrives. The result text then carries the reason, for example `Not enough messages to compact.` when the session holds a prompt but no reply from Claude yet. A fresh one-shot `query()` call starts with empty context, so use this pattern in a session with prior turns, for example in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>) or when resuming a session.
###
@@ -339,7 +339,7 @@
Pre-approve tools for skills
-For project and personal skills, Claude Code applies the [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>) frontmatter field in SDK sessions. You can also pre-approve tools for these skills through the `allowedTools` option (`allowed_tools` in Python) in your query configuration. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
+In SDK sessions, you can pre-approve tools for a project or personal skill with the skill’s [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>) frontmatter or with the `allowedTools` option (`allowed_tools` in Python) in your query configuration. If your organization sets [`allowManagedPermissionRulesOnly`](</docs/en/settings-reference#allowmanagedpermissionrulesonly>) in managed settings, Claude Code ignores both. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
Skills run with the session’s tools. The example below pre-approves `Read`, `Grep`, and `Glob` with `allowedTools` (`allowed_tools` in Python), so Claude can inspect files while running the security-check skill without stopping for approval:
--- a/skills.md
+++ b/skills.md
@@ -157,7 +157,7 @@
Dispatch commands by name
-Send a command by including it in your prompt string, the same way you send regular text. Dispatch doesn’t depend on the `skills` option. Sending `/<name>` runs a user-invocable skill even when your `skills` list omits it. Commands that act on conversation history, such as `/compact`, need prior messages to work with.
+Send a command by including it in your prompt string, the same way you send regular text. Dispatch doesn’t depend on the `skills` option. Sending `/<name>` runs a user-invocable skill even when your `skills` list omits it. Commands that act on conversation history, such as `/compact`, need prior messages to work with. A `/<name>` that matches neither a command in the session nor a built-in Claude Code command doesn’t fail the query. Claude Code sends the prompt to Claude as an ordinary message, with a note that the command didn’t run, so the query spends a model turn and returns Claude’s reply. Before v2.1.274, a `/<name>` that matched nothing returned `Unknown command: /<name>` as the result without a model turn. A `/<name>` that matches a built-in Claude Code command that isn’t available in the session, such as `/theme`, returns `/theme isn't available in this environment.` as the result without a model turn.
A command can hit the `maxTurns` / `max_turns` limit like any other prompt, ending the query with an error result instead of `success`. For the error-result contract, see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>). If your command might hit the limit, wrap the loop in a `try`/`catch` in TypeScript or `try`/`except` in Python, as shown in [Single Message Input](</docs/en/agent-sdk/streaming-vs-single-mode#single-message-input>), or set `maxTurns` high enough for the work to complete.
--- a/skills.md
+++ b/skills.md
@@ -110,7 +110,7 @@
* **Your skills** : prompt artifacts that you author, each a directory holding a `SKILL.md` file. A user-invocable skill’s name joins the surface automatically, so dispatching your own `/security-check` and running a built-in work the same way
* **Custom command files** : an older artifact form with the same behavior, flat Markdown files in `.claude/commands/` whose filenames become command names. Skills are their recommended successor
-By default, both you and Claude can invoke any skill. You can restrict either path through the skill’s [frontmatter](</docs/en/skills#control-who-invokes-a-skill>). For a definition of the two terms, see the glossary’s [Command](</docs/en/glossary#command>) and [Skill](</docs/en/glossary#skill>) entries. See [Commands in Claude Code](</docs/en/commands>) for every built-in and [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
+By default, both you and Claude can invoke any skill. You can restrict either path through the skill’s [frontmatter](</docs/en/skills#control-who-invokes-a-skill>). For definitions of command and skill, see the glossary’s [Command](</docs/en/glossary#command>) and [Skill](</docs/en/glossary#skill>) entries. See [Commands in Claude Code](</docs/en/commands>) for every built-in and [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
###
--- a/skills.md
+++ b/skills.md
@@ -87,7 +87,7 @@
Confirm skills loaded
-Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your skills loaded before Claude starts working. The array includes the user-invocable skills that you have defined, along with [bundled skills included with Claude Code](</docs/en/skills#bundled-skills>). The array lists user-invocable skills only. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude, but doesn’t appear in the array. The array reflects what the session discovered and lists the same skills whether or not they’re in your `skills` list.
+Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your skills loaded before Claude starts working. The array includes the user-invocable skills that you have defined with a `description` or `when_to_use` frontmatter field, along with [bundled skills included with Claude Code](</docs/en/skills#bundled-skills>). The array lists user-invocable skills only. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude, but doesn’t appear in the array. The array lists the same skills whether or not they’re in your `skills` list.
###
@@ -149,7 +149,7 @@
Available commands: ["clear", "compact", "context", "usage", "code-review", "verify", "security-check", ...]
-Your user-invocable skills appear in both this list and the `skills` array from Confirm skills loaded. The `slash_commands` list adds the rest of the commands available in your session. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter doesn’t appear in either. Sessions that configure [MCP servers](</docs/en/agent-sdk/mcp>) can also expose [MCP prompts as commands](</docs/en/mcp#use-mcp-prompts-as-commands>).
+A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter doesn’t appear in this list or in the `skills` array from Confirm skills loaded. Sessions that configure [MCP servers](</docs/en/agent-sdk/mcp>) can also expose [MCP prompts as commands](</docs/en/mcp#use-mcp-prompts-as-commands>).
###
--- a/skills.md
+++ b/skills.md
@@ -272,7 +272,7 @@
* **Project skills** : `.claude/skills/`, available only in the current project
* **Personal skills** : `~/.claude/skills/`, available across all your projects
-If you have existing custom command files in `.claude/commands/`, they keep working. A command file at `.claude/commands/deploy.md` creates `/deploy` and works the same way as a skill at `.claude/skills/deploy/SKILL.md` would. If a command file and a skill share a name, see [Where skills live](</docs/en/skills#where-skills-live>) for which one runs. The SDK loads `.claude/commands/` and `~/.claude/commands/` files from the same two scopes as skills. See [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
+If you have existing custom command files in `.claude/commands/`, they keep working. A command file at `.claude/commands/deploy.md` creates `/deploy` and works the same way as a skill at `.claude/skills/deploy/SKILL.md` would. If a command file and a skill share a name, see [Resolve skills that share a name](</docs/en/skills#resolve-skills-that-share-a-name>) for which one runs. The SDK loads `.claude/commands/` and `~/.claude/commands/` files from the same two scopes as skills. See [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
###
@@ -503,7 +503,7 @@
* [Frontmatter reference](</docs/en/skills#frontmatter-reference>): every supported field
* [Pass arguments to skills](</docs/en/skills#pass-arguments-to-skills>): `$ARGUMENTS`, `$0`, `$1`, and skill stacking. The [full substitution table](</docs/en/skills#available-string-substitutions>) adds named arguments and the `${CLAUDE_*}` variables
* [Inject dynamic context](</docs/en/skills#inject-dynamic-context>): `!`command`` lines that run before Claude sees the skill content
- * [Where skills live](</docs/en/skills#where-skills-live>): all discovery levels, plugin namespacing, and what happens when a skill and a command file share a name
+ * [Choose where skills load](</docs/en/skills#where-skills-live>): every skill location, plugin namespacing, and which skill runs when two share a name
##
--- a/skills.md
+++ b/skills.md
@@ -339,7 +339,7 @@
Pre-approve tools for skills
-For project and personal skills, the `allowed-tools` frontmatter field applies only when you use the Claude Code CLI directly. In SDK sessions, manage tool approval for these skills through the `allowedTools` option (`allowed_tools` in Python) in your query configuration. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
+For project and personal skills, Claude Code applies the [`allowed-tools`](</docs/en/skills#pre-approve-tools-for-a-skill>) frontmatter field in SDK sessions. You can also pre-approve tools for these skills through the `allowedTools` option (`allowed_tools` in Python) in your query configuration. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
Skills run with the session’s tools. The example below pre-approves `Read`, `Grep`, and `Glob` with `allowedTools` (`allowed_tools` in Python), so Claude can inspect files while running the security-check skill without stopping for approval:
@@ -476,13 +476,13 @@
Invalid skill name "docs:*": wildcard-suffix names are not allowed; list each skill by its exact name.
-An empty name reports `Skill names must be non-empty strings.`
+An empty name reports `Skill names must be non-empty strings.`Before TypeScript Agent SDK 0.3.221, the SDK didn’t run this check.
The Python SDK raises `ValueError` stating the rule the entry broke. For example, `skills=["docs:*"]` raises:
ValueError: Invalid skill name 'docs:*': wildcard-suffix names are not allowed; list each skill by its exact name.
-An empty name reports `Skill names must be non-empty strings`.
+An empty name reports `Skill names must be non-empty strings`.Before Python Agent SDK 0.2.129, the SDK didn’t run this check.
###
@@ -498,7 +498,7 @@
Next steps
-The [Claude Code skills guide](</docs/en/skills>) covers authoring in depth. Its guidance applies to SDK sessions, with one exception: for project and personal skills, Pre-approve tools for skills replaces the `allowed-tools` frontmatter field with the `allowedTools` option. Start with these sections:
+The [Claude Code skills guide](</docs/en/skills>) covers authoring in depth. Its guidance applies to SDK sessions. Start with these sections:
* [Frontmatter reference](</docs/en/skills#frontmatter-reference>): every supported field
* [Pass arguments to skills](</docs/en/skills#pass-arguments-to-skills>): `$ARGUMENTS`, `$0`, `$1`, and skill stacking. The [full substitution table](</docs/en/skills#available-string-substitutions>) adds named arguments and the `${CLAUDE_*}` variables
--- a/skills.md
+++ b/skills.md
@@ -17,7 +17,7 @@
Unlike subagents, which you can define in the [`agents` option](</docs/en/agent-sdk/subagents#programmatic-definition-recommended>), you create skills as files on disk. The SDK doesn’t provide a programmatic API for registering them.
-Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. If you set `settingSources` explicitly, include `'user'` or `'project'` to keep skill discovery, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
+Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. The project source also covers `<dir>/.claude/skills/` in each directory you pass through `additionalDirectories` (TypeScript) or `add_dirs` (Python), because the SDK passes those directories to Claude Code as [`--add-dir`](</docs/en/skills#skills-from-additional-directories>). If you set `settingSources` explicitly, include `'project'` to keep project and added-directory skills and `'user'` to keep your personal skills, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
##
Show diff (675 lines)
--- a/skills.md
+++ b/skills.md
@@ -1,26 +1,21 @@
-##
-
-
-
-Overview
-
-Agent Skills extend Claude with specialized capabilities that Claude autonomously invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. For comprehensive information about Skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
-
-##
-
-
-
-How Skills Work with the SDK
-
-When using the Claude Agent SDK, Skills are:
-
- 1. **Defined as filesystem artifacts** : you create each Skill as a `SKILL.md` file in its own directory, such as `.claude/skills/<name>/SKILL.md`
- 2. **Loaded from filesystem** : the SDK loads Skills from the filesystem locations governed by `settingSources` (TypeScript) or `setting_sources` (Python)
- 3. **Automatically discovered** : once filesystem settings load, the SDK discovers Skill metadata at startup from user and project directories, and loads the full content when Claude invokes the Skill
- 4. **Model-invoked** : Claude autonomously chooses when to use them based on context
- 5. **Filtered via the`skills` option**: discovered skills are enabled by default. Pass a list of skill names, `"all"`, or `[]` to control which are available in the session
-
-Unlike subagents (which can be defined programmatically), Skills must be created as filesystem artifacts. The SDK does not provide a programmatic API for registering Skills.
+Agent Skills extend Claude with specialized capabilities that Claude invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. This page also covers commands in Agent SDK sessions. For comprehensive information about skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
+
+##
+
+
+
+How skills work with the Agent SDK
+
+When using the Claude Agent SDK, skills are:
+
+ * **Defined as filesystem artifacts** : you create each skill as a `SKILL.md` file in its own directory, such as `.claude/skills/<name>/SKILL.md`
+ * **Loaded from filesystem** : the SDK loads skills from the filesystem locations governed by `settingSources` (TypeScript) or `setting_sources` (Python)
+ * **Automatically discovered** : once filesystem settings load, the SDK discovers skill metadata at startup from user and project directories, and loads the full content when Claude invokes the skill
+ * **Model-invoked** : Claude autonomously chooses when to use them based on context
+ * **User-invoked** : you dispatch a skill directly by sending `/<name>` in a prompt. See Commands in Agent SDK sessions
+ * **Scoped via the`skills` option**: discovered skills are enabled by default. Pass a list of skill names, `"all"`, or `[]` to control which skills Claude can invoke
+
+Unlike subagents, which you can define in the [`agents` option](</docs/en/agent-sdk/subagents#programmatic-definition-recommended>), you create skills as files on disk. The SDK doesn’t provide a programmatic API for registering them.
Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. If you set `settingSources` explicitly, include `'user'` or `'project'` to keep skill discovery, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
@@ -28,9 +23,25 @@
-Using Skills with the SDK
-
-Set the `skills` option on `query()` to control which Skills are available to the session. When omitted, discovered Skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to enable every discovered Skill, a list of Skill names to enable only those, or `[]` to disable all. When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers Skills from the filesystem and invokes them when relevant to the user’s request. The following example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
+Use skills with the Agent SDK
+
+Set the `skills` option on `query()` to control which skills Claude can invoke in the session. When omitted, discovered skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to let Claude invoke every discovered skill, a list of skill names to allow only those, or `[]` to let Claude invoke none. For example, to let Claude invoke only two named skills:
+
+Python
+
+TypeScript
+
+ options = ClaudeAgentOptions(skills=["pdf", "docx"])
+
+ const options = { skills: ["pdf", "docx"] };
+
+###
+
+
+
+Set up skills in a session
+
+When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers skills from the filesystem and invokes them when relevant to the user’s request. The following example enables every discovered skill in a session and pre-approves the tools that skills commonly need. The example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
Python
@@ -44,8 +55,8 @@
async def main():
options = ClaudeAgentOptions(
cwd=os.getcwd(), # .claude/skills/ here or in a parent directory
- setting_sources=["user", "project"], # Load Skills from filesystem
- skills="all", # Enable every discovered Skill
+ setting_sources=["user", "project"], # Load skills from filesystem
+ skills="all", # Let Claude invoke every discovered skill
allowed_tools=["Read", "Write", "Bash"],
)
@@ -62,159 +73,310 @@
prompt: "Help me process this PDF document",
options: {
cwd: process.cwd(), // .claude/skills/ here or in a parent directory
- settingSources: ["user", "project"], // Load Skills from filesystem
- skills: "all", // Enable every discovered Skill
+ settingSources: ["user", "project"], // Load skills from filesystem
+ skills: "all", // Let Claude invoke every discovered skill
allowedTools: ["Read", "Write", "Bash"]
}
})) {
console.log(message);
}
-Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your Skills loaded before Claude starts working. The array lists user-invocable Skills only. A Skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude but doesn’t appear in the array. To enable only specific Skills, pass their names. Names match the `name` field in `SKILL.md` or the Skill’s directory name. Use `plugin:skill` for plugin-provided Skills.
-
-Import statements from the first example are assumed in the following code snippets.
-
-Python
-
-TypeScript
-
- options = ClaudeAgentOptions(skills=["pdf", "docx"])
-
- const options = { skills: ["pdf", "docx"] };
-
-The list takes exact Skill names only. In the TypeScript SDK, `query()` throws before starting the Claude Code process when a name can’t work as an exact Skill name. In the Python SDK, `query()` raises `ValueError` in the same cases, for example:
-
- * An empty name
- * A name containing parentheses, commas, or control characters
- * A name padded with whitespace
- * A wildcard form such as a bare `*` or a `:*` suffix
-
-To enable every discovered Skill, pass `skills: "all"` rather than a wildcard. The `skills` option is a context filter, not a sandbox. Unlisted Skills are hidden from the model and rejected by the Skill tool, but their files remain on disk and are reachable through Read and Bash.
-
-##
-
-
-
-Creating Skills
-
-Create each Skill as a directory containing a `SKILL.md` file with YAML frontmatter and Markdown content. The `description` field determines when Claude invokes your Skill. **Example directory structure** :
-
- .claude/skills/processing-pdfs/
+###
+
+
+
+Confirm skills loaded
+
+Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your skills loaded before Claude starts working. The array includes the user-invocable skills that you have defined, along with [bundled skills included with Claude Code](</docs/en/skills#bundled-skills>). The array lists user-invocable skills only. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude, but doesn’t appear in the array. The array reflects what the session discovered and lists the same skills whether or not they’re in your `skills` list.
+
+###
+
+
+
+Allow only specific skills
+
+To let Claude invoke only specific skills, pass their names in the `skills` list. Names match the `name` field in `SKILL.md` or the skill’s directory name. Use `plugin:skill` for plugin-provided skills. The list takes exact skill names only. If an entry can’t work as an exact name, `query()` rejects the list before the session starts. See Invalid skill name error for the name rules and the error each SDK raises. The model doesn’t see unlisted skills and the Skill tool rejects them, while their files remain on disk and stay reachable through Read and Bash. Restricting the list doesn’t restrict dispatch by name. To let Claude invoke every discovered skill, pass `skills: "all"` rather than a wildcard.
+
+##
+
+
+
+Commands in Agent SDK sessions
+
+This section is the SDK’s command documentation. A command is anything you run by sending `/<name>` in a prompt. Entries on the command surface differ in what backs them:
+
+ * **Built-in commands** : execute logic coded into the Claude Code process the SDK runs, for example `/compact`
+ * **Bundled skills** : prompt artifacts included with Claude Code, for example `/code-review`
+ * **Your skills** : prompt artifacts that you author, each a directory holding a `SKILL.md` file. A user-invocable skill’s name joins the surface automatically, so dispatching your own `/security-check` and running a built-in work the same way
+ * **Custom command files** : an older artifact form with the same behavior, flat Markdown files in `.claude/commands/` whose filenames become command names. Skills are their recommended successor
+
+By default, both you and Claude can invoke any skill. You can restrict either path through the skill’s [frontmatter](</docs/en/skills#control-who-invokes-a-skill>). For a definition of the two terms, see the glossary’s [Command](</docs/en/glossary#command>) and [Skill](</docs/en/glossary#skill>) entries. See [Commands in Claude Code](</docs/en/commands>) for every built-in and [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
+
+###
+
+
+
+Discover available commands
+
+You can dispatch commands that work without an interactive terminal through the SDK. The `system/init` message lists the ones available in your session in its `slash_commands` field. Commands that need an interactive terminal, such as `/theme` and `/terminal-setup`, don’t appear in the list. Access the field when your session starts:
+
+TypeScript
+
+Python
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ for await (const message of query({
+ prompt: "Hello Claude",
+ options: { maxTurns: 1 }
+ })) {
+ if (message.type === "system" && message.subtype === "init") {
+ console.log("Available commands:", message.slash_commands);
+ }
+ }
+
+ import asyncio
+ from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage
+
+ async def main():
+ async for message in query(prompt="Hello Claude", options=ClaudeAgentOptions(max_turns=1)):
+ if isinstance(message, SystemMessage) and message.subtype == "init":
+ print("Available commands:", message.data["slash_commands"])
+
+ asyncio.run(main())
+
+The printed list mixes built-in commands, bundled skills, your user-invocable skills, and `.claude/commands/` files:
+
+ Available commands: ["clear", "compact", "context", "usage", "code-review", "verify", "security-check", ...]
+
+Your user-invocable skills appear in both this list and the `skills` array from Confirm skills loaded. The `slash_commands` list adds the rest of the commands available in your session. A skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter doesn’t appear in either. Sessions that configure [MCP servers](</docs/en/agent-sdk/mcp>) can also expose [MCP prompts as commands](</docs/en/mcp#use-mcp-prompts-as-commands>).
+
+###
+
+
+
+Dispatch commands by name
+
+Send a command by including it in your prompt string, the same way you send regular text. Dispatch doesn’t depend on the `skills` option. Sending `/<name>` runs a user-invocable skill even when your `skills` list omits it. Commands that act on conversation history, such as `/compact`, need prior messages to work with.
+
+A command can hit the `maxTurns` / `max_turns` limit like any other prompt, ending the query with an error result instead of `success`. For the error-result contract, see [Handle the result](</docs/en/agent-sdk/agent-loop#handle-the-result>). If your command might hit the limit, wrap the loop in a `try`/`catch` in TypeScript or `try`/`except` in Python, as shown in [Single Message Input](</docs/en/agent-sdk/streaming-vs-single-mode#single-message-input>), or set `maxTurns` high enough for the work to complete.
+
+###
+
+
+
+Compact history with `/compact`
+
+The `/compact` command reduces the size of your conversation history by summarizing older messages while preserving important context. Compaction needs an existing conversation with enough prior messages to summarize. This example has a conversation first, then compacts it and reads the `compact_boundary` system message that reports the result:
+
+TypeScript
+
+Python
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ // Compaction needs existing history, so have a conversation first
+ try {
+ for await (const message of query({
+ prompt: "Explain what this project does",
+ options: { maxTurns: 2 }
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+ } catch (error) {
+ // A single-shot query() throws after yielding an error result,
+ // so the follow-up query below still runs.
+ console.error(`Session ended with an error: ${error}`);
+ }
+
+ // Compact the same conversation
+ for await (const message of query({
+ prompt: "/compact",
+ options: { continue: true, maxTurns: 1 }
+ })) {
+ if (message.type === "system" && message.subtype === "compact_boundary") {
+ console.log("Compaction completed");
+ console.log("Pre-compaction tokens:", message.compact_metadata.pre_tokens);
+ console.log("Trigger:", message.compact_metadata.trigger);
+ // Example output:
+ // Compaction completed
+ // Pre-compaction tokens: 1842
+ // Trigger: manual
+ }
+ }
+
+ import asyncio
+ from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage, SystemMessage
+
+ async def main():
+ # Compaction needs existing history, so have a conversation first
+ try:
+ async for message in query(
+ prompt="Explain what this project does",
+ options=ClaudeAgentOptions(max_turns=2),
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+ except Exception as error:
+ # A single-shot query() raises after yielding an error result,
+ # so the follow-up query below still runs.
+ print(f"Session ended with an error: {error}")
+
+ # Compact the same conversation
+ async for message in query(
+ prompt="/compact",
+ options=ClaudeAgentOptions(continue_conversation=True, max_turns=1),
+ ):
+ if isinstance(message, SystemMessage) and message.subtype == "compact_boundary":
+ print("Compaction completed")
+ print("Pre-compaction tokens:", message.data["compact_metadata"]["pre_tokens"])
+ print("Trigger:", message.data["compact_metadata"]["trigger"])
+ # Example output:
+ # Compaction completed
+ # Pre-compaction tokens: 1842
+ # Trigger: manual
+
+ asyncio.run(main())
+
+A `compact_boundary` message only arrives when compaction ran. With nothing to summarize, `/compact` reports the reason instead of raising. The run still ends with a `success` result and no `compact_boundary` message, and the result text carries the reason, for example `Not enough messages to compact.` after a single short exchange. A fresh one-shot `query()` call starts with empty context, so use this pattern in a session with prior turns, for example in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>) or when resuming a session.
+
+###
+
+
+
+Reset context with `/clear`
+
+The `/clear` command resets the conversation to an empty context, so subsequent prompts start with no prior conversation history. The previous conversation remains on disk. You can return to that conversation by passing its session ID to the [`resume` option](</docs/en/agent-sdk/sessions#resume-by-id>). `/clear` is useful in [streaming input mode](</docs/en/agent-sdk/streaming-vs-single-mode>), where you send multiple prompts over a single connection. For one-shot `query()` calls, each call already starts with empty context, so sending `/clear` has no practical effect. Start a new `query()` instead.
+
+##
+
+
+
+Create skills
+
+Create each skill as a directory containing a `SKILL.md` file with YAML frontmatter and Markdown content. The `description` field determines when Claude invokes your skill. **Example directory structure** :
+
+ .claude/skills/security-check/
└── SKILL.md
-For complete guidance on creating Skills, including SKILL.md structure, multi-file Skills, and examples, see:
-
- * [Agent Skills in Claude Code](</docs/en/skills>): complete guide with examples
- * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines and naming conventions
-
-##
-
-
-
-Tool Restrictions
-
-The `allowed-tools` frontmatter field in SKILL.md is only supported when using Claude Code CLI directly. **It does not apply when using Skills through the SDK**.When using the SDK, control tool access through the main `allowedTools` option in your query configuration.
-
-To control tool access for Skills in SDK applications, use `allowedTools` to pre-approve specific tools. Without a `canUseTool` callback, anything not in the list is denied:
-
-Python
-
-TypeScript
+###
+
+
+
+Choose a discovery level
+
+Save skills at either of the two most common [discovery levels](</docs/en/skills#where-skills-live>):
+
+ * **Project skills** : `.claude/skills/`, available only in the current project
+ * **Personal skills** : `~/.claude/skills/`, available across all your projects
+
+If you have existing custom command files in `.claude/commands/`, they keep working. A command file at `.claude/commands/deploy.md` creates `/deploy` and works the same way as a skill at `.claude/skills/deploy/SKILL.md` would. If a command file and a skill share a name, see [Where skills live](</docs/en/skills#where-skills-live>) for which one runs. The SDK loads `.claude/commands/` and `~/.claude/commands/` files from the same two scopes as skills. See [Extend Claude with skills](</docs/en/skills>) for the complete guide to both artifact forms.
+
+###
+
+
+
+Create and dispatch your first skill
+
+To see the full flow, create `.claude/skills/security-check/SKILL.md`:
+
+ ---
+ name: security-check
+ description: Run a security vulnerability scan
+ ---
+
+ Analyze the codebase for security vulnerabilities including:
+ - SQL injection risks
+ - XSS vulnerabilities
+ - Exposed credentials
+ - Insecure configurations
+
+Once the file exists, the skill is available through the SDK. Claude invokes it when a request matches its description, and you can dispatch it directly:
+
+TypeScript
+
+Python
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ for await (const message of query({
+ prompt: "/security-check",
+ options: { maxTurns: 10 }
+ })) {
+ if (message.type === "result" && message.subtype === "success") {
+ console.log(message.result);
+ }
+ }
+
+ import asyncio
+ from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage
+
+ async def main():
+ async for message in query(
+ prompt="/security-check", options=ClaudeAgentOptions(max_turns=10)
+ ):
+ if isinstance(message, ResultMessage) and message.subtype == "success":
+ print(message.result)
+
+ asyncio.run(main())
+
+A successful run ends with a `success` result whose text carries the scan findings. Against a small Express app with seeded issues, the result text begins:
+
+ **Security scan of `app.js` — 4 findings (most severe first):**
+
+ 1. **SQL Injection** (line 8) — `req.query.name` is concatenated directly into the SQL string. Trivially exploitable (`' OR '1'='1`, `'; DROP TABLE users;--`). **Fix:** use parameterized queries, e.g. `db.query("SELECT * FROM users WHERE name = ?", [req.query.name], cb)`.
+ ...
+
+The skill’s name also appears in the init message’s `slash_commands` array.
+
+Claude Code includes bundled `code-review` and `verify` skills. If you name a `.claude/commands/` file after one of them, for example `.claude/commands/code-review.md`, the file’s command shadows the bundled skill and `slash_commands` lists the name once.
+
+##
+
+
+
+Pre-approve tools for skills
+
+For project and personal skills, the `allowed-tools` frontmatter field applies only when you use the Claude Code CLI directly. In SDK sessions, manage tool approval for these skills through the `allowedTools` option (`allowed_tools` in Python) in your query configuration. Skills [synced from claude.ai](</docs/en/skills#how-claude-code-handles-the-frontmatter-of-a-synced-skill>) follow their own frontmatter rules.
+
+Skills run with the session’s tools. The example below pre-approves `Read`, `Grep`, and `Glob` with `allowedTools` (`allowed_tools` in Python), so Claude can inspect files while running the security-check skill without stopping for approval:
+
+Python
+
+TypeScript
+
+ import asyncio
+
+ from claude_agent_sdk import query, ClaudeAgentOptions
options = ClaudeAgentOptions(
- setting_sources=["user", "project"], # Load Skills from filesystem
+ setting_sources=["user", "project"], # Load skills from filesystem
skills="all",
allowed_tools=["Read", "Grep", "Glob"],
- permission_mode="dontAsk", # Deny anything not pre-approved instead of prompting
)
async def main():
- async for message in query(prompt="Analyze the codebase structure", options=options):
+ async for message in query(prompt="Check this project for security issues", options=options):
print(message)
asyncio.run(main())
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
for await (const message of query({
- prompt: "Analyze the codebase structure",
+ prompt: "Check this project for security issues",
options: {
- settingSources: ["user", "project"], // Load Skills from filesystem
+ settingSources: ["user", "project"], // Load skills from filesystem
skills: "all",
- allowedTools: ["Read", "Grep", "Glob"],
- permissionMode: "dontAsk" // Deny anything not pre-approved instead of prompting
+ allowedTools: ["Read", "Grep", "Glob"]
}
})) {
console.log(message);
}
-##
-
-
-
-Discovering Available Skills
-
-To see which Skills are available in your SDK application, ask Claude. The example below sets only the `skills` option and omits `settingSources`/`setting_sources`. When you leave `settingSources`/`setting_sources` unset, the SDK still loads Skills from the user and project sources, so the `skills` option set to `"all"` on its own makes them available to list.
-
-Python
-
-TypeScript
-
- options = ClaudeAgentOptions(skills="all")
-
- async def main():
- async for message in query(prompt="What Skills are available?", options=options):
- print(message)
-
- asyncio.run(main())
-
- for await (const message of query({
- prompt: "What Skills are available?",
- options: {
- skills: "all"
- }
- })) {
- console.log(message);
- }
-
-Claude will list the available Skills based on your current working directory and installed plugins.
-
-##
-
-
-
-Testing Skills
-
-Test Skills by asking questions that match their descriptions:
-
-Python
-
-TypeScript
-
- options = ClaudeAgentOptions(
- cwd=os.getcwd(),
- setting_sources=["user", "project"], # Load Skills from filesystem
- skills="all",
- allowed_tools=["Read", "Bash"],
- )
-
- async def main():
- async for message in query(prompt="Extract text from invoice.pdf", options=options):
- print(message)
-
- asyncio.run(main())
-
- for await (const message of query({
- prompt: "Extract text from invoice.pdf",
- options: {
- cwd: process.cwd(),
- settingSources: ["user", "project"], // Load Skills from filesystem
- skills: "all",
- allowedTools: ["Read", "Bash"]
- }
- })) {
- console.log(message);
- }
-
-Claude automatically invokes the relevant Skill if the description matches your request.
+In the stream, the skill invocation appears as a Skill tool use, followed by Read calls on the project files. The run ends with a `success` result whose text carries the findings. The list pre-approves the named tools rather than restricting the others. For the full permission flow, including permission modes and the `canUseTool` callback, see [Permissions](</docs/en/agent-sdk/permissions>).
##
@@ -226,9 +388,9 @@
-Skills Not Found
-
-**Check settingSources configuration** : Skills are discovered through the `user` and `project` setting sources. If you set `settingSources`/`setting_sources` explicitly and omit those sources, skills are not loaded:
+Skills not found
+
+**Check settingSources configuration** : the SDK discovers skills through the `user` and `project` setting sources. If you set `settingSources`/`setting_sources` explicitly and omit those sources, the SDK doesn’t load skills:
Python
@@ -255,7 +417,7 @@
skills: "all"
};
-For which skill directories each source loads, see the [filesystem sources table](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>). For more details on `settingSources`/`setting_sources`, see the [TypeScript SDK reference](</docs/en/agent-sdk/typescript#settingsource>) or [Python SDK reference](</docs/en/agent-sdk/python#settingsource>). **Check working directory** : The SDK loads Skills from `.claude/skills/` in the `cwd` option and in every parent directory up to the repository root. Ensure `cwd` points at or below the directory containing `.claude/skills/`, within the same repository:
+For which skill directories each source loads, see the [filesystem sources table](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>). For more details on `settingSources`/`setting_sources`, see the [TypeScript SDK reference](</docs/en/agent-sdk/typescript#settingsource>) or [Python SDK reference](</docs/en/agent-sdk/python#settingsource>). **Check working directory** : the SDK loads skills from `.claude/skills/` in the `cwd` option and in every parent directory up to the repository root. Ensure `cwd` points at or below the directory containing `.claude/skills/`, within the same repository:
Python
@@ -275,55 +437,85 @@
skills: "all"
};
-See the “Using Skills with the SDK” section above for the complete pattern. **Verify filesystem location** :
-
- # Check project Skills
+See Use skills with the Agent SDK for the complete pattern. **Verify filesystem location** :
+
+ # Check project skills
ls .claude/skills/*/SKILL.md
- # Check personal Skills
+ # Check personal skills
ls ~/.claude/skills/*/SKILL.md
###
-Skill Not Being Used
-
-**Check the`skills` option**: If you passed a `skills` list, confirm the skill’s name is included. Passing `[]` disables all skills. **Check the description** : Ensure it’s specific and includes relevant keywords. See [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#writing-effective-descriptions>) for guidance on writing effective descriptions.
-
-###
-
-
-
-Additional Troubleshooting
-
-For general Skills troubleshooting (YAML syntax, debugging, etc.), see the [Claude Code Skills troubleshooting section](</docs/en/skills#troubleshooting>).
-
-##
-
-
-
-Related Documentation
-
-###
-
-
-
-Skills Guides
-
- * [Agent Skills in Claude Code](</docs/en/skills>): complete Skills guide with creation, examples, and troubleshooting
- * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): conceptual overview, benefits, and architecture
- * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines for effective Skills
- * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): example Skills and templates
-
-###
-
-
-
-SDK Resources
-
+Skill not being used
+
+**Check the`skills` option**: if you passed a `skills` list, confirm the skill’s name is included. When Claude tries to invoke an unlisted skill, the Skill tool returns `Skill <name> is not in this session's skills allowlist`. Add the name to your list, or dispatch the skill directly by sending `/<name>` in a prompt, which works without listing. **Check the description** : ensure it’s specific and includes relevant keywords. See [Agent Skills best practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#writing-effective-descriptions>) for guidance on writing effective descriptions.
+
+###
+
+
+
+Invalid skill name error
+
+When a name in your `skills` list can’t work as an exact skill name, `query()` rejects the list before starting the Claude Code process. Names that trigger the rejection include:
+
+ * An empty name
+ * A name containing parentheses, commas, or control characters
+ * A name padded with whitespace
+ * A wildcard form such as a bare `*` or a `:*` suffix
+
+Each SDK surfaces the rejection differently:
+
+ * TypeScript
+
+ * Python
+
+The TypeScript SDK throws an `Error` stating the rule the entry broke. For example, `skills: ["docs:*"]` throws:
+
+ Invalid skill name "docs:*": wildcard-suffix names are not allowed; list each skill by its exact name.
+
+An empty name reports `Skill names must be non-empty strings.`
+
+The Python SDK raises `ValueError` stating the rule the entry broke. For example, `skills=["docs:*"]` raises:
+
+ ValueError: Invalid skill name 'docs:*': wildcard-suffix names are not allowed; list each skill by its exact name.
+
+An empty name reports `Skill names must be non-empty strings`.
+
+###
+
+
+
+Additional troubleshooting
+
+For general skills troubleshooting, such as YAML syntax errors and debugging, see the [Claude Code skills troubleshooting section](</docs/en/skills#troubleshooting>).
+
+##
+
+
+
+Next steps
+
+The [Claude Code skills guide](</docs/en/skills>) covers authoring in depth. Its guidance applies to SDK sessions, with one exception: for project and personal skills, Pre-approve tools for skills replaces the `allowed-tools` frontmatter field with the `allowedTools` option. Start with these sections:
+
+ * [Frontmatter reference](</docs/en/skills#frontmatter-reference>): every supported field
+ * [Pass arguments to skills](</docs/en/skills#pass-arguments-to-skills>): `$ARGUMENTS`, `$0`, `$1`, and skill stacking. The [full substitution table](</docs/en/skills#available-string-substitutions>) adds named arguments and the `${CLAUDE_*}` variables
+ * [Inject dynamic context](</docs/en/skills#inject-dynamic-context>): `!`command`` lines that run before Claude sees the skill content
+ * [Where skills live](</docs/en/skills#where-skills-live>): all discovery levels, plugin namespacing, and what happens when a skill and a command file share a name
+
+##
+
+
+
+Related resources
+
+ * [Commands in Claude Code](</docs/en/commands>): the full command surface, including every built-in
+ * [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): conceptual overview, benefits, and architecture
+ * [Agent Skills best practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines for effective skills
+ * [Agent Skills cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): example skills and templates
* [Subagents in the SDK](</docs/en/agent-sdk/subagents>): similar filesystem-based agents with programmatic options
- * [Commands in the SDK](</docs/en/agent-sdk/slash-commands>): user-invoked commands
- * [SDK Overview](</docs/en/agent-sdk/overview>): general SDK concepts
- * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): complete API documentation
- * [Python SDK Reference](</docs/en/agent-sdk/python>): complete API documentation
+ * [SDK overview](</docs/en/agent-sdk/overview>): general SDK concepts
+ * [TypeScript SDK reference](</docs/en/agent-sdk/typescript>): complete API documentation
+ * [Python SDK reference](</docs/en/agent-sdk/python>): complete API documentation
--- a/skills.md
+++ b/skills.md
@@ -104,8 +104,8 @@
For complete guidance on creating Skills, including SKILL.md structure, multi-file Skills, and examples, see:
- * [Agent Skills in Claude Code](</docs/en/skills>): Complete guide with examples
- * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines and naming conventions
+ * [Agent Skills in Claude Code](</docs/en/skills>): complete guide with examples
+ * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines and naming conventions
##
@@ -311,10 +311,10 @@
Skills Guides
- * [Agent Skills in Claude Code](</docs/en/skills>): Complete Skills guide with creation, examples, and troubleshooting
- * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): Conceptual overview, benefits, and architecture
- * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines for effective Skills
- * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): Example Skills and templates
+ * [Agent Skills in Claude Code](</docs/en/skills>): complete Skills guide with creation, examples, and troubleshooting
+ * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): conceptual overview, benefits, and architecture
+ * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): authoring guidelines for effective Skills
+ * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): example Skills and templates
###
@@ -322,8 +322,8 @@
SDK Resources
- * [Subagents in the SDK](</docs/en/agent-sdk/subagents>): Similar filesystem-based agents with programmatic options
- * [Slash Commands in the SDK](</docs/en/agent-sdk/slash-commands>): User-invoked commands
- * [SDK Overview](</docs/en/agent-sdk/overview>): General SDK concepts
- * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): Complete API documentation
- * [Python SDK Reference](</docs/en/agent-sdk/python>): Complete API documentation
+ * [Subagents in the SDK](</docs/en/agent-sdk/subagents>): similar filesystem-based agents with programmatic options
+ * [Commands in the SDK](</docs/en/agent-sdk/slash-commands>): user-invoked commands
+ * [SDK Overview](</docs/en/agent-sdk/overview>): general SDK concepts
+ * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): complete API documentation
+ * [Python SDK Reference](</docs/en/agent-sdk/python>): complete API documentation
Show diff (1213 lines)
--- a/skills.md
+++ b/skills.md
@@ -1,845 +1,220 @@
-Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
-
-For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
-
-Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection. See Using skill frontmatter outside Claude Code for which frontmatter fields are part of the standard and which are Claude Code extensions.
-
-##
-
-
-
-Bundled skills
-
-Claude Code includes a set of bundled skills, such as `/doctor`, `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. Most built-in commands instead execute fixed logic directly. You invoke a bundled skill the same way as any other skill, by typing `/` followed by the skill name. Claude invokes some bundled skills automatically when relevant; others, including `/verify` and `/code-review`, run only when you invoke them, which keeps you in control of when these longer-running checks spend time and tokens. Before v2.1.215, Claude could also run `/verify` and `/code-review` on its own. Bundled skills are available in every session. To turn them off, use the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, which disables every bundled skill except `/doctor`.
-
-The [`/doctor`](</docs/en/commands#all-commands>) setup checkup stays typable when `disableBundledSkills` is on, in Claude Code v2.1.205 and later. To hide it, set the `DISABLE_DOCTOR_COMMAND` environment variable or a `skillOverrides` entry of `"doctor": "off"`. Before v2.1.205, `/doctor` was a built-in command rather than a bundled skill.
-
-Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
-
-###
-
-
-
-Run and verify your app
-
-Three bundled skills work together to launch your app and confirm changes against the running app instead of just tests:
-
-Skill| Purpose
----|---
-`/run`| Launch and drive your app to see a change working
-`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks
-`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project
-
-All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes. `/verify` can also record its own recipe. When it has to build and drive your app without a recorded recipe, it writes what worked to `.claude/skills/verify/SKILL.md` at the repo root, or in the touched package directory in a monorepo, so later runs and other agents follow the same steps. At the repo root, the recorded skill replaces the bundled `/verify`. This requires Claude Code v2.1.200 or later. Claude edits the recorded file only when it steered a run wrong, such as a command that failed or a missing step, so you can commit the file without per-session diffs. Before v2.1.205, the bundled skill told Claude to fold in anything a run learned, which caused frequent merge conflicts.
-
-##
-
-
-
-Getting started
-
-###
-
-
-
-Create your first skill
-
-This example creates a skill that summarizes the uncommitted changes in your git repository and flags anything risky. It pulls the live diff into the prompt before Claude reads it, so the response is grounded in your actual working tree rather than what Claude can guess from open files. Claude loads the skill automatically when you ask about your changes, or you can invoke it directly with `/summarize-changes`.
-
-1
-
-Create the skill directory
-
-Create a directory for the skill in your personal skills folder. Personal skills are available across all your projects.
-
- mkdir -p ~/.claude/skills/summarize-changes
-
-2
-
-Write SKILL.md
-
-Every skill needs a `SKILL.md` file with two parts: YAML frontmatter between `---` markers that tells Claude when to use the skill, and markdown content with the instructions Claude follows when the skill runs. The directory name becomes the command you type, and the `description` helps Claude decide when to load the skill automatically.Save this to `~/.claude/skills/summarize-changes/SKILL.md`:
-
- ---
- description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
- ---
-
- ## Current changes
-
- !`git diff HEAD`
-
- ## Instructions
-
- Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating. If the diff is empty, say there are no uncommitted changes.
-
-The `!`git diff HEAD`` line uses dynamic context injection: Claude Code runs the command and replaces the line with its output before Claude sees the skill content, so the instructions arrive with the current diff already inlined.
-
-3
-
-Test the skill
-
-Open a git project, make a small edit to any file, and start Claude Code by running `claude`. You can test the skill two ways.**Let Claude invoke it automatically** by asking something that matches the description:
-
- What did I change?
-
-**Or invoke it directly** with the skill name:
-
- /summarize-changes
-
-Either way, Claude should respond with a short summary of your edit and a list of risks.
-
-###
-
-
-
-Where skills live
-
-Where you store a skill determines who can use it:
-
-Location| Path| Applies to
----|---|---
-Enterprise| See [managed settings](</docs/en/settings#settings-files>)| All users in your organization
-Personal| `~/.claude/skills/<skill-name>/SKILL.md`| All your projects
-Project| `.claude/skills/<skill-name>/SKILL.md`| This project only
-Plugin| `<plugin>/skills/<skill-name>/SKILL.md`| Where plugin is enabled
-
-When skills share the same name across levels, enterprise overrides personal, and personal overrides project. A skill at any of these levels also overrides a bundled skill with the same name. For example, a `code-review` skill in your project’s `.claude/skills/` replaces the bundled `/code-review`. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence. Skills also load from nested `.claude/skills/` directories below your working directory. When Claude reads or edits a file in a subdirectory, skills from that subdirectory’s `.claude/skills/` become available. This lets a monorepo package provide its own skills that apply when working on that package, even if the session started at the repo root. If a nested skill shares a name with another skill, both stay available. For example, with a `deploy` skill at the project root and another in `apps/web/.claude/skills/`:
-
- * The nested one appears under a directory-qualified name, `apps/web:deploy`.
- * Its description says which directory it applies to.
- * Claude picks the variant that matches the files it is working on.
-
-Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly. When you or Claude invoke the unqualified name, the project-root skill loads, and Claude Code appends a list of the directory-qualified variants to its content with an instruction to also invoke any variant whose directory holds the files Claude is working on. A nested skill therefore still applies to work in its directory when only the unqualified name is invoked. Requires Claude Code v2.1.203 or later. A `<skill-name>` entry in the enterprise, personal, or project locations can be a symlink to a directory elsewhere on disk. Claude Code follows the symlink and reads `SKILL.md` from the target directory, and if the same target is reachable from more than one location, Claude Code loads the skill once. Plugin skills handle symlinks differently; see [Share files within a marketplace with symlinks](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>).
-
-Add a `.claude-plugin/plugin.json` to a skill folder and it loads as a [plugin](</docs/en/plugins-reference#skills-directory-plugins>) named `<name>@skills-dir`, so it can bundle agents, hooks, and MCP servers. In a project’s `.claude/skills/`, this requires accepting the workspace trust dialog first.
-
-####
-
-
-
-Live change detection
-
-Claude Code watches skill directories for file changes. When you add, edit, or remove a skill under `~/.claude/skills/`, the project `.claude/skills/`, or a `.claude/skills/` inside an `--add-dir` directory, Claude Code picks up the change within the current session, without a restart. If you create a top-level skills directory that didn’t exist when the session started, restart Claude Code so it can watch the new directory.
-
-Live change detection covers `SKILL.md` text only. For a skill folder that is also a [plugin](</docs/en/plugins-reference#skills-directory-plugins>), changes to `hooks/`, `.mcp.json`, `agents/`, and `output-styles/` need `/reload-plugins` to take effect.
-
-####
-
-
-
-Discovery from parent and nested directories
-
-Project skills load from `.claude/skills/` in the directory where you start Claude Code and in every parent directory up to the repository root. Starting Claude in a subdirectory still picks up skills defined at the root. To load skills from a directory outside that path at startup, pass it with [`--add-dir`](</docs/en/cli-reference>). Claude Code reads `.claude/skills/` inside each added directory alongside the project skills. Skills in nested `.claude/skills/` directories below your starting directory aren’t loaded at startup. They load the first time Claude reads or edits a file inside that subdirectory, and stay available for the rest of the session. For example, after Claude edits a file under `packages/frontend/`, skills in `packages/frontend/.claude/skills/` become available. Until then, those skills don’t appear in autocomplete and can’t be invoked by name. Each skill is a directory with `SKILL.md` as the entrypoint:
-
- my-skill/
- ├── SKILL.md # Main instructions (required)
- ├── template.md # Template for Claude to fill in
- ├── examples/
- │ └── sample.md # Example output showing expected format
- └── scripts/
- └── validate.sh # Script Claude can execute
-
-The `SKILL.md` contains the main instructions and is required. Other files are optional and let you build more powerful skills: templates for Claude to fill in, example outputs showing the expected format, scripts Claude can execute, or detailed reference documentation. Reference these files from your `SKILL.md` so Claude knows what they contain and when to load them. See Add supporting files for more details.
-
-Files in `.claude/commands/` support the same frontmatter. Skills are recommended since they support additional features like supporting files.
-
-####
-
-
-
-Skills from additional directories
-
-The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as commands and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
-
-CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
-
-####
-
-
-
-Skills in Cowork and cloud sessions
-
-[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
-
- * For Cowork and cloud sessions, enable the skill for your claude.ai account.
- * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/cloud-environments#what-carries-over-from-your-setup>); plugins enabled only in your user settings don’t transfer.
-
-[Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) are different: they run locally on your machine and load skills from the same locations as any other local session.
-
-##
-
-
-
-Configure skills
-
-Skills are configured through YAML frontmatter at the top of `SKILL.md` and the markdown content that follows.
-
-###
-
-
-
-Types of skill content
-
-Skill files can contain any instructions, but thinking about how you want to invoke them helps guide what to include: **Reference content** adds knowledge Claude applies to your current work. Conventions, patterns, style guides, domain knowledge. This content runs inline so Claude can use it alongside your conversation context.
-
- ---
- name: api-conventions
- description: API design patterns for this codebase
- ---
-
- When writing API endpoints:
- - Use RESTful naming conventions
- - Return consistent error formats
- - Include request validation
-
-**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically. The example below adds `context: fork`, which runs the skill in its own subagent context; see Run skills in a subagent.
-
- ---
- name: deploy
- description: Deploy the application to production
- context: fork
- disable-model-invocation: true
- ---
-
- Deploy the application:
- 1. Run the test suite
- 2. Build the application
- 3. Push to the deployment target
-
-Keep the body itself concise. Once a skill loads, its content stays in context across turns, so every line is a recurring token cost. State what to do rather than narrating how or why, and apply the same conciseness test you would for [CLAUDE.md content](</docs/en/best-practices#write-an-effective-claude-md>).
-
-###
-
-
-
-Frontmatter reference
-
-Beyond the markdown content, you can configure skill behavior using YAML frontmatter fields between `---` markers at the top of your `SKILL.md` file:
-
- ---
- name: my-skill
- description: What this skill does
- disable-model-invocation: true
- allowed-tools: Read Grep
- ---
-
- Your skill instructions here...
-
-All fields are optional. Only `description` is recommended so Claude knows when to use the skill. Boolean fields accept `yes`, `no`, `on`, `off`, `1`, and `0` in any letter case, in addition to `true` and `false`. Before v2.1.218, Claude Code recognized only `true` and `false`.
-
-Field| Required| Description
----|---|---
-`name`| No| Display name shown in skill listings. Defaults to the directory name. See How a skill gets its command name for how the field interacts with the name you type to invoke the skill.
-`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Put the key use case first: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
-`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
-`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
-`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
-`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). As of v2.1.196, also prevents the skill from running when a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt. Default: `false`.
-`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
-`allowed-tools`| No| Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See Pre-approve tools for a skill.
-`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message. Like deny rules, the field can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains.
-`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model. With `context: fork`, the value sets the forked subagent’s model instead, and an excluded value follows the [same rules as a subagent model override](</docs/en/model-config#restrict-model-selection>).
-`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
-`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
-`agent`| No| Which subagent type to use when `context: fork` is set.
-`background`| No| Only applies with `context: fork`. Set to `false` to wait for the forked subagent’s result in the turn that invoked the skill, instead of running it in the background. Default: `true`. Requires Claude Code v2.1.218 or later.
-`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
-`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
-`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere.
-`metadata`| No| Free-form YAML map for your own key-value data, such as entitlement or catalog fields, read by your own tooling from `SKILL.md`. Claude Code doesn’t act on its contents, and drops a value that isn’t a map. Don’t reuse frontmatter field names such as `paths` as keys.
-`license`| No| License covering the skill. Part of the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Claude Code accepts the field but doesn’t act on it.
-`compatibility`| No| Environment requirements for the skill, such as intended products or system prerequisites, as defined by the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Accepts a string of up to 500 characters. Claude Code accepts the field but doesn’t act on it.
-
-####
-
-
-
-Using skill frontmatter outside Claude Code
-
-Claude Code accepts every field in the table above. Outside Claude Code, you can use only the fields in the [Agent Skills](<https://agentskills.io>) spec:
-
-Distribution path| Frontmatter fields you can use
----|---
-Claude Code skills at any level, including [plugin](</docs/en/plugins>) skills| Every field in the table above
-claude.ai skill uploads, the Skills API, and packaging with `package_skill.py` from [anthropics/skills](<https://github.com/anthropics/skills>)| `name`, `description`, `license`, `compatibility`, `metadata`, `allowed-tools`
-
-When you enable a personal skill for Cowork and cloud sessions, including routines, you upload it to claude.ai, so the same rules apply. If you include any field the spec doesn’t allow, packaging or upload fails with a hard error instead of ignoring the field:
-
- Unexpected key(s) in SKILL.md frontmatter: argument-hint. Allowed properties are: allowed-tools, compatibility, description, license, metadata, name
-
-Restricting frontmatter to the spec’s six fields avoids the unexpected-key error above. The [Agent Skills spec](<https://agentskills.io>) and the [Skills API requirements](<https://docs.claude.com/en/api/skills-guide>) define everything else those paths validate. Claude Code-only body features, such as dynamic context injection, don’t function in claude.ai chat or through the API. Claude Code accepts all six fields, so frontmatter that follows the spec loads in Claude Code without changes.
-
-####
-
-
-
-How a skill gets its command name
-
-The command you type to invoke a skill comes from where the skill file lives and, for plugin skills, also from the frontmatter `name` field. In a personal or project skill, `name` sets only the display label shown in skill listings, and the command still comes from the directory or file name. In a plugin skill, `name` sets the last segment of the command and the plugin prefix stays in place. The table below shows where the command name comes from for each layout:
-
-Skill location| Command name source| Example
----|---|---
-Skill directory under `~/.claude/skills/` or `.claude/skills/`| Directory name| `.claude/skills/deploy-staging/SKILL.md` → `/deploy-staging`
-Nested `.claude/skills/` directory, when the name clashes with another skill| Subdirectory path relative to the working directory, then the skill directory name| `apps/web/.claude/skills/deploy/SKILL.md` → `/apps/web:deploy`
-File under `.claude/commands/`| File name without extension| `.claude/commands/deploy.md` → `/deploy`
-Plugin `skills/` subdirectory| Frontmatter `name` or the directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`, or `/my-plugin:fancy` with `name: fancy`
-Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>)
-
-In a plugin skill, the frontmatter `name` replaces the directory name in the last segment of the command, so `my-plugin/skills/review/SKILL.md` with `name: fancy` becomes `/my-plugin:fancy`. The bare `/fancy` also invokes the skill unless another command already uses that name. Before v2.1.216, the frontmatter name replaced the whole command name, so the menu showed `/fancy` without the plugin prefix and `/my-plugin:fancy` didn’t autocomplete. In [non-interactive sessions](</docs/en/headless>), Claude Code doesn’t reserve the names `help` and `feedback` for their terminal-only built-in commands, so a plugin skill with one of those names keeps its bare command there. Claude Code still reserves the name of every other terminal-only built-in, such as `/login`, even though the command can’t run in those sessions. From v2.1.216 through v2.1.220, `help` and `feedback` were reserved too, so a plugin skill with one of those names was invocable only by its namespaced command in non-interactive sessions. For a plugin-root `SKILL.md`, there is no skill directory to take the name from, so `name` supplies the whole final segment. Without a `name` field, Claude Code falls back to the plugin’s directory name.
-
-####
-
-
-
-Available string substitutions
-
-Skills support string substitution for dynamic values in the skill content:
-
-Variable| Description
----|---
-`$ARGUMENTS`| All arguments passed when invoking the skill. If `$ARGUMENTS` is not present in the content, arguments are appended as `ARGUMENTS: <value>`.
-`$ARGUMENTS[N]`| Access a specific argument by 0-based index, such as `$ARGUMENTS[0]` for the first argument.
-`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
-`$name`| Named argument declared in the `arguments` frontmatter list. Names map to positions in order, so with `arguments: [issue, branch]` the placeholder `$issue` expands to the first argument and `$branch` to the second.
-`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
-`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Use this to adapt skill instructions to the active effort setting.
-`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
-`${CLAUDE_PROJECT_DIR}`| The project root directory. This is the same path [hooks](</docs/en/hooks#reference-scripts-by-path>) and MCP servers receive as `CLAUDE_PROJECT_DIR`. Use this to reference project-local scripts or files, such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/helper.sh`, independent of where the skill is installed.
-
-Claude Code substitutes `${CLAUDE_SKILL_DIR}` and `${CLAUDE_PROJECT_DIR}` in two places: the skill’s markdown content, and Bash rules in the `allowed-tools` frontmatter. Using the same variable in both places lets a skill run a bundled script without a permission prompt. The following skill shows the pattern:
-
- ---
- name: render-chart
- description: Render a chart from a CSV file
- allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/render.sh *)
- ---
-
- Run `${CLAUDE_SKILL_DIR}/scripts/render.sh <csv-file>` to render the chart.
-
-If this skill is installed at `~/.claude/skills/render-chart/`, both occurrences of `${CLAUDE_SKILL_DIR}` expand to that directory. The `allowed-tools` rule then matches the exact command the skill body tells Claude to run, so the script runs without prompting. The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
-
- ---
- name: session-logger
- description: Log activity for this session
- ---
-
- Log the following to logs/${CLAUDE_SESSION_ID}.log:
-
- $ARGUMENTS
-
-###
-
-
-
-Add supporting files
-
-Skills can include multiple files in their directory. This keeps `SKILL.md` focused on the essentials while letting Claude access detailed reference material only when needed. Large reference docs, API specifications, or example collections don’t need to load into context every time the skill runs.
-
- my-skill/
- ├── SKILL.md (required - overview and navigation)
- ├── reference.md (detailed API docs - loaded when needed)
- ├── examples.md (usage examples - loaded when needed)
- └── scripts/
- └── helper.py (utility script - executed, not loaded)
-
-Reference supporting files from `SKILL.md` so Claude knows what each file contains and when to load it:
-
- ## Additional resources
-
- - For complete API details, see [reference.md](reference.md)
- - For usage examples, see [examples.md](examples.md)
-
-Keep `SKILL.md` under 500 lines. Move detailed reference material to separate files.
-
-###
-
-
-
-Control who invokes a skill
-
-By default, both you and Claude can invoke any skill. You can type `/skill-name` to invoke it directly, and Claude can load it automatically when relevant to your conversation. Two frontmatter fields let you restrict this:
-
- * **`disable-model-invocation: true`** : Only you can invoke the skill. Use this for workflows with side effects or that you want to control timing, like `/commit`, `/deploy`, or `/send-slack-message`. You don’t want Claude deciding to deploy because your code looks ready.
- * **`user-invocable: false`** : Only Claude can invoke the skill. Use this for background knowledge that isn’t actionable as a command. A `legacy-system-context` skill explains how an old system works. Claude should know this when relevant, but `/legacy-system-context` isn’t a meaningful action for users to take.
-
-This example creates a deploy skill that only you can trigger. If you set `disable-model-invocation: true`, Claude can’t run the skill automatically:
-
- ---
- name: deploy
- description: Deploy the application to production
- disable-model-invocation: true
- ---
-
- Deploy $ARGUMENTS to production:
-
- 1. Run the test suite
- 2. Build the application
- 3. Push to the deployment target
- 4. Verify the deployment succeeded
-
-If Claude tries anyway, Claude Code blocks the call and instructs it not to reproduce the deploy steps another way, so expect Claude to suggest running `/deploy` yourself. Here’s how the two fields affect invocation and context loading:
-
-Frontmatter| You can invoke| Claude can invoke| When loaded into context
----|---|---|---
-(default)| Yes| Yes| Description always in context, full skill loads when invoked
-`disable-model-invocation: true`| Yes| No| Description not in context, full skill loads when you invoke
-`user-invocable: false`| No| Yes| Description always in context, full skill loads when invoked
-
-In a regular session, skill descriptions are loaded into context so Claude knows what’s available, but full skill content only loads when invoked. [Subagents with preloaded skills](</docs/en/sub-agents#preload-skills-into-subagents>) work differently: the full skill content is injected at startup.
-
-###
-
-
-
-Skill content lifecycle
-
-When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. This persistence applies to the skill’s instructions, not its permissions: an `allowed-tools` grant clears when you send your next message. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
-
-###
-
-
-
-Pre-approve tools for a skill
-
-The `allowed-tools` field grants permission for the listed tools during the turn that invokes the skill, so Claude can use them without prompting you for approval. The grant clears when you send your next message, even though the skill content stays in context; invoking the skill again re-applies it for that turn. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. To pre-approve tools for the whole session rather than a single turn, add allow rules to those permission settings instead. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
-
- ---
- name: commit
- description: Stage and commit the current changes
- disable-model-invocation: true
- allowed-tools: Bash(git add *) Bash(git commit *) Bash(git status *)
- ---
-
-To remove tools from Claude’s available pool while a skill is active, list them in `disallowed-tools` in the skill’s frontmatter. The restriction clears when you send your next message. Like deny rules, the field can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains. To block tools across all skills and prompts, add deny rules in your [permission settings](</docs/en/permissions>).
-
-###
-
-
-
-Pass arguments to skills
-
-Both you and Claude can pass arguments when invoking a skill. Arguments are available via the `$ARGUMENTS` placeholder. This skill fixes a GitHub issue by number. The `$ARGUMENTS` placeholder gets replaced with whatever follows the skill name:
-
- ---
- name: fix-issue
- description: Fix a GitHub issue
- disable-model-invocation: true
- ---
-
- Fix GitHub issue $ARGUMENTS following our coding standards.
-
- 1. Read the issue description
- 2. Understand the requirements
- 3. Implement the fix
- 4. Write tests
- 5. Create a commit
-
-When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. You can also stack several skills at the start of one message. Typing `/write-tests /fix-issue 123` loads both skills and passes the trailing text `123` as `$ARGUMENTS` to each of them. Before v2.1.199, only the first skill loaded and received `/fix-issue 123` as literal argument text. Claude Code expands the first skill plus up to five more stacked after it. Expansion stops at the first token that isn’t an inline user-invocable skill, so a skill that runs as a forked subagent, such as [`/code-review`](</docs/en/code-review#review-a-diff-locally>), or one whose arguments may themselves start with a slash command, such as `/loop`, also ends the run there. That token and everything after it become the argument text for every expanded skill. `/code-review` runs as a forked subagent from v2.1.218; on earlier versions it ran inline and stacked. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
-
- ---
- name: migrate-component
- description: Migrate a component from one framework to another
- ---
-
- Migrate the $ARGUMENTS[0] component from $ARGUMENTS[1] to $ARGUMENTS[2].
- Preserve all existing behavior and tests.
-
-Running `/migrate-component SearchBar React Vue` replaces `$ARGUMENTS[0]` with `SearchBar`, `$ARGUMENTS[1]` with `React`, and `$ARGUMENTS[2]` with `Vue`. The same skill using the `$N` shorthand:
-
- ---
- name: migrate-component
- description: Migrate a component from one framework to another
- ---
-
- Migrate the $0 component from $1 to $2.
- Preserve all existing behavior and tests.
-
-##
-
-
-
-Advanced patterns
-
-###
-
-
-
-Inject dynamic context
-
-The `!`<command>`` syntax runs shell commands before the skill content is sent to Claude. The command output replaces the placeholder, so Claude receives actual data, not the command itself. This skill summarizes a pull request by fetching live PR data with the GitHub CLI. The `!`gh pr diff`` and other commands run first, and their output gets inserted into the prompt:
-
- ---
- name: pr-summary
- description: Summarize changes in a pull request
- context: fork
- agent: Explore
- allowed-tools: Bash(gh *)
- ---
-
- ## Pull request context
- - PR diff: !`gh pr diff`
- - PR comments: !`gh pr view --comments`
- - Changed files: !`gh pr diff --name-only`
-
- ## Your task
- Summarize this pull request...
-
-When this skill runs:
-
- 1. Each `!`<command>`` executes immediately (before Claude sees anything)
- 2. The output replaces the placeholder in the skill content
- 3. Claude receives the fully-rendered prompt with actual PR data
-
-This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. The inline form is only recognized when `!` appears at the start of a line or immediately after whitespace. If `!` follows another character, as in `KEY=!`cmd``, the placeholder is left as literal text and the command does not run. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
-
- ## Environment
- ```!
- node --version
- npm --version
- git status --short
- ```
-
-To disable this behavior for skills and custom commands from user, project, plugin, or additional-directory sources, set `"disableSkillShellExecution": true` in [settings](</docs/en/settings>). Each command is replaced with `[shell command execution disabled by policy]` instead of being run. Bundled and managed skills are not affected. This setting is most useful in [managed settings](</docs/en/permissions#managed-settings>), where users cannot override it.
-
-To request deeper reasoning when a skill runs, include `ultrathink` anywhere in the skill content. See [Use ultrathink for one-off deep reasoning](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>).
-
-###
-
-
-
-Run skills in a subagent
-
-Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history. The forked subagent runs in the [background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): you keep working while it runs, and its result arrives in your conversation when it completes. Set `background: false` in the frontmatter to instead wait for the result in the turn that invoked the skill. Before v2.1.218, forked skills always blocked the turn until they finished. Claude Code also waits for the result, even when the skill doesn’t set `background: false`, in cases like these:
-
- * In non-interactive mode, with the `-p` flag or the Agent SDK
- * When you set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, which also turns off all other background task features
- * When you invoke a forked skill while an earlier invocation of the same skill is still running
- * When a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt
-
-A backgrounded fork also runs with the [narrower tool set that applies to background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): the skill’s subagent is a regular agent type, so the exemption for subagents that fork the conversation doesn’t cover it. If your skill’s steps depend on a tool outside that set, set `background: false` to keep the full tool set. A forked skill that runs in the background applies its edits outside your session’s [checkpoints](</docs/en/checkpointing>), so `/rewind` doesn’t undo them; use git to revert them.
-
-`context: fork` only makes sense for skills with explicit instructions. If your skill contains guidelines like “use these API conventions” without a task, the subagent receives the guidelines but no actionable prompt, and returns without meaningful output.
-
-Skills and [subagents](</docs/en/sub-agents>) work together in two directions:
-
-Approach| System prompt| Task| Also loads
----|---|---|---
-Skill with `context: fork`| From agent type| SKILL.md content| CLAUDE.md, except when the agent is Explore or Plan
-Subagent with `skills` field| Subagent’s markdown body| Claude’s delegation message| Preloaded skills + CLAUDE.md
-
-With `context: fork`, you write the task in your skill and pick an agent type to execute it. The built-in Explore and Plan agents [skip CLAUDE.md and git status](</docs/en/sub-agents#what-loads-at-startup>) to keep their context small, so a forked skill using `agent: Explore` sees only the SKILL.md content and the agent’s own system prompt. For the inverse, where you define a custom subagent that uses skills as reference material, see [Subagents](</docs/en/sub-agents#preload-skills-into-subagents>).
-
-####
-
-
-
-Example: Research skill using Explore agent
-
-This skill runs research in a forked Explore agent. The skill content becomes the task, and the agent provides read-only tools optimized for codebase exploration:
-
- ---
- name: deep-research
- description: Research a topic thoroughly
- context: fork
- agent: Explore
- ---
-
- Research $ARGUMENTS thoroughly:
-
- 1. Find relevant files using Glob and Grep
- 2. Read and analyze the code
- 3. Summarize findings with specific file references
-
-When this skill runs:
-
- 1. A new isolated context is created
- 2. The subagent receives the skill content as its prompt (“Research $ARGUMENTS thoroughly…”)
- 3. The `agent` field determines the execution environment (model, tools, and permissions)
- 4. The subagent summarizes its results and returns them to your main conversation when it finishes
-
-The `agent` field specifies which subagent configuration to use. Options include built-in agents (`Explore`, `Plan`, `general-purpose`) or any custom subagent from `.claude/agents/`. If omitted, uses `general-purpose`.
-
-###
-
-
-
-Restrict Claude’s skill access
-
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init` and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
-
- # Add to deny rules:
- Skill
-
-**Allow or deny specific skills** using [permission rules](</docs/en/permissions>):
-
- # Allow only specific skills
- Skill(commit)
- Skill(review-pr *)
-
- # Deny specific skills
- Skill(deploy *)
-
-Permission syntax: `Skill(name)` for exact match, `Skill(name *)` for prefix match with any arguments. **Hide individual skills** by adding `disable-model-invocation: true` to their frontmatter. This removes the skill from Claude’s context entirely.
-
-The `user-invocable` field only controls menu visibility, not Skill tool access. Use `disable-model-invocation: true` to block programmatic invocation.
-
-###
-
-
-
-Override skill visibility from settings
-
-The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
-
-Value| Listed to Claude| In `/` menu
----|---|---
-`"on"`| Name and description| Yes
-`"name-only"`| Name only| Yes
-`"user-invocable-only"`| Hidden| Yes
-`"off"`| Hidden| Hidden
-
-The `/skills` menu labels the `"user-invocable-only"` state `user-only`. As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
-
- {
- "skillOverrides": {
- "legacy-context": "name-only",
- "deploy": "off"
+##
+
+
+
+Overview
+
+Agent Skills extend Claude with specialized capabilities that Claude autonomously invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. For comprehensive information about Skills, including benefits, architecture, and authoring guidelines, see the [Agent Skills overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>).
+
+##
+
+
+
+How Skills Work with the SDK
+
+When using the Claude Agent SDK, Skills are:
+
+ 1. **Defined as filesystem artifacts** : you create each Skill as a `SKILL.md` file in its own directory, such as `.claude/skills/<name>/SKILL.md`
+ 2. **Loaded from filesystem** : the SDK loads Skills from the filesystem locations governed by `settingSources` (TypeScript) or `setting_sources` (Python)
+ 3. **Automatically discovered** : once filesystem settings load, the SDK discovers Skill metadata at startup from user and project directories, and loads the full content when Claude invokes the Skill
+ 4. **Model-invoked** : Claude autonomously chooses when to use them based on context
+ 5. **Filtered via the`skills` option**: discovered skills are enabled by default. Pass a list of skill names, `"all"`, or `[]` to control which are available in the session
+
+Unlike subagents (which can be defined programmatically), Skills must be created as filesystem artifacts. The SDK does not provide a programmatic API for registering Skills.
+
+Skills are discovered through the filesystem setting sources. With default `query()` options, the SDK loads user and project sources, so skills in `~/.claude/skills/`, `<cwd>/.claude/skills/`, and `.claude/skills/` in any parent directory of `<cwd>` up to the repository root are available. If you set `settingSources` explicitly, include `'user'` or `'project'` to keep skill discovery, or use the [`plugins` option](</docs/en/agent-sdk/plugins>) to load skills from a specific path.
+
+##
+
+
+
+Using Skills with the SDK
+
+Set the `skills` option on `query()` to control which Skills are available to the session. When omitted, discovered Skills are enabled and the Skill tool is available, matching CLI behavior. Pass `"all"` to enable every discovered Skill, a list of Skill names to enable only those, or `[]` to disable all. When you set `skills`, the SDK adds the Skill tool to `allowedTools` automatically. If you also pass an explicit `tools` list, include `"Skill"` in that list so Claude can invoke skills. Once configured, Claude automatically discovers Skills from the filesystem and invokes them when relevant to the user’s request. The following example sets `cwd` to the process’s current working directory, so run it from inside a project that has a `.claude/skills/` directory in the current directory or any parent up to the repository root:
+
+Python
+
+TypeScript
+
+ import asyncio
+ import os
+
+ from claude_agent_sdk import query, ClaudeAgentOptions
+
+ async def main():
+ options = ClaudeAgentOptions(
+ cwd=os.getcwd(), # .claude/skills/ here or in a parent directory
+ setting_sources=["user", "project"], # Load Skills from filesystem
+ skills="all", # Enable every discovered Skill
+ allowed_tools=["Read", "Write", "Bash"],
+ )
+
+ async for message in query(
+ prompt="Help me process this PDF document", options=options
+ ):
+ print(message)
+
+ asyncio.run(main())
+
+ import { query } from "@anthropic-ai/claude-agent-sdk";
+
+ for await (const message of query({
+ prompt: "Help me process this PDF document",
+ options: {
+ cwd: process.cwd(), // .claude/skills/ here or in a parent directory
+ settingSources: ["user", "project"], // Load Skills from filesystem
+ skills: "all", // Enable every discovered Skill
+ allowedTools: ["Read", "Write", "Bash"]
}
+ })) {
+ console.log(message);
}
-Plugin skills are not affected by `skillOverrides`. Manage those through `/plugin` instead.
-
-##
-
-
-
-Evaluate and iterate on a skill
-
-Seeing a skill trigger tells you Claude found it, not that it did what you intended. To know a skill is working, measure two things separately: whether Claude invokes it on the prompts it should, and whether the output matches what you expect when it does. The check for both is a baseline comparison. Collect a few realistic prompts, run each one in a fresh session with the skill available and again with it disabled, and compare the results. A fresh session matters because leftover context from authoring the skill will mask gaps in the written instructions.
-
-###
-
-
-
-Run evals with skill-creator
-
-The [`skill-creator` plugin](<https://github.com/anthropics/claude-plugins-official/tree/main/plugins/skill-creator>) automates the comparison loop inside Claude Code. Install it from the official marketplace:
-
- /plugin install skill-creator@claude-plugins-official
-
-If the install fails, match the message Claude Code reports:
-
- * `Marketplace "claude-plugins-official" not found`: add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`, then retry the install.
- * The plugin is not found in the marketplace: check the plugin name. Claude Code [refreshes a stale marketplace catalog and retries](</docs/en/discover-plugins#install-plugins>) before reporting this, so if you turned off [marketplace auto-update](</docs/en/discover-plugins#configure-auto-updates>), refresh manually with `/plugin marketplace update claude-plugins-official` and retry the install.
-
-If the install summary reports `Run /reload-plugins to activate.`, run that command to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
-
- * **Test cases** : stores prompts, input files, and expected behavior in `evals/evals.json` inside the skill directory
- * **Isolated runs** : spawns a [subagent](</docs/en/sub-agents>) per test case so each run starts with a clean context, and records token count and duration
- * **Grading** : checks each assertion against the output and writes pass or fail with evidence to `grading.json`
- * **Benchmark** : aggregates pass rate, time, and tokens for with-skill versus without-skill into `benchmark.json` so you can compare the pass-rate improvement against the token and time overhead
- * **Version comparison** : runs a blind A/B between two versions of the skill so you can confirm an edit is an improvement before committing it
- * **Description tuning** : generates should-trigger and should-not-trigger prompts, measures the hit rate, and proposes description edits when the skill activates on the wrong requests
- * **Review viewer** : opens an HTML report where you inspect each output and record qualitative feedback that the next iteration reads
-
-For the eval file format and the full iteration workflow, see [Evaluating skill output quality](<https://agentskills.io/skill-creation/evaluating-skills>) on agentskills.io. For background on the benchmark and comparison modes, see the [skill-creator announcement](<https://claude.com/blog/improving-skill-creator-test-measure-and-refine-agent-skills>).
-
-##
-
-
-
-Share skills
-
-Skills can be distributed at different scopes depending on your audience:
-
- * **Project skills** : Commit `.claude/skills/` to version control
- * **Plugins** : Create a `skills/` directory in your [plugin](</docs/en/plugins>)
- * **Managed** : Deploy organization-wide through [managed settings](</docs/en/settings#settings-files>)
-
-###
-
-
-
-Generate visual output
-
-Skills can bundle and run scripts in any language, giving Claude capabilities beyond what’s possible in a single prompt. One powerful pattern is generating visual output: interactive HTML files that open in your browser for exploring data, debugging, or creating reports. This example creates a codebase explorer: an interactive tree view where you can expand and collapse directories, see file sizes at a glance, and identify file types by color. Create the Skill directory:
-
- mkdir -p ~/.claude/skills/codebase-visualizer/scripts
-
-Save this to `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script. The script path uses `${CLAUDE_SKILL_DIR}` so it resolves correctly whether the skill is installed at the personal, project, or plugin level:
-
- ---
- name: codebase-visualizer
- description: Generate an interactive collapsible tree visualization of your codebase. Use when exploring a new repo, understanding project structure, or identifying large files.
- allowed-tools: Bash(python3 *)
- ---
-
- # Codebase Visualizer
-
- Generate an interactive HTML tree view that shows your project's file structure with collapsible directories.
-
- ## Usage
-
- Run the visualization script from your project root:
-
- ```bash
- python3 ${CLAUDE_SKILL_DIR}/scripts/visualize.py .
- ```
-
- This creates `codebase-map.html` in the current directory and opens it in your default browser.
-
- ## What the visualization shows
-
- - **Collapsible directories**: Click folders to expand/collapse
- - **File sizes**: Displayed next to each file
- - **Colors**: Different colors for different file types
- - **Directory totals**: Shows aggregate size of each folder
-
-Save this to `~/.claude/skills/codebase-visualizer/scripts/visualize.py`. This script scans a directory tree and generates a self-contained HTML file with:
-
- * A **summary sidebar** showing file count, directory count, total size, and number of file types
- * A **bar chart** breaking down the codebase by file type (top 8 by size)
- * A **collapsible tree** where you can expand and collapse directories, with color-coded file type indicators
-
-The script requires Python 3 but uses only built-in libraries, so there are no packages to install:
-
- #!/usr/bin/env python3
- """Generate an interactive collapsible tree visualization of a codebase."""
-
- import json
- import sys
- import webbrowser
- from html import escape
- from pathlib import Path
- from collections import Counter
-
- IGNORE = {'.git', 'node_modules', '__pycache__', '.venv', 'venv', 'dist', 'build'}
-
- def scan(path: Path, stats: dict) -> dict:
- result = {"name": path.name, "children": [], "size": 0}
- try:
- for item in sorted(path.iterdir()):
- if item.name in IGNORE or item.name.startswith('.'):
- continue
- if item.is_file():
- size = item.stat().st_size
- ext = item.suffix.lower() or '(no ext)'
- result["children"].append({"name": item.name, "size": size, "ext": ext})
- result["size"] += size
- stats["files"] += 1
- stats["extensions"][ext] += 1
- stats["ext_sizes"][ext] += size
- elif item.is_dir():
- stats["dirs"] += 1
- child = scan(item, stats)
- if child["children"]:
- result["children"].append(child)
- result["size"] += child["size"]
- except PermissionError:
- pass
- return result
-
- def generate_html(data: dict, stats: dict, output: Path) -> None:
- ext_sizes = stats["ext_sizes"]
- total_size = sum(ext_sizes.values()) or 1
- sorted_exts = sorted(ext_sizes.items(), key=lambda x: -x[1])[:8]
- colors = {
- '.js': '#f7df1e', '.ts': '#3178c6', '.py': '#3776ab', '.go': '#00add8',
- '.rs': '#dea584', '.rb': '#cc342d', '.css': '#264de4', '.html': '#e34c26',
- '.json': '#6b7280', '.md': '#083fa1', '.yaml': '#cb171e', '.yml': '#cb171e',
- '.mdx': '#083fa1', '.tsx': '#3178c6', '.jsx': '#61dafb', '.sh': '#4eaa25',
- }
- lang_bars = "".join(
- f'<div class="bar-row"><span class="bar-label">{ext}</span>'
- f'<div class="bar" style="width:{(size/total_size)*100}%;background:{colors.get(ext,"#6b7280")}"></div>'
- f'<span class="bar-pct">{(size/total_size)*100:.1f}%</span></div>'
- for ext, size in sorted_exts
- )
- def fmt(b):
- if b < 1024: return f"{b} B"
- if b < 1048576: return f"{b/1024:.1f} KB"
- return f"{b/1048576:.1f} MB"
-
- html = f'''<!DOCTYPE html>
- <html><head>
- <meta charset="utf-8"><title>Codebase Explorer</title>
- <style>
- body {{ font: 14px/1.5 system-ui, sans-serif; margin: 0; background: #1a1a2e; color: #eee; }}
- .container {{ display: flex; height: 100vh; }}
- .sidebar {{ width: 280px; background: #252542; padding: 20px; border-right: 1px solid #3d3d5c; overflow-y: auto; flex-shrink: 0; }}
- .main {{ flex: 1; padding: 20px; overflow-y: auto; }}
- h1 {{ margin: 0 0 10px 0; font-size: 18px; }}
- h2 {{ margin: 20px 0 10px 0; font-size: 14px; color: #888; text-transform: uppercase; }}
- .stat {{ display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3d3d5c; }}
- .stat-value {{ font-weight: bold; }}
- .bar-row {{ display: flex; align-items: center; margin: 6px 0; }}
- .bar-label {{ width: 55px; font-size: 12px; color: #aaa; }}
- .bar {{ height: 18px; border-radius: 3px; }}
- .bar-pct {{ margin-left: 8px; font-size: 12px; color: #666; }}
- .tree {{ list-style: none; padding-left: 20px; }}
- details {{ cursor: pointer; }}
- summary {{ padding: 4px 8px; border-radius: 4px; }}
- summary:hover {{ background: #2d2d44; }}
- .folder {{ color: #ffd700; }}
- .file {{ display: flex; align-items: center; padding: 4px 8px; border-radius: 4px; }}
- .file:hover {{ background: #2d2d44; }}
- .size {{ color: #888; margin-left: auto; font-size: 12px; }}
- .dot {{ width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }}
- </style>
- </head><body>
- <div class="container">
- <div class="sidebar">
- <h1>📊 Summary</h1>
- <div class="stat"><span>Files</span><span class="stat-value">{stats["files"]:,}</span></div>
- <div class="stat"><span>Directories</span><span class="stat-value">{stats["dirs"]:,}</span></div>
- <div class="stat"><span>Total size</span><span class="stat-value">{fmt(data["size"])}</span></div>
- <div class="stat"><span>File types</span><span class="stat-value">{len(stats["extensions"])}</span></div>
- <h2>By file type</h2>
- {lang_bars}
- </div>
- <div class="main">
- <h1>📁 {escape(data["name"])}</h1>
- <ul class="tree" id="root"></ul>
- </div>
- </div>
- <script>
- const data = {json.dumps(data)};
- const colors = {json.dumps(colors)};
- function fmt(b) {{ if (b < 1024) return b + ' B'; if (b < 1048576) return (b/1024).toFixed(1) + ' KB'; return (b/1048576).toFixed(1) + ' MB'; }}
- function esc(s) {{ return s.replace(/[&<>"']/g, c => ({{"&":"&","<":"<",">":">",'"':""","'":"'"}}[c])); }}
- function render(node, parent) {{
- if (node.children) {{
- const det = document.createElement('details');
- det.open = parent === document.getElementById('root');
- det.innerHTML = `<summary><span class="folder">📁 ${{esc(node.name)}}</span><span class="size">${{fmt(node.size)}}</span></summary>`;
- const ul = document.createElement('ul'); ul.className = 'tree';
- node.children.sort((a,b) => (b.children?1:0)-(a.children?1:0) || a.name.localeCompare(b.name));
- node.children.forEach(c => render(c, ul));
- det.appendChild(ul);
- const li = document.createElement('li'); li.appendChild(det); parent.appendChild(li);
- }} else {{
- const li = document.createElement('li'); li.className = 'file';
- li.innerHTML = `<span class="dot" style="background:${{colors[node.ext]||'#6b7280'}}"></span>${{esc(node.name)}}<span class="size">${{fmt(node.size)}}</span>`;
- parent.appendChild(li);
- }}
- }}
- data.children.forEach(c => render(c, document.getElementById('root')));
- </script>
- </body></html>'''
- output.write_text(html)
-
- if __name__ == '__main__':
- target = Path(sys.argv[1] if len(sys.argv) > 1 else '.').resolve()
- stats = {"files": 0, "dirs": 0, "extensions": Counter(), "ext_sizes": Counter()}
- data = scan(target, stats)
- out = Path('codebase-map.html')
- generate_html(data, stats, out)
- print(f'Generated {out.absolute()}')
- webbrowser.open(f'file://{out.absolute()}')
-
-See all 133 lines
-
-To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, which prints the generated file’s path, such as `Generated /path/to/codebase-map.html`, and opens it in your browser. If you work in a headless environment where no browser opens, the printed path confirms the script succeeded. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
+Near the start of the stream, the SDK yields a system message with subtype `init`. Check its `skills` array to confirm your Skills loaded before Claude starts working. The array lists user-invocable Skills only. A Skill with [`user-invocable: false`](</docs/en/skills#control-who-invokes-a-skill>) in its frontmatter loads and remains available to Claude but doesn’t appear in the array. To enable only specific Skills, pass their names. Names match the `name` field in `SKILL.md` or the Skill’s directory name. Use `plugin:skill` for plugin-provided Skills.
+
+Import statements from the first example are assumed in the following code snippets.
+
+Python
+
+TypeScript
+
+ options = ClaudeAgentOptions(skills=["pdf", "docx"])
+
+ const options = { skills: ["pdf", "docx"] };
+
+The list takes exact Skill names only. In the TypeScript SDK, `query()` throws before starting the Claude Code process when a name can’t work as an exact Skill name. In the Python SDK, `query()` raises `ValueError` in the same cases, for example:
+
+ * An empty name
+ * A name containing parentheses, commas, or control characters
+ * A name padded with whitespace
+ * A wildcard form such as a bare `*` or a `:*` suffix
+
+To enable every discovered Skill, pass `skills: "all"` rather than a wildcard. The `skills` option is a context filter, not a sandbox. Unlisted Skills are hidden from the model and rejected by the Skill tool, but their files remain on disk and are reachable through Read and Bash.
+
+##
+
+
+
+Creating Skills
+
+Create each Skill as a directory containing a `SKILL.md` file with YAML frontmatter and Markdown content. The `description` field determines when Claude invokes your Skill. **Example directory structure** :
+
+ .claude/skills/processing-pdfs/
+ └── SKILL.md
+
+For complete guidance on creating Skills, including SKILL.md structure, multi-file Skills, and examples, see:
+
+ * [Agent Skills in Claude Code](</docs/en/skills>): Complete guide with examples
+ * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines and naming conventions
+
+##
+
+
+
+Tool Restrictions
+
+The `allowed-tools` frontmatter field in SKILL.md is only supported when using Claude Code CLI directly. **It does not apply when using Skills through the SDK**.When using the SDK, control tool access through the main `allowedTools` option in your query configuration.
+
+To control tool access for Skills in SDK applications, use `allowedTools` to pre-approve specific tools. Without a `canUseTool` callback, anything not in the list is denied:
+
+Python
+
+TypeScript
+
+ options = ClaudeAgentOptions(
+ setting_sources=["user", "project"], # Load Skills from filesystem
+ skills="all",
+ allowed_tools=["Read", "Grep", "Glob"],
+ permission_mode="dontAsk", # Deny anything not pre-approved instead of prompting
+ )
+
+ async def main():
+ async for message in query(prompt="Analyze the codebase structure", options=options):
+ print(message)
+
+ asyncio.run(main())
+
+ for await (const message of query({
+ prompt: "Analyze the codebase structure",
+ options: {
+ settingSources: ["user", "project"], // Load Skills from filesystem
+ skills: "all",
+ allowedTools: ["Read", "Grep", "Glob"],
+ permissionMode: "dontAsk" // Deny anything not pre-approved instead of prompting
+ }
+ })) {
+ console.log(message);
+ }
+
+##
+
+
+
+Discovering Available Skills
+
+To see which Skills are available in your SDK application, ask Claude. The example below sets only the `skills` option and omits `settingSources`/`setting_sources`. When you leave `settingSources`/`setting_sources` unset, the SDK still loads Skills from the user and project sources, so the `skills` option set to `"all"` on its own makes them available to list.
+
+Python
+
+TypeScript
+
+ options = ClaudeAgentOptions(skills="all")
+
+ async def main():
+ async for message in query(prompt="What Skills are available?", options=options):
+ print(message)
+
+ asyncio.run(main())
+
+ for await (const message of query({
+ prompt: "What Skills are available?",
+ options: {
+ skills: "all"
+ }
+ })) {
+ console.log(message);
+ }
+
+Claude will list the available Skills based on your current working directory and installed plugins.
+
+##
+
+
+
+Testing Skills
+
+Test Skills by asking questions that match their descriptions:
+
+Python
+
+TypeScript
+
+ options = ClaudeAgentOptions(
+ cwd=os.getcwd(),
+ setting_sources=["user", "project"], # Load Skills from filesystem
+ skills="all",
+ allowed_tools=["Read", "Bash"],
+ )
+
+ async def main():
+ async for message in query(prompt="Extract text from invoice.pdf", options=options):
+ print(message)
+
+ asyncio.run(main())
+
+ for await (const message of query({
+ prompt: "Extract text from invoice.pdf",
+ options: {
+ cwd: process.cwd(),
+ settingSources: ["user", "project"], // Load Skills from filesystem
+ skills: "all",
+ allowedTools: ["Read", "Bash"]
+ }
+ })) {
+ console.log(message);
+ }
+
+Claude automatically invokes the relevant Skill if the description matches your request.
##
@@ -851,49 +226,104 @@
-Skill not triggering
-
-If Claude doesn’t use your skill when expected:
-
- 1. Check the description includes keywords users would naturally say
- 2. Verify the skill appears in `What skills are available?`
- 3. Try rephrasing your request to match the description more closely
- 4. Invoke it directly with `/skill-name` if the skill is user-invocable
-
-If the frontmatter YAML is malformed, Claude Code loads the skill body with empty metadata, so `/skill-name` still works but Claude has no `description` to match against. Run with `--debug` to see the parse error.
-
-###
-
-
-
-Skill triggers too often
-
-If Claude uses your skill when you don’t want it:
-
- 1. Make the description more specific
- 2. Add `disable-model-invocation: true` if you only want manual invocation
-
-###
-
-
-
-Skill descriptions are cut short
-
-Claude Code loads a listing of skill names and descriptions into context so Claude knows what’s available. The listing always contains every skill name, but if you have many skills, Claude Code shortens descriptions to fit the listing’s character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. 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. Run `/doctor` for an estimate of the listing’s context cost and its biggest contributors. When the listing exceeds its budget, Claude Code also writes a warning to the debug log, visible with [`--debug`](</docs/en/cli-reference#cli-flags>). The Skills row in `/context` reports the size of the listing after the budget is applied, so it matches what the model receives. Before v2.1.196, the row counted the full text of every description and could show a value several times larger than the configured budget. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`skillListingMaxDescChars`](</docs/en/settings#available-settings>).
-
-##
-
-
-
-Related resources
-
- * **[Debug your configuration](</docs/en/debug-your-config>)** : diagnose why a skill isn’t appearing or triggering
- * **[Evaluating skill output quality](<https://agentskills.io/skill-creation/evaluating-skills>)** : the eval file format and iteration workflow on agentskills.io
- * **[Skill authoring best practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>)** : writing guidance that applies across Claude products
- * **[Subagents](</docs/en/sub-agents>)** : delegate tasks to specialized agents
- * **[Plugins](</docs/en/plugins>)** : package and distribute skills with other extensions
- * **[Hooks](</docs/en/hooks>)** : automate workflows around tool events
- * **[Memory](</docs/en/memory>)** : manage CLAUDE.md files for persistent context
- * **[Commands](</docs/en/commands>)** : reference for built-in commands and bundled skills
- * **[Permissions](</docs/en/permissions>)** : control tool and skill access
- * **[Claude Tag skills](<https://claude.com/docs/claude-tag/admins/skills-repo>)** : project skills committed to a repo also load when that repo is used in a Claude Tag channel
+Skills Not Found
+
+**Check settingSources configuration** : Skills are discovered through the `user` and `project` setting sources. If you set `settingSources`/`setting_sources` explicitly and omit those sources, skills are not loaded:
+
+Python
+
+TypeScript
+
+ # Skills not loaded: setting_sources excludes user and project
+ options = ClaudeAgentOptions(setting_sources=[], skills="all")
+
+ # Skills loaded: user and project sources included
+ options = ClaudeAgentOptions(
+ setting_sources=["user", "project"],
+ skills="all",
+ )
+
+ // Skills not loaded: settingSources excludes user and project
+ const optionsWithoutSkills = {
+ settingSources: [],
+ skills: "all"
+ };
+
+ // Skills loaded: user and project sources included
+ const optionsWithSkills = {
+ settingSources: ["user", "project"],
+ skills: "all"
+ };
+
+For which skill directories each source loads, see the [filesystem sources table](</docs/en/agent-sdk/claude-code-features#control-filesystem-settings-with-settingsources>). For more details on `settingSources`/`setting_sources`, see the [TypeScript SDK reference](</docs/en/agent-sdk/typescript#settingsource>) or [Python SDK reference](</docs/en/agent-sdk/python#settingsource>). **Check working directory** : The SDK loads Skills from `.claude/skills/` in the `cwd` option and in every parent directory up to the repository root. Ensure `cwd` points at or below the directory containing `.claude/skills/`, within the same repository:
+
+Python
+
+TypeScript
+
+ # Ensure your cwd points to the directory containing .claude/skills/
+ options = ClaudeAgentOptions(
+ cwd="/path/to/project", # .claude/skills/ here or in a parent directory
+ setting_sources=["user", "project"], # Loads skills from these sources
+ skills="all",
+ )
+
+ // Ensure your cwd points to the directory containing .claude/skills/
+ const options = {
+ cwd: "/path/to/project", // .claude/skills/ here or in a parent directory
+ settingSources: ["user", "project"], // Loads skills from these sources
+ skills: "all"
+ };
+
+See the “Using Skills with the SDK” section above for the complete pattern. **Verify filesystem location** :
+
+ # Check project Skills
+ ls .claude/skills/*/SKILL.md
+
+ # Check personal Skills
+ ls ~/.claude/skills/*/SKILL.md
+
+###
+
+
+
+Skill Not Being Used
+
+**Check the`skills` option**: If you passed a `skills` list, confirm the skill’s name is included. Passing `[]` disables all skills. **Check the description** : Ensure it’s specific and includes relevant keywords. See [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#writing-effective-descriptions>) for guidance on writing effective descriptions.
+
+###
+
+
+
+Additional Troubleshooting
+
+For general Skills troubleshooting (YAML syntax, debugging, etc.), see the [Claude Code Skills troubleshooting section](</docs/en/skills#troubleshooting>).
+
+##
+
+
+
+Related Documentation
+
+###
+
+
+
+Skills Guides
+
+ * [Agent Skills in Claude Code](</docs/en/skills>): Complete Skills guide with creation, examples, and troubleshooting
+ * [Agent Skills Overview](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview>): Conceptual overview, benefits, and architecture
+ * [Agent Skills Best Practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>): Authoring guidelines for effective Skills
+ * [Agent Skills Cookbook](<https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction>): Example Skills and templates
+
+###
+
+
+
+SDK Resources
+
+ * [Subagents in the SDK](</docs/en/agent-sdk/subagents>): Similar filesystem-based agents with programmatic options
+ * [Slash Commands in the SDK](</docs/en/agent-sdk/slash-commands>): User-invoked commands
+ * [SDK Overview](</docs/en/agent-sdk/overview>): General SDK concepts
+ * [TypeScript SDK Reference](</docs/en/agent-sdk/typescript>): Complete API documentation
+ * [Python SDK Reference](</docs/en/agent-sdk/python>): Complete API documentation
--- a/skills.md
+++ b/skills.md
@@ -141,7 +141,7 @@
The `SKILL.md` contains the main instructions and is required. Other files are optional and let you build more powerful skills: templates for Claude to fill in, example outputs showing the expected format, scripts Claude can execute, or detailed reference documentation. Reference these files from your `SKILL.md` so Claude knows what they contain and when to load them. See Add supporting files for more details.
-Files in `.claude/commands/` still work and support the same frontmatter. Skills are recommended since they support additional features like supporting files.
+Files in `.claude/commands/` support the same frontmatter. Skills are recommended since they support additional features like supporting files.
####
@@ -206,7 +206,7 @@
2. Build the application
3. Push to the deployment target
-Your `SKILL.md` can contain anything, but thinking through how you want the skill invoked (by you, by Claude, or both) and where you want it to run (inline or in a subagent) helps guide what to include. For complex skills, you can also add supporting files to keep the main skill focused. Keep the body itself concise. Once a skill loads, its content stays in context across turns, so every line is a recurring token cost. State what to do rather than narrating how or why, and apply the same conciseness test you would for [CLAUDE.md content](</docs/en/best-practices#write-an-effective-claude-md>).
+Keep the body itself concise. Once a skill loads, its content stays in context across turns, so every line is a recurring token cost. State what to do rather than narrating how or why, and apply the same conciseness test you would for [CLAUDE.md content](</docs/en/best-practices#write-an-effective-claude-md>).
###
@@ -238,7 +238,7 @@
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See Pre-approve tools for a skill.
`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message. Like deny rules, the field can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains.
-`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model.
+`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model. With `context: fork`, the value sets the forked subagent’s model instead, and an excluded value follows the [same rules as a subagent model override](</docs/en/model-config#restrict-model-selection>).
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
`agent`| No| Which subagent type to use when `context: fork` is set.
@@ -316,7 +316,7 @@
Run `${CLAUDE_SKILL_DIR}/scripts/render.sh <csv-file>` to render the chart.
-If this skill is installed at `~/.claude/skills/render-chart/`, both occurrences of `${CLAUDE_SKILL_DIR}` expand to that directory. The `allowed-tools` rule then matches the exact command the skill body tells Claude to run, so the script runs without prompting. The `allowed-tools` substitution for `${CLAUDE_SKILL_DIR}` requires Claude Code v2.1.129 or later. On earlier versions the rule stays a literal `${CLAUDE_SKILL_DIR}` string and never matches, so the command still prompts for permission. The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
+If this skill is installed at `~/.claude/skills/render-chart/`, both occurrences of `${CLAUDE_SKILL_DIR}` expand to that directory. The `allowed-tools` rule then matches the exact command the skill body tells Claude to run, so the script runs without prompting. The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
--- a/skills.md
+++ b/skills.md
@@ -565,7 +565,7 @@
Restrict Claude’s skill access
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init` and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
# Add to deny rules:
Skill
--- a/skills.md
+++ b/skills.md
@@ -2,7 +2,7 @@
For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
-Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
+Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection. See Using skill frontmatter outside Claude Code for which frontmatter fields are part of the standard and which are Claude Code extensions.
##
@@ -246,6 +246,28 @@
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere.
+`metadata`| No| Free-form YAML map for your own key-value data, such as entitlement or catalog fields, read by your own tooling from `SKILL.md`. Claude Code doesn’t act on its contents, and drops a value that isn’t a map. Don’t reuse frontmatter field names such as `paths` as keys.
+`license`| No| License covering the skill. Part of the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Claude Code accepts the field but doesn’t act on it.
+`compatibility`| No| Environment requirements for the skill, such as intended products or system prerequisites, as defined by the [Agent Skills](<https://agentskills.io>) spec; see Using skill frontmatter outside Claude Code. Accepts a string of up to 500 characters. Claude Code accepts the field but doesn’t act on it.
+
+####
+
+
+
+Using skill frontmatter outside Claude Code
+
+Claude Code accepts every field in the table above. Outside Claude Code, you can use only the fields in the [Agent Skills](<https://agentskills.io>) spec:
+
+Distribution path| Frontmatter fields you can use
+---|---
+Claude Code skills at any level, including [plugin](</docs/en/plugins>) skills| Every field in the table above
+claude.ai skill uploads, the Skills API, and packaging with `package_skill.py` from [anthropics/skills](<https://github.com/anthropics/skills>)| `name`, `description`, `license`, `compatibility`, `metadata`, `allowed-tools`
+
+When you enable a personal skill for Cowork and cloud sessions, including routines, you upload it to claude.ai, so the same rules apply. If you include any field the spec doesn’t allow, packaging or upload fails with a hard error instead of ignoring the field:
+
+ Unexpected key(s) in SKILL.md frontmatter: argument-hint. Allowed properties are: allowed-tools, compatibility, description, license, metadata, name
+
+Restricting frontmatter to the spec’s six fields avoids the unexpected-key error above. The [Agent Skills spec](<https://agentskills.io>) and the [Skills API requirements](<https://docs.claude.com/en/api/skills-guide>) define everything else those paths validate. Claude Code-only body features, such as dynamic context injection, don’t function in claude.ai chat or through the API. Claude Code accepts all six fields, so frontmatter that follows the spec loads in Claude Code without changes.
####
@@ -355,7 +377,7 @@
3. Push to the deployment target
4. Verify the deployment succeeded
-Here’s how the two fields affect invocation and context loading:
+If Claude tries anyway, Claude Code blocks the call and instructs it not to reproduce the deploy steps another way, so expect Claude to suggest running `/deploy` yourself. Here’s how the two fields affect invocation and context loading:
Frontmatter| You can invoke| Claude can invoke| When loaded into context
---|---|---|---
--- a/skills.md
+++ b/skills.md
@@ -263,7 +263,7 @@
Plugin `skills/` subdirectory| Frontmatter `name` or the directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`, or `/my-plugin:fancy` with `name: fancy`
Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>)
-In a plugin skill, the frontmatter `name` replaces the directory name in the last segment of the command, so `my-plugin/skills/review/SKILL.md` with `name: fancy` becomes `/my-plugin:fancy`. The bare `/fancy` also invokes the skill unless another command already uses that name. Before v2.1.216, the frontmatter name replaced the whole command name, so the menu showed `/fancy` without the plugin prefix and `/my-plugin:fancy` didn’t autocomplete. For a plugin-root `SKILL.md`, there is no skill directory to take the name from, so `name` supplies the whole final segment. Without a `name` field, Claude Code falls back to the plugin’s directory name.
+In a plugin skill, the frontmatter `name` replaces the directory name in the last segment of the command, so `my-plugin/skills/review/SKILL.md` with `name: fancy` becomes `/my-plugin:fancy`. The bare `/fancy` also invokes the skill unless another command already uses that name. Before v2.1.216, the frontmatter name replaced the whole command name, so the menu showed `/fancy` without the plugin prefix and `/my-plugin:fancy` didn’t autocomplete. In [non-interactive sessions](</docs/en/headless>), Claude Code doesn’t reserve the names `help` and `feedback` for their terminal-only built-in commands, so a plugin skill with one of those names keeps its bare command there. Claude Code still reserves the name of every other terminal-only built-in, such as `/login`, even though the command can’t run in those sessions. From v2.1.216 through v2.1.220, `help` and `feedback` were reserved too, so a plugin skill with one of those names was invocable only by its namespaced command in non-interactive sessions. For a plugin-root `SKILL.md`, there is no skill directory to take the name from, so `name` supplies the whole final segment. Without a `name` field, Claude Code falls back to the plugin’s directory name.
####
@@ -605,7 +605,12 @@
/plugin install skill-creator@claude-plugins-official
-If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
+If the install fails, match the message Claude Code reports:
+
+ * `Marketplace "claude-plugins-official" not found`: add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`, then retry the install.
+ * The plugin is not found in the marketplace: check the plugin name. Claude Code [refreshes a stale marketplace catalog and retries](</docs/en/discover-plugins#install-plugins>) before reporting this, so if you turned off [marketplace auto-update](</docs/en/discover-plugins#configure-auto-updates>), refresh manually with `/plugin marketplace update claude-plugins-official` and retry the install.
+
+If the install summary reports `Run /reload-plugins to activate.`, run that command to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
* **Test cases** : stores prompts, input files, and expected behavior in `evals/evals.json` inside the skill directory
* **Isolated runs** : spawns a [subagent](</docs/en/sub-agents>) per test case so each run starts with a clean context, and records token count and duration
--- a/skills.md
+++ b/skills.md
@@ -119,7 +119,7 @@
Live change detection
-Claude Code watches skill directories for file changes. Adding, editing, or removing a skill under `~/.claude/skills/`, the project `.claude/skills/`, or a `.claude/skills/` inside an `--add-dir` directory takes effect within the current session without restarting. Creating a top-level skills directory that did not exist when the session started requires restarting Claude Code so the new directory can be watched.
+Claude Code watches skill directories for file changes. When you add, edit, or remove a skill under `~/.claude/skills/`, the project `.claude/skills/`, or a `.claude/skills/` inside an `--add-dir` directory, Claude Code picks up the change within the current session, without a restart. If you create a top-level skills directory that didn’t exist when the session started, restart Claude Code so it can watch the new directory.
Live change detection covers `SKILL.md` text only. For a skill folder that is also a [plugin](</docs/en/plugins-reference#skills-directory-plugins>), changes to `hooks/`, `.mcp.json`, `agents/`, and `output-styles/` need `/reload-plugins` to take effect.
--- a/skills.md
+++ b/skills.md
@@ -30,7 +30,7 @@
`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks
`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project
-All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes.
+All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes. `/verify` can also record its own recipe. When it has to build and drive your app without a recorded recipe, it writes what worked to `.claude/skills/verify/SKILL.md` at the repo root, or in the touched package directory in a monorepo, so later runs and other agents follow the same steps. At the repo root, the recorded skill replaces the bundled `/verify`. This requires Claude Code v2.1.200 or later. Claude edits the recorded file only when it steered a run wrong, such as a command that failed or a missing step, so you can commit the file without per-session diffs. Before v2.1.205, the bundled skill told Claude to fold in anything a run learned, which caused frequent merge conflicts.
##
@@ -127,9 +127,9 @@
-Automatic discovery from parent and nested directories
-
-Project skills load from `.claude/skills/` in your starting directory and in every parent directory up to the repository root, so starting Claude in a subdirectory still picks up skills defined at the root. When you work with files in subdirectories below your starting directory, Claude Code also discovers skills from nested `.claude/skills/` directories on demand. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
+Discovery from parent and nested directories
+
+Project skills load from `.claude/skills/` in the directory where you start Claude Code and in every parent directory up to the repository root. Starting Claude in a subdirectory still picks up skills defined at the root. To load skills from a directory outside that path at startup, pass it with [`--add-dir`](</docs/en/cli-reference>). Claude Code reads `.claude/skills/` inside each added directory alongside the project skills. Skills in nested `.claude/skills/` directories below your starting directory aren’t loaded at startup. They load the first time Claude reads or edits a file inside that subdirectory, and stay available for the rest of the session. For example, after Claude edits a file under `packages/frontend/`, skills in `packages/frontend/.claude/skills/` become available. Until then, those skills don’t appear in autocomplete and can’t be invoked by name. Each skill is a directory with `SKILL.md` as the entrypoint:
my-skill/
├── SKILL.md # Main instructions (required)
@@ -159,10 +159,10 @@
Skills in Cowork and cloud sessions
-[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/claude-code-on-the-web#the-cloud-environment>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
+[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/cloud-environments#what-carries-over-from-your-setup>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
* For Cowork and cloud sessions, enable the skill for your claude.ai account.
- * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/claude-code-on-the-web#what%E2%80%99s-available-in-cloud-sessions>); plugins enabled only in your user settings don’t transfer.
+ * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/cloud-environments#what-carries-over-from-your-setup>); plugins enabled only in your user settings don’t transfer.
[Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) are different: they run locally on your machine and load skills from the same locations as any other local session.
--- a/skills.md
+++ b/skills.md
@@ -487,7 +487,7 @@
Run skills in a subagent
-Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history. The forked subagent runs in the [background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): you keep working while it runs, and its result arrives in your conversation when it completes. Set `background: false` in the frontmatter to instead wait for the result in the turn that invoked the skill. Before v2.1.218, forked skills always blocked the turn until they finished. Claude Code also waits for the result, even when the skill doesn’t set `background: false`, in these cases:
+Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history. The forked subagent runs in the [background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): you keep working while it runs, and its result arrives in your conversation when it completes. Set `background: false` in the frontmatter to instead wait for the result in the turn that invoked the skill. Before v2.1.218, forked skills always blocked the turn until they finished. Claude Code also waits for the result, even when the skill doesn’t set `background: false`, in cases like these:
* In non-interactive mode, with the `-p` flag or the Agent SDK
* When you set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, which also turns off all other background task features
--- a/skills.md
+++ b/skills.md
@@ -225,7 +225,7 @@
Your skill instructions here...
-All fields are optional. Only `description` is recommended so Claude knows when to use the skill.
+All fields are optional. Only `description` is recommended so Claude knows when to use the skill. Boolean fields accept `yes`, `no`, `on`, `off`, `1`, and `0` in any letter case, in addition to `true` and `false`. Before v2.1.218, Claude Code recognized only `true` and `false`.
Field| Required| Description
---|---|---
@@ -242,6 +242,7 @@
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
`agent`| No| Which subagent type to use when `context: fork` is set.
+`background`| No| Only applies with `context: fork`. Set to `false` to wait for the forked subagent’s result in the turn that invoked the skill, instead of running it in the background. Default: `true`. Requires Claude Code v2.1.218 or later.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere.
@@ -411,7 +412,7 @@
4. Write tests
5. Create a commit
-When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. You can also stack several skills at the start of one message. As of v2.1.199, typing `/code-review /fix-issue 123` loads both skills and passes the trailing text `123` as `$ARGUMENTS` to each of them. In earlier versions, only the first skill loaded and received `/fix-issue 123` as literal argument text. Claude Code expands the first skill plus up to five more stacked after it. Expansion stops at the first token that isn’t an inline user-invocable skill, so a skill that runs as a forked subagent or one whose arguments may themselves start with a slash command, such as `/loop`, also ends the run there; that token and everything after it become the argument text for every expanded skill. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
+When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. You can also stack several skills at the start of one message. Typing `/write-tests /fix-issue 123` loads both skills and passes the trailing text `123` as `$ARGUMENTS` to each of them. Before v2.1.199, only the first skill loaded and received `/fix-issue 123` as literal argument text. Claude Code expands the first skill plus up to five more stacked after it. Expansion stops at the first token that isn’t an inline user-invocable skill, so a skill that runs as a forked subagent, such as [`/code-review`](</docs/en/code-review#review-a-diff-locally>), or one whose arguments may themselves start with a slash command, such as `/loop`, also ends the run there. That token and everything after it become the argument text for every expanded skill. `/code-review` runs as a forked subagent from v2.1.218; on earlier versions it ran inline and stacked. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
---
name: migrate-component
@@ -486,7 +487,14 @@
Run skills in a subagent
-Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history.
+Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history. The forked subagent runs in the [background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): you keep working while it runs, and its result arrives in your conversation when it completes. Set `background: false` in the frontmatter to instead wait for the result in the turn that invoked the skill. Before v2.1.218, forked skills always blocked the turn until they finished. Claude Code also waits for the result, even when the skill doesn’t set `background: false`, in these cases:
+
+ * In non-interactive mode, with the `-p` flag or the Agent SDK
+ * When you set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](</docs/en/env-vars>) to `1`, which also turns off all other background task features
+ * When you invoke a forked skill while an earlier invocation of the same skill is still running
+ * When a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt
+
+A backgrounded fork also runs with the [narrower tool set that applies to background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>): the skill’s subagent is a regular agent type, so the exemption for subagents that fork the conversation doesn’t cover it. If your skill’s steps depend on a tool outside that set, set `background: false` to keep the full tool set. A forked skill that runs in the background applies its edits outside your session’s [checkpoints](</docs/en/checkpointing>), so `/rewind` doesn’t undo them; use git to revert them.
`context: fork` only makes sense for skills with explicit instructions. If your skill contains guidelines like “use these API conventions” without a task, the subagent receives the guidelines but no actionable prompt, and returns without meaningful output.
@@ -525,7 +533,7 @@
1. A new isolated context is created
2. The subagent receives the skill content as its prompt (“Research $ARGUMENTS thoroughly…”)
3. The `agent` field determines the execution environment (model, tools, and permissions)
- 4. Results are summarized and returned to your main conversation
+ 4. The subagent summarizes its results and returns them to your main conversation when it finishes
The `agent` field specifies which subagent configuration to use. Options include built-in agents (`Explore`, `Plan`, `general-purpose`) or any custom subagent from `.claude/agents/`. If omitted, uses `general-purpose`.
--- a/skills.md
+++ b/skills.md
@@ -10,7 +10,11 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session unless disabled with the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, including `/doctor`, `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. The [`/doctor`](</docs/en/commands#all-commands>) setup checkup is the one exception to `disableBundledSkills` in Claude Code v2.1.205 and later: it stays typable when the setting is on. To hide it, set the `DISABLE_DOCTOR_COMMAND` environment variable or a `skillOverrides` entry of `"doctor": "off"`. Before v2.1.205, `/doctor` was a built-in command rather than a bundled skill. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills, such as `/doctor`, `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. Most built-in commands instead execute fixed logic directly. You invoke a bundled skill the same way as any other skill, by typing `/` followed by the skill name. Claude invokes some bundled skills automatically when relevant; others, including `/verify` and `/code-review`, run only when you invoke them, which keeps you in control of when these longer-running checks spend time and tokens. Before v2.1.215, Claude could also run `/verify` and `/code-review` on its own. Bundled skills are available in every session. To turn them off, use the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, which disables every bundled skill except `/doctor`.
+
+The [`/doctor`](</docs/en/commands#all-commands>) setup checkup stays typable when `disableBundledSkills` is on, in Claude Code v2.1.205 and later. To hide it, set the `DISABLE_DOCTOR_COMMAND` environment variable or a `skillOverrides` entry of `"doctor": "off"`. Before v2.1.205, `/doctor` was a built-in command rather than a bundled skill.
+
+Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
###
@@ -225,7 +229,7 @@
Field| Required| Description
---|---|---
-`name`| No| Display name shown in skill listings. Defaults to the directory name. See How a skill gets its command name for how this differs from the name you type to invoke the skill.
+`name`| No| Display name shown in skill listings. Defaults to the directory name. See How a skill gets its command name for how the field interacts with the name you type to invoke the skill.
`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Put the key use case first: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
@@ -248,17 +252,17 @@
How a skill gets its command name
-The command you type to invoke a skill comes from where the skill file lives. The frontmatter `name` field sets the display label shown in skill listings and, except for a plugin-root `SKILL.md`, does not change what you type after `/`. The table below shows where the command name comes from for each layout:
+The command you type to invoke a skill comes from where the skill file lives and, for plugin skills, also from the frontmatter `name` field. In a personal or project skill, `name` sets only the display label shown in skill listings, and the command still comes from the directory or file name. In a plugin skill, `name` sets the last segment of the command and the plugin prefix stays in place. The table below shows where the command name comes from for each layout:
Skill location| Command name source| Example
---|---|---
Skill directory under `~/.claude/skills/` or `.claude/skills/`| Directory name| `.claude/skills/deploy-staging/SKILL.md` → `/deploy-staging`
Nested `.claude/skills/` directory, when the name clashes with another skill| Subdirectory path relative to the working directory, then the skill directory name| `apps/web/.claude/skills/deploy/SKILL.md` → `/apps/web:deploy`
File under `.claude/commands/`| File name without extension| `.claude/commands/deploy.md` → `/deploy`
-Plugin `skills/` subdirectory| Directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`
+Plugin `skills/` subdirectory| Frontmatter `name` or the directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`, or `/my-plugin:fancy` with `name: fancy`
Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>)
-The plugin-root case is the one place where `name` does set the command name, because there is no skill directory to take it from. If `name` is not set in the frontmatter, the plugin’s directory name is used instead.
+In a plugin skill, the frontmatter `name` replaces the directory name in the last segment of the command, so `my-plugin/skills/review/SKILL.md` with `name: fancy` becomes `/my-plugin:fancy`. The bare `/fancy` also invokes the skill unless another command already uses that name. Before v2.1.216, the frontmatter name replaced the whole command name, so the menu showed `/fancy` without the plugin prefix and `/my-plugin:fancy` didn’t autocomplete. For a plugin-root `SKILL.md`, there is no skill directory to take the name from, so `name` supplies the whole final segment. Without a `name` field, Claude Code falls back to the plugin’s directory name.
####
--- a/skills.md
+++ b/skills.md
@@ -233,7 +233,7 @@
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). As of v2.1.196, also prevents the skill from running when a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See Pre-approve tools for a skill.
-`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
+`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message. Like deny rules, the field can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains.
`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
@@ -279,7 +279,17 @@
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
`${CLAUDE_PROJECT_DIR}`| The project root directory. This is the same path [hooks](</docs/en/hooks#reference-scripts-by-path>) and MCP servers receive as `CLAUDE_PROJECT_DIR`. Use this to reference project-local scripts or files, such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/helper.sh`, independent of where the skill is installed.
-The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
+Claude Code substitutes `${CLAUDE_SKILL_DIR}` and `${CLAUDE_PROJECT_DIR}` in two places: the skill’s markdown content, and Bash rules in the `allowed-tools` frontmatter. Using the same variable in both places lets a skill run a bundled script without a permission prompt. The following skill shows the pattern:
+
+ ---
+ name: render-chart
+ description: Render a chart from a CSV file
+ allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/render.sh *)
+ ---
+
+ Run `${CLAUDE_SKILL_DIR}/scripts/render.sh <csv-file>` to render the chart.
+
+If this skill is installed at `~/.claude/skills/render-chart/`, both occurrences of `${CLAUDE_SKILL_DIR}` expand to that directory. The `allowed-tools` rule then matches the exact command the skill body tells Claude to run, so the script runs without prompting. The `allowed-tools` substitution for `${CLAUDE_SKILL_DIR}` requires Claude Code v2.1.129 or later. On earlier versions the rule stays a literal `${CLAUDE_SKILL_DIR}` string and never matches, so the command still prompts for permission. The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
@@ -373,7 +383,7 @@
allowed-tools: Bash(git add *) Bash(git commit *) Bash(git status *)
---
-To remove tools from Claude’s available pool while a skill is active, list them in `disallowed-tools` in the skill’s frontmatter. The restriction clears when you send your next message. To block tools across all skills and prompts, add deny rules in your [permission settings](</docs/en/permissions>).
+To remove tools from Claude’s available pool while a skill is active, list them in `disallowed-tools` in the skill’s frontmatter. The restriction clears when you send your next message. Like deny rules, the field can’t remove [`EndConversation`](</docs/en/tools-reference#endconversation-tool-behavior>) while any other tool remains. To block tools across all skills and prompts, add deny rules in your [permission settings](</docs/en/permissions>).
###
--- a/skills.md
+++ b/skills.md
@@ -148,6 +148,19 @@
The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as commands and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
+
+####
+
+
+
+Skills in Cowork and cloud sessions
+
+[Cowork](<https://claude.com/product/cowork>) sessions and [cloud sessions](</docs/en/claude-code-on-the-web#the-cloud-environment>), including [routines](</docs/en/routines>), don’t read `~/.claude/skills/` on your machine. Both interactive and scheduled Cowork sessions load the skills enabled for your claude.ai account, synced at session start; manage them from **Customize** in the Desktop app sidebar or from the skills settings on claude.ai. Cloud sessions additionally load project skills committed to the cloned repository’s `.claude/skills/`. If a skill exists only in `~/.claude/skills/` on your machine, Claude Code reports that the skill was not found when a [routine](</docs/en/routines>) invokes it, because each routine run starts as a fresh remote session. To make a personal skill available in these sessions:
+
+ * For Cowork and cloud sessions, enable the skill for your claude.ai account.
+ * For cloud sessions, you can instead commit the skill to the repository’s `.claude/skills/`, or ship it in a plugin declared in the repository’s `.claude/settings.json`. Repo-declared plugins [install at session start](</docs/en/claude-code-on-the-web#what%E2%80%99s-available-in-cloud-sessions>); plugins enabled only in your user settings don’t transfer.
+
+[Desktop scheduled tasks](</docs/en/desktop-scheduled-tasks>) are different: they run locally on your machine and load skills from the same locations as any other local session.
##
@@ -777,7 +790,7 @@
See all 133 lines
-To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, which prints the generated file’s path, such as `Generated /path/to/codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
+To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, which prints the generated file’s path, such as `Generated /path/to/codebase-map.html`, and opens it in your browser. If you work in a headless environment where no browser opens, the printed path confirms the script succeeded. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
##
Show diff (111 lines)
--- a/skills.md
+++ b/skills.md
@@ -26,7 +26,7 @@
`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks
`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project
-All three skills require Claude Code v2.1.145 or later. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes.
+All three skills require Claude Code v2.1.145 or later. Check your version with `claude --version` or the `/status` command. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes.
##
@@ -175,7 +175,7 @@
- Return consistent error formats
- Include request validation
-**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically.
+**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically. The example below adds `context: fork`, which runs the skill in its own subagent context; see Run skills in a subagent.
---
name: deploy
@@ -219,15 +219,15 @@
`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). As of v2.1.196, also prevents the skill from running when a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
-`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list.
+`allowed-tools`| No| Tools Claude can use without asking permission during the turn that invokes this skill. The grant clears when you send your next message. Accepts a space- or comma-separated string, or a YAML list. See Pre-approve tools for a skill.
`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
-`context`| No| Set to `fork` to run in a forked subagent context.
+`context`| No| Set to `fork` to run in a forked subagent context. See Run skills in a subagent.
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
-`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
+`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell when the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) is enabled: it’s on by default on Windows without Git Bash, and `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` enables it elsewhere.
####
@@ -266,7 +266,7 @@
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
`${CLAUDE_PROJECT_DIR}`| The project root directory. This is the same path [hooks](</docs/en/hooks#reference-scripts-by-path>) and MCP servers receive as `CLAUDE_PROJECT_DIR`. Use this to reference project-local scripts or files, such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/helper.sh`, independent of where the skill is installed.
-The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
+The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. An indexed placeholder with no corresponding argument, such as `$2` when only one argument was passed, stays in the content unchanged. A named placeholder from the `arguments` frontmatter with no matching argument expands to an empty string. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
@@ -343,7 +343,7 @@
Skill content lifecycle
-When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
+When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. This persistence applies to the skill’s instructions, not its permissions: an `allowed-tools` grant clears when you send your next message. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
###
@@ -351,7 +351,7 @@
Pre-approve tools for a skill
-The `allowed-tools` field grants permission for the listed tools while the skill is active, so Claude can use them without prompting you for approval. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
+The `allowed-tools` field grants permission for the listed tools during the turn that invokes the skill, so Claude can use them without prompting you for approval. The grant clears when you send your next message, even though the skill content stays in context; invoking the skill again re-applies it for that turn. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. To pre-approve tools for the whole session rather than a single turn, add allow rules to those permission settings instead. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
---
name: commit
@@ -508,7 +508,7 @@
Restrict Claude’s skill access
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval during the turn that invokes the skill; the grant clears when you send your next message. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
# Add to deny rules:
Skill
@@ -532,7 +532,7 @@
Override skill visibility from settings
-The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo or provided by an MCP server. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
+The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
Value| Listed to Claude| In `/` menu
---|---|---
@@ -541,7 +541,7 @@
`"user-invocable-only"`| Hidden| Yes
`"off"`| Hidden| Hidden
-As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
+The `/skills` menu labels the `"user-invocable-only"` state `user-only`. As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
{
"skillOverrides": {
@@ -570,7 +570,7 @@
/plugin install skill-creator@claude-plugins-official
-If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
+If Claude Code reports `Marketplace "claude-plugins-official" not found`, add the marketplace with `/plugin marketplace add anthropics/claude-plugins-official`. If it reports that the plugin is not found in the marketplace, your local copy is outdated: refresh it with `/plugin marketplace update claude-plugins-official`. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
* **Test cases** : stores prompts, input files, and expected behavior in `evals/evals.json` inside the skill directory
* **Isolated runs** : spawns a [subagent](</docs/en/sub-agents>) per test case so each run starts with a clean context, and records token count and duration
@@ -777,7 +777,7 @@
See all 133 lines
-To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, generates `codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
+To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, which prints the generated file’s path, such as `Generated /path/to/codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
##
--- a/skills.md
+++ b/skills.md
@@ -312,7 +312,7 @@
* **`disable-model-invocation: true`** : Only you can invoke the skill. Use this for workflows with side effects or that you want to control timing, like `/commit`, `/deploy`, or `/send-slack-message`. You don’t want Claude deciding to deploy because your code looks ready.
* **`user-invocable: false`** : Only Claude can invoke the skill. Use this for background knowledge that isn’t actionable as a command. A `legacy-system-context` skill explains how an old system works. Claude should know this when relevant, but `/legacy-system-context` isn’t a meaningful action for users to take.
-This example creates a deploy skill that only you can trigger. The `disable-model-invocation: true` field prevents Claude from running it automatically:
+This example creates a deploy skill that only you can trigger. If you set `disable-model-invocation: true`, Claude can’t run the skill automatically:
---
name: deploy
--- a/skills.md
+++ b/skills.md
@@ -10,7 +10,7 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session unless disabled with the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, including `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills that are available in every session unless disabled with the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, including `/doctor`, `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. The [`/doctor`](</docs/en/commands#all-commands>) setup checkup is the one exception to `disableBundledSkills` in Claude Code v2.1.205 and later: it stays typable when the setting is on. To hide it, set the `DISABLE_DOCTOR_COMMAND` environment variable or a `skillOverrides` entry of `"doctor": "off"`. Before v2.1.205, `/doctor` was a built-in command rather than a bundled skill. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
###
@@ -817,7 +817,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see how many skill descriptions are being shortened or dropped and which skills are affected. As of v2.1.196, the Skills row in `/context` reports the size of the listing after the budget is applied, so it matches what the model receives. Earlier versions counted the full text of every description, so the row could show a value several times larger than the budget `/doctor` reports. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`skillListingMaxDescChars`](</docs/en/settings#available-settings>).
+Claude Code loads a listing of skill names and descriptions into context so Claude knows what’s available. The listing always contains every skill name, but if you have many skills, Claude Code shortens descriptions to fit the listing’s character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. 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. Run `/doctor` for an estimate of the listing’s context cost and its biggest contributors. When the listing exceeds its budget, Claude Code also writes a warning to the debug log, visible with [`--debug`](</docs/en/cli-reference#cli-flags>). The Skills row in `/context` reports the size of the listing after the budget is applied, so it matches what the model receives. Before v2.1.196, the row counted the full text of every description and could show a value several times larger than the configured budget. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`skillListingMaxDescChars`](</docs/en/settings#available-settings>).
##
--- a/skills.md
+++ b/skills.md
@@ -105,7 +105,7 @@
* Its description says which directory it applies to.
* Claude picks the variant that matches the files it is working on.
-Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly. A `<skill-name>` entry in the enterprise, personal, or project locations can be a symlink to a directory elsewhere on disk. Claude Code follows the symlink and reads `SKILL.md` from the target directory, and if the same target is reachable from more than one location, Claude Code loads the skill once. Plugin skills handle symlinks differently; see [Share files within a marketplace with symlinks](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>).
+Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly. When you or Claude invoke the unqualified name, the project-root skill loads, and Claude Code appends a list of the directory-qualified variants to its content with an instruction to also invoke any variant whose directory holds the files Claude is working on. A nested skill therefore still applies to work in its directory when only the unqualified name is invoked. Requires Claude Code v2.1.203 or later. A `<skill-name>` entry in the enterprise, personal, or project locations can be a symlink to a directory elsewhere on disk. Claude Code follows the symlink and reads `SKILL.md` from the target directory, and if the same target is reachable from more than one location, Claude Code loads the skill once. Plugin skills handle symlinks differently; see [Share files within a marketplace with symlinks](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>).
Add a `.claude-plugin/plugin.json` to a skill folder and it loads as a [plugin](</docs/en/plugins-reference#skills-directory-plugins>) named `<name>@skills-dir`, so it can bundle agents, hooks, and MCP servers. In a project’s `.claude/skills/`, this requires accepting the workspace trust dialog first.
--- a/skills.md
+++ b/skills.md
@@ -343,7 +343,7 @@
Skill content lifecycle
-When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
+When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. When Claude re-invokes a skill whose rendered content is identical to the copy already in context, Claude Code adds a short note that the skill is already loaded rather than a second copy of the content. When the rendered content differs, because the arguments changed or a dynamic context command produced new output, Claude Code appends the full content again. Before v2.1.202, every re-invocation appended another full copy of the skill’s instructions. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
###
--- a/skills.md
+++ b/skills.md
@@ -384,7 +384,7 @@
4. Write tests
5. Create a commit
-When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
+When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. You can also stack several skills at the start of one message. As of v2.1.199, typing `/code-review /fix-issue 123` loads both skills and passes the trailing text `123` as `$ARGUMENTS` to each of them. In earlier versions, only the first skill loaded and received `/fix-issue 123` as literal argument text. Claude Code expands the first skill plus up to five more stacked after it. Expansion stops at the first token that isn’t an inline user-invocable skill, so a skill that runs as a forked subagent or one whose arguments may themselves start with a slash command, such as `/loop`, also ends the run there; that token and everything after it become the argument text for every expanded skill. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
---
name: migrate-component
@@ -541,7 +541,7 @@
`"user-invocable-only"`| Hidden| Yes
`"off"`| Hidden| Hidden
-A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
+As of v2.1.199, `"off"` also hides the skill from the command lists advertised to [Remote Control](</docs/en/remote-control>) clients and to [Agent SDK](</docs/en/agent-sdk/slash-commands>) callers, not only the terminal `/` menu. Invoking a hidden skill by its full name still returns the `skillOverrides` error instead of running it. A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
{
"skillOverrides": {
--- a/skills.md
+++ b/skills.md
@@ -105,7 +105,7 @@
* Its description says which directory it applies to.
* Claude picks the variant that matches the files it is working on.
-Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly.
+Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly. A `<skill-name>` entry in the enterprise, personal, or project locations can be a symlink to a directory elsewhere on disk. Claude Code follows the symlink and reads `SKILL.md` from the target directory, and if the same target is reachable from more than one location, Claude Code loads the skill once. Plugin skills handle symlinks differently; see [Share files within a marketplace with symlinks](</docs/en/plugins-reference#share-files-within-a-marketplace-with-symlinks>).
Add a `.claude-plugin/plugin.json` to a skill folder and it loads as a [plugin](</docs/en/plugins-reference#skills-directory-plugins>) named `<name>@skills-dir`, so it can bundle agents, hooks, and MCP servers. In a project’s `.claude/skills/`, this requires accepting the workspace trust dialog first.
--- a/skills.md
+++ b/skills.md
@@ -217,7 +217,7 @@
`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
-`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). Default: `false`.
+`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). As of v2.1.196, also prevents the skill from running when a [scheduled task](</docs/en/scheduled-tasks>) fires with the skill as its prompt. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list.
`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
@@ -264,8 +264,9 @@
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
-
-Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
+`${CLAUDE_PROJECT_DIR}`| The project root directory. This is the same path [hooks](</docs/en/hooks#reference-scripts-by-path>) and MCP servers receive as `CLAUDE_PROJECT_DIR`. Use this to reference project-local scripts or files, such as `${CLAUDE_PROJECT_DIR}/.claude/hooks/helper.sh`, independent of where the skill is installed.
+
+The `${CLAUDE_PROJECT_DIR}` substitution requires Claude Code v2.1.196 or later. It applies to both the skill body and the `allowed-tools` frontmatter, so a permission rule like `Bash(${CLAUDE_PROJECT_DIR}/scripts/lint.sh *)` resolves to the same path the skill body uses. Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
@@ -816,7 +817,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see how many skill descriptions are being shortened or dropped and which skills are affected. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`maxSkillDescriptionChars`](</docs/en/settings#available-settings>).
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see how many skill descriptions are being shortened or dropped and which skills are affected. As of v2.1.196, the Skills row in `/context` reports the size of the listing after the budget is applied, so it matches what the model receives. Earlier versions counted the full text of every description, so the row could show a value several times larger than the budget `/doctor` reports. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`skillListingMaxDescChars`](</docs/en/settings#available-settings>).
##
--- a/skills.md
+++ b/skills.md
@@ -221,7 +221,7 @@
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list.
`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
-`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model.
+`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model. A value excluded by your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist is not used and the session keeps its current model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context.
`agent`| No| Which subagent type to use when `context: fork` is set.
--- a/skills.md
+++ b/skills.md
@@ -833,3 +833,4 @@
* **[Memory](</docs/en/memory>)** : manage CLAUDE.md files for persistent context
* **[Commands](</docs/en/commands>)** : reference for built-in commands and bundled skills
* **[Permissions](</docs/en/permissions>)** : control tool and skill access
+ * **[Claude Tag skills](<https://claude.com/docs/claude-tag/admins/skills-repo>)** : project skills committed to a repo also load when that repo is used in a Claude Tag channel
--- a/skills.md
+++ b/skills.md
@@ -797,6 +797,8 @@
3. Try rephrasing your request to match the description more closely
4. Invoke it directly with `/skill-name` if the skill is user-invocable
+If the frontmatter YAML is malformed, Claude Code loads the skill body with empty metadata, so `/skill-name` still works but Claude has no `description` to match against. Run with `--debug` to see the parse error.
+
###
--- a/skills.md
+++ b/skills.md
@@ -145,7 +145,7 @@
Skills from additional directories
-The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
+The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as commands and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
@@ -550,6 +550,36 @@
}
Plugin skills are not affected by `skillOverrides`. Manage those through `/plugin` instead.
+
+##
+
+
+
+Evaluate and iterate on a skill
+
+Seeing a skill trigger tells you Claude found it, not that it did what you intended. To know a skill is working, measure two things separately: whether Claude invokes it on the prompts it should, and whether the output matches what you expect when it does. The check for both is a baseline comparison. Collect a few realistic prompts, run each one in a fresh session with the skill available and again with it disabled, and compare the results. A fresh session matters because leftover context from authoring the skill will mask gaps in the written instructions.
+
+###
+
+
+
+Run evals with skill-creator
+
+The [`skill-creator` plugin](<https://github.com/anthropics/claude-plugins-official/tree/main/plugins/skill-creator>) automates the comparison loop inside Claude Code. Install it from the official marketplace:
+
+ /plugin install skill-creator@claude-plugins-official
+
+If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install. After installing, run `/reload-plugins` to make the plugin’s skills available in the current session. Then ask Claude to evaluate an existing skill, for example `evaluate my summarize-changes skill with skill-creator`. The plugin walks you through writing test cases and runs the loop:
+
+ * **Test cases** : stores prompts, input files, and expected behavior in `evals/evals.json` inside the skill directory
+ * **Isolated runs** : spawns a [subagent](</docs/en/sub-agents>) per test case so each run starts with a clean context, and records token count and duration
+ * **Grading** : checks each assertion against the output and writes pass or fail with evidence to `grading.json`
+ * **Benchmark** : aggregates pass rate, time, and tokens for with-skill versus without-skill into `benchmark.json` so you can compare the pass-rate improvement against the token and time overhead
+ * **Version comparison** : runs a blind A/B between two versions of the skill so you can confirm an edit is an improvement before committing it
+ * **Description tuning** : generates should-trigger and should-not-trigger prompts, measures the hit rate, and proposes description edits when the skill activates on the wrong requests
+ * **Review viewer** : opens an HTML report where you inspect each output and record qualitative feedback that the next iteration reads
+
+For the eval file format and the full iteration workflow, see [Evaluating skill output quality](<https://agentskills.io/skill-creation/evaluating-skills>) on agentskills.io. For background on the benchmark and comparison modes, see the [skill-creator announcement](<https://claude.com/blog/improving-skill-creator-test-measure-and-refine-agent-skills>).
##
@@ -793,6 +823,8 @@
Related resources
* **[Debug your configuration](</docs/en/debug-your-config>)** : diagnose why a skill isn’t appearing or triggering
+ * **[Evaluating skill output quality](<https://agentskills.io/skill-creation/evaluating-skills>)** : the eval file format and iteration workflow on agentskills.io
+ * **[Skill authoring best practices](<https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices>)** : writing guidance that applies across Claude products
* **[Subagents](</docs/en/sub-agents>)** : delegate tasks to specialized agents
* **[Plugins](</docs/en/plugins>)** : package and distribute skills with other extensions
* **[Hooks](</docs/en/hooks>)** : automate workflows around tool events
--- a/skills.md
+++ b/skills.md
@@ -240,6 +240,7 @@
Skill location| Command name source| Example
---|---|---
Skill directory under `~/.claude/skills/` or `.claude/skills/`| Directory name| `.claude/skills/deploy-staging/SKILL.md` → `/deploy-staging`
+Nested `.claude/skills/` directory, when the name clashes with another skill| Subdirectory path relative to the working directory, then the skill directory name| `apps/web/.claude/skills/deploy/SKILL.md` → `/apps/web:deploy`
File under `.claude/commands/`| File name without extension| `.claude/commands/deploy.md` → `/deploy`
Plugin `skills/` subdirectory| Directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`
Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>)
@@ -783,7 +784,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see whether the budget is overflowing and which skills are affected. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`maxSkillDescriptionChars`](</docs/en/settings#available-settings>).
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see how many skill descriptions are being shortened or dropped and which skills are affected. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`maxSkillDescriptionChars`](</docs/en/settings#available-settings>).
##
--- a/skills.md
+++ b/skills.md
@@ -99,7 +99,13 @@
Project| `.claude/skills/<skill-name>/SKILL.md`| This project only
Plugin| `<plugin>/skills/<skill-name>/SKILL.md`| Where plugin is enabled
-When skills share the same name across levels, enterprise overrides personal, and personal overrides project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
+When skills share the same name across levels, enterprise overrides personal, and personal overrides project. A skill at any of these levels also overrides a bundled skill with the same name. For example, a `code-review` skill in your project’s `.claude/skills/` replaces the bundled `/code-review`. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence. Skills also load from nested `.claude/skills/` directories below your working directory. When Claude reads or edits a file in a subdirectory, skills from that subdirectory’s `.claude/skills/` become available. This lets a monorepo package provide its own skills that apply when working on that package, even if the session started at the repo root. If a nested skill shares a name with another skill, both stay available. For example, with a `deploy` skill at the project root and another in `apps/web/.claude/skills/`:
+
+ * The nested one appears under a directory-qualified name, `apps/web:deploy`.
+ * Its description says which directory it applies to.
+ * Claude picks the variant that matches the files it is working on.
+
+Typing `/deploy` runs the project-root skill. Type the qualified name `/apps/web:deploy` to run the nested variant explicitly.
Add a `.claude-plugin/plugin.json` to a skill folder and it loads as a [plugin](</docs/en/plugins-reference#skills-directory-plugins>) named `<name>@skills-dir`, so it can bundle agents, hooks, and MCP servers. In a project’s `.claude/skills/`, this requires accepting the workspace trust dialog first.
--- a/skills.md
+++ b/skills.md
@@ -10,7 +10,7 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session, including `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills that are available in every session unless disabled with the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting, including `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
###
@@ -258,7 +258,7 @@
`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
-Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it; a doubled backslash such as `\\$1` keeps both backslashes and substitutes as before. **Example using substitutions:**
+Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it. A doubled backslash such as `\\$1` leaves both backslashes in place, and `$1` still expands to the argument value. **Example using substitutions:**
---
name: session-logger
--- a/skills.md
+++ b/skills.md
@@ -352,7 +352,7 @@
allowed-tools: Bash(git add *) Bash(git commit *) Bash(git status *)
---
-To block a skill from using certain tools, add deny rules in your [permission settings](</docs/en/permissions>) instead.
+To remove tools from Claude’s available pool while a skill is active, list them in `disallowed-tools` in the skill’s frontmatter. The restriction clears when you send your next message. To block tools across all skills and prompts, add deny rules in your [permission settings](</docs/en/permissions>).
###
--- a/skills.md
+++ b/skills.md
@@ -258,7 +258,7 @@
`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
-Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. **Example using substitutions:**
+Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. To include a literal `$` before a digit, `ARGUMENTS`, or a declared argument name, such as `$1.00` in prose, escape it with a backslash: `\$1.00`. A backslash before any other `$` is left unchanged. Only a single backslash directly before the token escapes it; a doubled backslash such as `\\$1` keeps both backslashes and substitutes as before. **Example using substitutions:**
---
name: session-logger
--- a/skills.md
+++ b/skills.md
@@ -1,9 +1,3 @@
-> ## Documentation Index
->
-> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
->
-> Use this file to discover all available pages before exploring further.
-
Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
--- a/skills.md
+++ b/skills.md
@@ -107,6 +107,8 @@
When skills share the same name across levels, enterprise overrides personal, and personal overrides project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
+Add a `.claude-plugin/plugin.json` to a skill folder and it loads as a [plugin](</docs/en/plugins-reference#skills-directory-plugins>) named `<name>@skills-dir`, so it can bundle agents, hooks, and MCP servers. In a project’s `.claude/skills/`, this requires accepting the workspace trust dialog first.
+
####
@@ -114,6 +116,8 @@
Live change detection
Claude Code watches skill directories for file changes. Adding, editing, or removing a skill under `~/.claude/skills/`, the project `.claude/skills/`, or a `.claude/skills/` inside an `--add-dir` directory takes effect within the current session without restarting. Creating a top-level skills directory that did not exist when the session started requires restarting Claude Code so the new directory can be watched.
+
+Live change detection covers `SKILL.md` text only. For a skill folder that is also a [plugin](</docs/en/plugins-reference#skills-directory-plugins>), changes to `hooks/`, `.mcp.json`, `agents/`, and `output-styles/` need `/reload-plugins` to take effect.
####
@@ -257,7 +261,7 @@
`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
`$name`| Named argument declared in the `arguments` frontmatter list. Names map to positions in order, so with `arguments: [issue, branch]` the placeholder `$issue` expands to the first argument and `$branch` to the second.
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
-`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, `max`, or `ultra`. The `ultra` value is the stored value for ultracode. Use this to adapt skill instructions to the active effort setting.
+`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. **Example using substitutions:**
--- a/skills.md
+++ b/skills.md
@@ -257,7 +257,7 @@
`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
`$name`| Named argument declared in the `arguments` frontmatter list. Names map to positions in order, so with `arguments: [issue, branch]` the placeholder `$issue` expands to the first argument and `$branch` to the second.
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
-`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Use this to adapt skill instructions to the active effort setting.
+`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, `max`, or `ultra`. The `ultra` value is the stored value for ultracode. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. **Example using substitutions:**
--- a/skills.md
+++ b/skills.md
@@ -141,7 +141,7 @@
Skills from additional directories
-The `--add-dir` flag [grants file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
+The `--add-dir` flag and `/add-dir` command [grant file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. This exception applies only to `--add-dir` and `/add-dir`. The `permissions.additionalDirectories` setting in `settings.json` grants file access only and does not load skills. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
@@ -208,14 +208,15 @@
Field| Required| Description
---|---|---
-`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters).
+`name`| No| Display name shown in skill listings. Defaults to the directory name. See How a skill gets its command name for how this differs from the name you type to invoke the skill.
`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Put the key use case first: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
-`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space-separated string or a YAML list.
+`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space- or comma-separated string, or a YAML list.
+`disallowed-tools`| No| Tools removed from Claude’s available pool while this skill is active. Use for autonomous skills that should never call certain tools, such as `AskUserQuestion` for a background loop. Accepts a space- or comma-separated string, or a YAML list. The restriction clears when you send your next message.
`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context.
@@ -223,6 +224,23 @@
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
+
+####
+
+
+
+How a skill gets its command name
+
+The command you type to invoke a skill comes from where the skill file lives. The frontmatter `name` field sets the display label shown in skill listings and, except for a plugin-root `SKILL.md`, does not change what you type after `/`. The table below shows where the command name comes from for each layout:
+
+Skill location| Command name source| Example
+---|---|---
+Skill directory under `~/.claude/skills/` or `.claude/skills/`| Directory name| `.claude/skills/deploy-staging/SKILL.md` → `/deploy-staging`
+File under `.claude/commands/`| File name without extension| `.claude/commands/deploy.md` → `/deploy`
+Plugin `skills/` subdirectory| Directory name, namespaced by plugin| `my-plugin/skills/review/SKILL.md` → `/my-plugin:review`
+Plugin root `SKILL.md`| Frontmatter `name`, with the plugin directory name as a fallback| `my-plugin/SKILL.md` with `name: review` → `/my-plugin:review`. See [Path behavior rules](</docs/en/plugins-reference#path-behavior-rules>)
+
+The plugin-root case is the one place where `name` does set the command name, because there is no skill directory to take it from. If `name` is not set in the frontmatter, the plugin’s directory name is used instead.
####
--- a/skills.md
+++ b/skills.md
@@ -6,7 +6,7 @@
Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
-For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/simplify`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
+For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
@@ -16,7 +16,7 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills that are available in every session, including `/code-review`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
###
--- a/skills.md
+++ b/skills.md
@@ -17,6 +17,22 @@
Bundled skills
Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+
+###
+
+
+
+Run and verify your app
+
+Three bundled skills work together to launch your app and confirm changes against the running app instead of just tests:
+
+Skill| Purpose
+---|---
+`/run`| Launch and drive your app to see a change working
+`/verify`| Build and run your app to confirm a code change does what it should, without falling back to tests or type checks
+`/run-skill-generator`| Teach `/run` and `/verify` how to build and launch your project
+
+All three skills require Claude Code v2.1.145 or later. `/run` and `/verify` work without setup. They infer the launch from your project type (CLI, server, TUI, browser-driven) and from what’s in your README, `package.json`, or `Makefile`. That inference gets unreliable for projects that need anything beyond a standard launch: a database, an env file, a graphical session, a multi-step build. `/run-skill-generator` records the recipe instead. It gets your app running from a clean environment, captures what worked (the install commands, the env vars, the launch script), and commits it as a per-project skill at `.claude/skills/run-<name>/`. After that, `/run`, `/verify`, and any other agent in the repo follow the recorded recipe instead of rediscovering it. Run `/run-skill-generator` once per project, and again if the build or launch process changes.
##
@@ -400,7 +416,7 @@
2. The output replaces the placeholder in the skill content
3. Claude receives the fully-rendered prompt with actual PR data
-This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
+This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. The inline form is only recognized when `!` appears at the start of a line or immediately after whitespace. If `!` follows another character, as in `KEY=!`cmd``, the placeholder is left as literal text and the command does not run. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
## Environment
```!
--- a/skills.md
+++ b/skills.md
@@ -427,10 +427,10 @@
Approach| System prompt| Task| Also loads
---|---|---|---
-Skill with `context: fork`| From agent type (`Explore`, `Plan`, etc.)| SKILL.md content| CLAUDE.md
+Skill with `context: fork`| From agent type| SKILL.md content| CLAUDE.md, except when the agent is Explore or Plan
Subagent with `skills` field| Subagent’s markdown body| Claude’s delegation message| Preloaded skills + CLAUDE.md
-With `context: fork`, you write the task in your skill and pick an agent type to execute it. For the inverse (defining a custom subagent that uses skills as reference material), see [Subagents](</docs/en/sub-agents#preload-skills-into-subagents>).
+With `context: fork`, you write the task in your skill and pick an agent type to execute it. The built-in Explore and Plan agents [skip CLAUDE.md and git status](</docs/en/sub-agents#what-loads-at-startup>) to keep their context small, so a forked skill using `agent: Explore` sees only the SKILL.md content and the agent’s own system prompt. For the inverse, where you define a custom subagent that uses skills as reference material, see [Subagents](</docs/en/sub-agents#preload-skills-into-subagents>).
####
--- a/skills.md
+++ b/skills.md
@@ -400,7 +400,7 @@
2. The output replaces the placeholder in the skill content
3. Claude receives the fully-rendered prompt with actual PR data
-This is preprocessing, not something Claude executes. Claude only sees the final result. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
+This is preprocessing, not something Claude executes. Claude only sees the final result. Substitution runs once over the original file. Command output is inserted as plain text and is not re-scanned for further `!`<command>`` placeholders, so a command cannot emit a placeholder for a later pass to expand. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
## Environment
```!
--- a/skills.md
+++ b/skills.md
@@ -103,9 +103,9 @@
-Automatic discovery from nested directories
-
-When you work with files in subdirectories, Claude Code automatically discovers skills from nested `.claude/skills/` directories. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
+Automatic discovery from parent and nested directories
+
+Project skills load from `.claude/skills/` in your starting directory and in every parent directory up to the repository root, so starting Claude in a subdirectory still picks up skills defined at the root. When you work with files in subdirectories below your starting directory, Claude Code also discovers skills from nested `.claude/skills/` directories on demand. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
my-skill/
├── SKILL.md # Main instructions (required)
--- a/skills.md
+++ b/skills.md
@@ -745,7 +745,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget.
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales at 1% of the model’s context window. When it overflows, descriptions for the skills you invoke least are dropped first, so the skills you actually use keep their full text. Run `/doctor` to see whether the budget is overflowing and which skills are affected. To raise the budget, set the [`skillListingBudgetFraction`](</docs/en/settings#available-settings>) setting (e.g. `0.02` = 2%) or the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to a fixed character count. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget. The cap is configurable with [`maxSkillDescriptionChars`](</docs/en/settings#available-settings>).
##
--- a/skills.md
+++ b/skills.md
@@ -485,6 +485,32 @@
Permission syntax: `Skill(name)` for exact match, `Skill(name *)` for prefix match with any arguments. **Hide individual skills** by adding `disable-model-invocation: true` to their frontmatter. This removes the skill from Claude’s context entirely.
The `user-invocable` field only controls menu visibility, not Skill tool access. Use `disable-model-invocation: true` to block programmatic invocation.
+
+###
+
+
+
+Override skill visibility from settings
+
+The `skillOverrides` setting controls skill visibility from your [settings](</docs/en/settings>) instead of the skill’s own frontmatter. Use it for skills whose SKILL.md you don’t want to edit, such as ones checked into a shared project repo or provided by an MCP server. The `/skills` menu writes it for you: highlight a skill and press `Space` to cycle states, then `Enter` to save to `.claude/settings.local.json`. Each key is a skill name and each value is one of four states:
+
+Value| Listed to Claude| In `/` menu
+---|---|---
+`"on"`| Name and description| Yes
+`"name-only"`| Name only| Yes
+`"user-invocable-only"`| Hidden| Yes
+`"off"`| Hidden| Hidden
+
+A skill that is absent from `skillOverrides` is treated as `"on"`. The example below collapses one skill to its name and turns another off entirely:
+
+ {
+ "skillOverrides": {
+ "legacy-context": "name-only",
+ "deploy": "off"
+ }
+ }
+
+Plugin skills are not affected by `skillOverrides`. Manage those through `/plugin` instead.
##
@@ -719,7 +745,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget.
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. To free budget for other skills, set low-priority entries to `"name-only"` in `skillOverrides` so they list without a description. You can also trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget.
##
--- a/skills.md
+++ b/skills.md
@@ -169,7 +169,7 @@
2. Build the application
3. Push to the deployment target
-Your `SKILL.md` can contain anything, but thinking through how you want the skill invoked (by you, by Claude, or both) and where you want it to run (inline or in a subagent) helps guide what to include. For complex skills, you can also add supporting files to keep the main skill focused.
+Your `SKILL.md` can contain anything, but thinking through how you want the skill invoked (by you, by Claude, or both) and where you want it to run (inline or in a subagent) helps guide what to include. For complex skills, you can also add supporting files to keep the main skill focused. Keep the body itself concise. Once a skill loads, its content stays in context across turns, so every line is a recurring token cost. State what to do rather than narrating how or why, and apply the same conciseness test you would for [CLAUDE.md content](</docs/en/best-practices#write-an-effective-claude-md>).
###
Show diff (221 lines)
--- a/skills.md
+++ b/skills.md
@@ -4,7 +4,7 @@
>
> Use this file to discover all available pages before exploring further.
-Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same playbook, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
+Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same instructions, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/simplify`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
@@ -16,7 +16,7 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
##
@@ -30,7 +30,7 @@
Create your first skill
-This example creates a skill that teaches Claude to explain code using visual diagrams and analogies. Since it uses default frontmatter, Claude can load it automatically when you ask how something works, or you can invoke it directly with `/explain-code`.
+This example creates a skill that summarizes the uncommitted changes in your git repository and flags anything risky. It pulls the live diff into the prompt before Claude reads it, so the response is grounded in your actual working tree rather than what Claude can guess from open files. Claude loads the skill automatically when you ask about your changes, or you can invoke it directly with `/summarize-changes`.
1
@@ -38,40 +38,41 @@
Create a directory for the skill in your personal skills folder. Personal skills are available across all your projects.
- mkdir -p ~/.claude/skills/explain-code
+ mkdir -p ~/.claude/skills/summarize-changes
2
Write SKILL.md
-Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The directory name becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.Create `~/.claude/skills/explain-code/SKILL.md`:
-
- ---
- description: Explains code with visual diagrams and analogies. Use when explaining how code works, teaching about a codebase, or when the user asks "how does this work?"
- ---
-
- When explaining code, always include:
-
- 1. **Start with an analogy**: Compare the code to something from everyday life
- 2. **Draw a diagram**: Use ASCII art to show the flow, structure, or relationships
- 3. **Walk through the code**: Explain step-by-step what happens
- 4. **Highlight a gotcha**: What's a common mistake or misconception?
-
- Keep explanations conversational. For complex concepts, use multiple analogies.
+Every skill needs a `SKILL.md` file with two parts: YAML frontmatter between `---` markers that tells Claude when to use the skill, and markdown content with the instructions Claude follows when the skill runs. The directory name becomes the command you type, and the `description` helps Claude decide when to load the skill automatically.Save this to `~/.claude/skills/summarize-changes/SKILL.md`:
+
+ ---
+ description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
+ ---
+
+ ## Current changes
+
+ !`git diff HEAD`
+
+ ## Instructions
+
+ Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating. If the diff is empty, say there are no uncommitted changes.
+
+The `!`git diff HEAD`` line uses dynamic context injection: Claude Code runs the command and replaces the line with its output before Claude sees the skill content, so the instructions arrive with the current diff already inlined.
3
Test the skill
-You can test it two ways:**Let Claude invoke it automatically** by asking something that matches the description:
-
- How does this code work?
+Open a git project, make a small edit to any file, and start Claude Code by running `claude`. You can test the skill two ways.**Let Claude invoke it automatically** by asking something that matches the description:
+
+ What did I change?
**Or invoke it directly** with the skill name:
- /explain-code src/auth/login.ts
-
-Either way, Claude should include an analogy and ASCII diagram in its explanation.
+ /summarize-changes
+
+Either way, Claude should respond with a short summary of your edit and a list of risks.
###
@@ -192,7 +193,7 @@
Field| Required| Description
---|---|---
`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters).
-`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Front-load the key use case: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
+`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Put the key use case first: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
@@ -310,7 +311,7 @@
Pre-approve tools for a skill
-The `allowed-tools` field grants permission for the listed tools while the skill is active, so Claude can use them without prompting you for approval. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. This skill lets Claude run git commands without per-use approval whenever you invoke it:
+The `allowed-tools` field grants permission for the listed tools while the skill is active, so Claude can use them without prompting you for approval. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. For skills checked into a project’s `.claude/skills/` directory, `allowed-tools` takes effect after you accept the workspace trust dialog for that folder, the same as permission rules in `.claude/settings.json`. Review project skills before trusting a repository, since a skill can grant itself broad tool access. This skill lets Claude run git commands without per-use approval whenever you invoke it:
---
name: commit
@@ -410,7 +411,7 @@
To disable this behavior for skills and custom commands from user, project, plugin, or additional-directory sources, set `"disableSkillShellExecution": true` in [settings](</docs/en/settings>). Each command is replaced with `[shell command execution disabled by policy]` instead of being run. Bundled and managed skills are not affected. This setting is most useful in [managed settings](</docs/en/permissions#managed-settings>), where users cannot override it.
-To enable [extended thinking](</docs/en/common-workflows#use-extended-thinking-thinking-mode>) in a skill, include the word “ultrathink” anywhere in your skill content.
+To request deeper reasoning when a skill runs, include `ultrathink` anywhere in the skill content. See [Use ultrathink for one-off deep reasoning](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>).
###
@@ -507,12 +508,12 @@
mkdir -p ~/.claude/skills/codebase-visualizer/scripts
-Create `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script:
+Save this to `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script. The script path uses `${CLAUDE_SKILL_DIR}` so it resolves correctly whether the skill is installed at the personal, project, or plugin level:
---
name: codebase-visualizer
description: Generate an interactive collapsible tree visualization of your codebase. Use when exploring a new repo, understanding project structure, or identifying large files.
- allowed-tools: Bash(python *)
+ allowed-tools: Bash(python3 *)
---
# Codebase Visualizer
@@ -524,7 +525,7 @@
Run the visualization script from your project root:
```bash
- python ~/.claude/skills/codebase-visualizer/scripts/visualize.py .
+ python3 ${CLAUDE_SKILL_DIR}/scripts/visualize.py .
```
This creates `codebase-map.html` in the current directory and opens it in your default browser.
@@ -536,13 +537,13 @@
- **Colors**: Different colors for different file types
- **Directory totals**: Shows aggregate size of each folder
-Create `~/.claude/skills/codebase-visualizer/scripts/visualize.py`. This script scans a directory tree and generates a self-contained HTML file with:
+Save this to `~/.claude/skills/codebase-visualizer/scripts/visualize.py`. This script scans a directory tree and generates a self-contained HTML file with:
* A **summary sidebar** showing file count, directory count, total size, and number of file types
* A **bar chart** breaking down the codebase by file type (top 8 by size)
* A **collapsible tree** where you can expand and collapse directories, with color-coded file type indicators
-The script requires Python but uses only built-in libraries, so there are no packages to install:
+The script requires Python 3 but uses only built-in libraries, so there are no packages to install:
#!/usr/bin/env python3
"""Generate an interactive collapsible tree visualization of a codebase."""
@@ -550,6 +551,7 @@
import json
import sys
import webbrowser
+ from html import escape
from pathlib import Path
from collections import Counter
@@ -638,7 +640,7 @@
{lang_bars}
</div>
<div class="main">
- <h1>📁 {data["name"]}</h1>
+ <h1>📁 {escape(data["name"])}</h1>
<ul class="tree" id="root"></ul>
</div>
</div>
@@ -646,11 +648,12 @@
const data = {json.dumps(data)};
const colors = {json.dumps(colors)};
function fmt(b) {{ if (b < 1024) return b + ' B'; if (b < 1048576) return (b/1024).toFixed(1) + ' KB'; return (b/1048576).toFixed(1) + ' MB'; }}
+ function esc(s) {{ return s.replace(/[&<>"']/g, c => ({{"&":"&","<":"<",">":">",'"':""","'":"'"}}[c])); }}
function render(node, parent) {{
if (node.children) {{
const det = document.createElement('details');
det.open = parent === document.getElementById('root');
- det.innerHTML = `<summary><span class="folder">📁 ${{node.name}}</span><span class="size">${{fmt(node.size)}}</span></summary>`;
+ det.innerHTML = `<summary><span class="folder">📁 ${{esc(node.name)}}</span><span class="size">${{fmt(node.size)}}</span></summary>`;
const ul = document.createElement('ul'); ul.className = 'tree';
node.children.sort((a,b) => (b.children?1:0)-(a.children?1:0) || a.name.localeCompare(b.name));
node.children.forEach(c => render(c, ul));
@@ -658,7 +661,7 @@
const li = document.createElement('li'); li.appendChild(det); parent.appendChild(li);
}} else {{
const li = document.createElement('li'); li.className = 'file';
- li.innerHTML = `<span class="dot" style="background:${{colors[node.ext]||'#6b7280'}}"></span>${{node.name}}<span class="size">${{fmt(node.size)}}</span>`;
+ li.innerHTML = `<span class="dot" style="background:${{colors[node.ext]||'#6b7280'}}"></span>${{esc(node.name)}}<span class="size">${{fmt(node.size)}}</span>`;
parent.appendChild(li);
}}
}}
@@ -676,9 +679,9 @@
print(f'Generated {out.absolute()}')
webbrowser.open(f'file://{out.absolute()}')
-See all 131 lines
-
-To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, generates `codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the heavy lifting while Claude handles orchestration.
+See all 133 lines
+
+To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, generates `codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the work while Claude handles orchestration.
##
@@ -716,7 +719,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim the `description` and `when_to_use` text at the source: front-load the key use case, since each entry’s combined text is capped at 1,536 characters regardless of budget.
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim the `description` and `when_to_use` text at the source: put the key use case first, since each entry’s combined text is capped at 1,536 characters regardless of budget.
##
--- a/skills.md
+++ b/skills.md
@@ -44,10 +44,9 @@
Write SKILL.md
-Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The `name` field becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.Create `~/.claude/skills/explain-code/SKILL.md`:
-
- ---
- name: explain-code
+Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The directory name becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.Create `~/.claude/skills/explain-code/SKILL.md`:
+
+ ---
description: Explains code with visual diagrams and analogies. Use when explaining how code works, teaching about a codebase, or when the user asks "how does this work?"
---
--- a/skills.md
+++ b/skills.md
@@ -1,3 +1,9 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same playbook, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/simplify`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
--- a/skills.md
+++ b/skills.md
@@ -217,6 +217,7 @@
`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
`$name`| Named argument declared in the `arguments` frontmatter list. Names map to positions in order, so with `arguments: [issue, branch]` the placeholder `$issue` expands to the first argument and `$branch` to the second.
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
+`${CLAUDE_EFFORT}`| The current effort level: `low`, `medium`, `high`, `xhigh`, or `max`. Use this to adapt skill instructions to the active effort setting.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. **Example using substitutions:**
--- a/skills.md
+++ b/skills.md
@@ -83,7 +83,7 @@
Project| `.claude/skills/<skill-name>/SKILL.md`| This project only
Plugin| `<plugin>/skills/<skill-name>/SKILL.md`| Where plugin is enabled
-When skills share the same name across levels, higher-priority locations win: enterprise > personal > project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
+When skills share the same name across levels, enterprise overrides personal, and personal overrides project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
####
--- a/skills.md
+++ b/skills.md
@@ -190,10 +190,11 @@
`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Front-load the key use case: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
-`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`.
+`arguments`| No| Named positional arguments for `$name` substitution in the skill content. Accepts a space-separated string or a YAML list. Names map to argument positions in order.
+`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Also prevents the skill from being [preloaded into subagents](</docs/en/sub-agents#preload-skills-into-subagents>). Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space-separated string or a YAML list.
-`model`| No| Model to use when this skill is active.
+`model`| No| Model to use when this skill is active. The override applies for the rest of the current turn and is not saved to settings; the session model resumes on your next prompt. Accepts the same values as [`/model`](</docs/en/model-config>), or `inherit` to keep the active model.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context.
`agent`| No| Which subagent type to use when `context: fork` is set.
@@ -214,6 +215,7 @@
`$ARGUMENTS`| All arguments passed when invoking the skill. If `$ARGUMENTS` is not present in the content, arguments are appended as `ARGUMENTS: <value>`.
`$ARGUMENTS[N]`| Access a specific argument by 0-based index, such as `$ARGUMENTS[0]` for the first argument.
`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
+`$name`| Named argument declared in the `arguments` frontmatter list. Names map to positions in order, so with `arguments: [issue, branch]` the placeholder `$issue` expands to the first argument and `$branch` to the second.
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
@@ -716,6 +718,7 @@
Related resources
+ * **[Debug your configuration](</docs/en/debug-your-config>)** : diagnose why a skill isn’t appearing or triggering
* **[Subagents](</docs/en/sub-agents>)** : delegate tasks to specialized agents
* **[Plugins](</docs/en/plugins>)** : package and distribute skills with other extensions
* **[Hooks](</docs/en/hooks>)** : automate workflows around tool events
--- a/skills.md
+++ b/skills.md
@@ -10,7 +10,7 @@
Bundled skills
-Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
+Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike most built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
##
@@ -194,7 +194,7 @@
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space-separated string or a YAML list.
`model`| No| Model to use when this skill is active.
-`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `max` (Opus 4.6 only).
+`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `xhigh`, `max`; available levels depend on the model.
`context`| No| Set to `fork` to run in a forked subagent context.
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
@@ -459,7 +459,7 @@
Restrict Claude’s skill access
-By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. Built-in commands like `/compact` and `/init` are not available through the Skill tool. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. A few built-in commands are also available through the Skill tool, including `/init`, `/review`, and `/security-review`. Other built-in commands such as `/compact` are not. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
# Add to deny rules:
Skill
--- a/skills.md
+++ b/skills.md
@@ -84,6 +84,14 @@
Plugin| `<plugin>/skills/<skill-name>/SKILL.md`| Where plugin is enabled
When skills share the same name across levels, higher-priority locations win: enterprise > personal > project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
+
+####
+
+
+
+Live change detection
+
+Claude Code watches skill directories for file changes. Adding, editing, or removing a skill under `~/.claude/skills/`, the project `.claude/skills/`, or a `.claude/skills/` inside an `--add-dir` directory takes effect within the current session without restarting. Creating a top-level skills directory that did not exist when the session started requires restarting Claude Code so the new directory can be watched.
####
@@ -111,7 +119,7 @@
Skills from additional directories
-The `--add-dir` flag [grants file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically and picked up by live change detection, so you can edit those skills during a session without restarting. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
+The `--add-dir` flag [grants file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically. See Live change detection for how edits are picked up during a session. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
@@ -179,7 +187,8 @@
Field| Required| Description
---|---|---
`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters).
-`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Front-load the key use case: descriptions longer than 250 characters are truncated in the skill listing to reduce context usage.
+`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Front-load the key use case: the combined `description` and `when_to_use` text is truncated at 1,536 characters in the skill listing to reduce context usage.
+`when_to_use`| No| Additional context for when Claude should invoke the skill, such as trigger phrases or example requests. Appended to `description` in the skill listing and counts toward the 1,536-character cap.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
@@ -699,7 +708,7 @@
Skill descriptions are cut short
-Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim descriptions at the source: front-load the key use case, since each entry is capped at 250 characters regardless of budget.
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim the `description` and `when_to_use` text at the source: front-load the key use case, since each entry’s combined text is capped at 1,536 characters regardless of budget.
##
--- a/skills.md
+++ b/skills.md
@@ -1,6 +1,6 @@
-Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`.
-
-For built-in commands like `/help` and `/compact`, see the [built-in commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
+Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`. Create a skill when you keep pasting the same playbook, checklist, or multi-step procedure into chat, or when a section of CLAUDE.md has grown into a procedure rather than a fact. Unlike CLAUDE.md content, a skill’s body loads only when it’s used, so long reference material costs almost nothing until you need it.
+
+For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/simplify`, see the [commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
@@ -10,15 +10,7 @@
Bundled skills
-Bundled skills ship with Claude Code and are available in every session. Unlike [built-in commands](</docs/en/commands>), which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. This means bundled skills can spawn parallel agents, read files, and adapt to your codebase. You invoke bundled skills the same way as any other skill: type `/` followed by the skill name. In the table below, `<arg>` indicates a required argument and `[arg]` indicates an optional one.
-
-Skill| Purpose
----|---
-`/batch <instruction>`| Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one background agent per unit in an isolated [git worktree](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>). Each agent implements its unit, runs tests, and opens a pull request. Requires a git repository. Example: `/batch migrate src/ from Solid to React`
-`/claude-api`| Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL). Covers tool use, streaming, batches, structured outputs, Managed Agents, and common pitfalls. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`
-`/debug [description]`| Enable debug logging for the current session and troubleshoot issues by reading the session debug log. Debug logging is off by default unless you started with `claude --debug`, so running `/debug` mid-session starts capturing logs from that point forward. Optionally describe the issue to focus the analysis
-`/loop [interval] <prompt>`| Run a prompt repeatedly on an interval while the session stays open. Useful for polling a deployment, babysitting a PR, or periodically re-running another skill. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>)
-`/simplify [focus]`| Review your recently changed files for code reuse, quality, and efficiency issues, then fix them. Spawns three review agents in parallel, aggregates their findings, and applies fixes. Pass text to focus on specific concerns: `/simplify focus on memory efficiency`
+Claude Code includes a set of bundled skills that are available in every session, including `/simplify`, `/batch`, `/debug`, `/loop`, and `/claude-api`. Unlike built-in commands, which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. You invoke them the same way as any other skill, by typing `/` followed by the skill name. Bundled skills are listed alongside built-in commands in the [commands reference](</docs/en/commands>), marked **Skill** in the Purpose column.
##
@@ -293,7 +285,7 @@
Skill content lifecycle
-When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) preserves invoked skills. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary (truncated if the skill is very large). If you invoke the same skill more than once, only the latest copy is carried forward through compaction. If a skill seems to stop influencing behavior after the first response, the skill content is still present. The model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically.
+When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) carries invoked skills forward within a token budget. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each. Re-attached skills share a combined budget of 25,000 tokens. Claude Code fills this budget starting from the most recently invoked skill, so older skills can be dropped entirely after compaction if you have invoked many in one session. If a skill seems to stop influencing behavior after the first response, the content is usually still present and the model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically. If the skill is large or you invoked several others after it, re-invoke it after compaction to restore the full content.
###
@@ -719,5 +711,5 @@
* **[Plugins](</docs/en/plugins>)** : package and distribute skills with other extensions
* **[Hooks](</docs/en/hooks>)** : automate workflows around tool events
* **[Memory](</docs/en/memory>)** : manage CLAUDE.md files for persistent context
- * **[Built-in commands](</docs/en/commands>)** : reference for built-in `/` commands
+ * **[Commands](</docs/en/commands>)** : reference for built-in commands and bundled skills
* **[Permissions](</docs/en/permissions>)** : control tool and skill access
--- a/skills.md
+++ b/skills.md
@@ -15,7 +15,7 @@
Skill| Purpose
---|---
`/batch <instruction>`| Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one background agent per unit in an isolated [git worktree](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>). Each agent implements its unit, runs tests, and opens a pull request. Requires a git repository. Example: `/batch migrate src/ from Solid to React`
-`/claude-api`| Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL) and Agent SDK reference for Python and TypeScript. Covers tool use, streaming, batches, structured outputs, and common pitfalls. Also activates automatically when your code imports `anthropic`, `@anthropic-ai/sdk`, or `claude_agent_sdk`
+`/claude-api`| Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL). Covers tool use, streaming, batches, structured outputs, Managed Agents, and common pitfalls. Also activates automatically when your code imports `anthropic` or `@anthropic-ai/sdk`
`/debug [description]`| Enable debug logging for the current session and troubleshoot issues by reading the session debug log. Debug logging is off by default unless you started with `claude --debug`, so running `/debug` mid-session starts capturing logs from that point forward. Optionally describe the issue to focus the analysis
`/loop [interval] <prompt>`| Run a prompt repeatedly on an interval while the session stays open. Useful for polling a deployment, babysitting a PR, or periodically re-running another skill. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>)
`/simplify [focus]`| Review your recently changed files for code reuse, quality, and efficiency issues, then fix them. Spawns three review agents in parallel, aggregates their findings, and applies fixes. Pass text to focus on specific concerns: `/simplify focus on memory efficiency`
@@ -216,7 +216,7 @@
`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
-**Example using substitutions:**
+Indexed arguments use shell-style quoting, so wrap multi-word values in quotes to pass them as a single argument. For example, `/my-skill "hello world" second` makes `$0` expand to `hello world` and `$1` to `second`. The `$ARGUMENTS` placeholder always expands to the full argument string as typed. **Example using substitutions:**
---
name: session-logger
@@ -291,15 +291,26 @@
-Restrict tool access
-
-Use the `allowed-tools` field to limit which tools Claude can use when a skill is active. This skill creates a read-only mode where Claude can explore files but not modify them:
-
- ---
- name: safe-reader
- description: Read files without making changes
- allowed-tools: Read Grep Glob
- ---
+Skill content lifecycle
+
+When you or Claude invoke a skill, the rendered `SKILL.md` content enters the conversation as a single message and stays there for the rest of the session. Claude Code does not re-read the skill file on later turns, so write guidance that should apply throughout a task as standing instructions rather than one-time steps. [Auto-compaction](</docs/en/how-claude-code-works#when-context-fills-up>) preserves invoked skills. When the conversation is summarized to free context, Claude Code re-attaches the most recent invocation of each skill after the summary (truncated if the skill is very large). If you invoke the same skill more than once, only the latest copy is carried forward through compaction. If a skill seems to stop influencing behavior after the first response, the skill content is still present. The model is choosing other tools or approaches. Strengthen the skill’s `description` and instructions so the model keeps preferring it, or use [hooks](</docs/en/hooks>) to enforce behavior deterministically.
+
+###
+
+
+
+Pre-approve tools for a skill
+
+The `allowed-tools` field grants permission for the listed tools while the skill is active, so Claude can use them without prompting you for approval. It does not restrict which tools are available: every tool remains callable, and your [permission settings](</docs/en/permissions>) still govern tools that are not listed. This skill lets Claude run git commands without per-use approval whenever you invoke it:
+
+ ---
+ name: commit
+ description: Stage and commit the current changes
+ disable-model-invocation: true
+ allowed-tools: Bash(git add *) Bash(git commit *) Bash(git status *)
+ ---
+
+To block a skill from using certain tools, add deny rules in your [permission settings](</docs/en/permissions>) instead.
###
--- a/skills.md
+++ b/skills.md
@@ -198,7 +198,7 @@
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
-`shell`| No| Shell to use for `!`command`` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
+`shell`| No| Shell to use for `!`command`` and ````!` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
####
@@ -379,7 +379,16 @@
2. The output replaces the placeholder in the skill content
3. Claude receives the fully-rendered prompt with actual PR data
-This is preprocessing, not something Claude executes. Claude only sees the final result.
+This is preprocessing, not something Claude executes. Claude only sees the final result. For multi-line commands, use a fenced code block opened with ````!` instead of the inline form:
+
+ ## Environment
+ ```!
+ node --version
+ npm --version
+ git status --short
+ ```
+
+To disable this behavior for skills and custom commands from user, project, plugin, or additional-directory sources, set `"disableSkillShellExecution": true` in [settings](</docs/en/settings>). Each command is replaced with `[shell command execution disabled by policy]` instead of being run. Bundled and managed skills are not affected. This setting is most useful in [managed settings](</docs/en/permissions#managed-settings>), where users cannot override it.
To enable [extended thinking](</docs/en/common-workflows#use-extended-thinking-thinking-mode>) in a skill, include the word “ultrathink” anywhere in your skill content.
--- a/skills.md
+++ b/skills.md
@@ -177,7 +177,7 @@
name: my-skill
description: What this skill does
disable-model-invocation: true
- allowed-tools: Read, Grep
+ allowed-tools: Read Grep
---
Your skill instructions here...
@@ -191,7 +191,7 @@
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
-`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active.
+`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active. Accepts a space-separated string or a YAML list.
`model`| No| Model to use when this skill is active.
`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `max` (Opus 4.6 only).
`context`| No| Set to `fork` to run in a forked subagent context.
@@ -298,7 +298,7 @@
---
name: safe-reader
description: Read files without making changes
- allowed-tools: Read, Grep, Glob
+ allowed-tools: Read Grep Glob
---
###
--- a/skills.md
+++ b/skills.md
@@ -119,7 +119,7 @@
Skills from additional directories
-Skills defined in `.claude/skills/` within directories added via `--add-dir` are loaded automatically and picked up by live change detection, so you can edit them during a session without restarting.
+The `--add-dir` flag [grants file access](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) rather than configuration discovery, but skills are an exception: `.claude/skills/` within an added directory is loaded automatically and picked up by live change detection, so you can edit those skills during a session without restarting. Other `.claude/` configuration such as subagents, commands, and output styles is not loaded from additional directories. See the [exceptions table](</docs/en/permissions#additional-directories-grant-file-access-not-configuration>) for the complete list of what is and isn’t loaded, and the recommended ways to share configuration across projects.
CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
--- a/skills.md
+++ b/skills.md
@@ -187,7 +187,7 @@
Field| Required| Description
---|---|---
`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters).
-`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content.
+`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. Front-load the key use case: descriptions longer than 250 characters are truncated in the skill listing to reduce context usage.
`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`.
`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
@@ -685,9 +685,9 @@
-Claude doesn’t see all my skills
-
-Skill descriptions are loaded into context so Claude knows what’s available. If you have many skills, they may exceed the character budget. The budget scales dynamically at 2% of the context window, with a fallback of 16,000 characters. Run `/context` to check for a warning about excluded skills. To override the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable.
+Skill descriptions are cut short
+
+Skill descriptions are loaded into context so Claude knows what’s available. All skill names are always included, but if you have many skills, descriptions are shortened to fit the character budget, which can strip the keywords Claude needs to match your request. The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. To raise the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable. Or trim descriptions at the source: front-load the key use case, since each entry is capped at 250 characters regardless of budget.
##
Show diff (298 lines)
--- a/skills.md
+++ b/skills.md
@@ -40,12 +40,6 @@
Create a directory for the skill in your personal skills folder. Personal skills are available across all your projects.
-Report incorrect code
-
-Copy
-
-Ask AI
-
mkdir -p ~/.claude/skills/explain-code
2
@@ -53,12 +47,6 @@
Write SKILL.md
Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The `name` field becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.Create `~/.claude/skills/explain-code/SKILL.md`:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: explain-code
@@ -80,21 +68,9 @@
You can test it two ways:**Let Claude invoke it automatically** by asking something that matches the description:
-Report incorrect code
-
-Copy
-
-Ask AI
-
How does this code work?
**Or invoke it directly** with the skill name:
-
-Report incorrect code
-
-Copy
-
-Ask AI
/explain-code src/auth/login.ts
@@ -124,12 +100,6 @@
Automatic discovery from nested directories
When you work with files in subdirectories, Claude Code automatically discovers skills from nested `.claude/skills/` directories. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
-
-Report incorrect code
-
-Copy
-
-Ask AI
my-skill/
├── SKILL.md # Main instructions (required)
@@ -169,12 +139,6 @@
Skill files can contain any instructions, but thinking about how you want to invoke them helps guide what to include: **Reference content** adds knowledge Claude applies to your current work. Conventions, patterns, style guides, domain knowledge. This content runs inline so Claude can use it alongside your conversation context.
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: api-conventions
description: API design patterns for this codebase
@@ -187,12 +151,6 @@
**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically.
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: deploy
description: Deploy the application to production
@@ -214,12 +172,6 @@
Frontmatter reference
Beyond the markdown content, you can configure skill behavior using YAML frontmatter fields between `---` markers at the top of your `SKILL.md` file:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: my-skill
@@ -245,6 +197,7 @@
`context`| No| Set to `fork` to run in a forked subagent context.
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
+`paths`| No| Glob patterns that limit when this skill is activated. Accepts a comma-separated string or a YAML list. When set, Claude loads the skill automatically only when working with files matching the patterns. Uses the same format as [path-specific rules](</docs/en/memory#path-specific-rules>).
`shell`| No| Shell to use for `!`command`` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
####
@@ -265,12 +218,6 @@
**Example using substitutions:**
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: session-logger
description: Log activity for this session
@@ -287,12 +234,6 @@
Add supporting files
Skills can include multiple files in their directory. This keeps `SKILL.md` focused on the essentials while letting Claude access detailed reference material only when needed. Large reference docs, API specifications, or example collections don’t need to load into context every time the skill runs.
-
-Report incorrect code
-
-Copy
-
-Ask AI
my-skill/
├── SKILL.md (required - overview and navigation)
@@ -303,12 +244,6 @@
Reference supporting files from `SKILL.md` so Claude knows what each file contains and when to load it:
-Report incorrect code
-
-Copy
-
-Ask AI
-
## Additional resources
- For complete API details, see [reference.md](reference.md)
@@ -328,12 +263,6 @@
* **`user-invocable: false`** : Only Claude can invoke the skill. Use this for background knowledge that isn’t actionable as a command. A `legacy-system-context` skill explains how an old system works. Claude should know this when relevant, but `/legacy-system-context` isn’t a meaningful action for users to take.
This example creates a deploy skill that only you can trigger. The `disable-model-invocation: true` field prevents Claude from running it automatically:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: deploy
@@ -366,12 +295,6 @@
Use the `allowed-tools` field to limit which tools Claude can use when a skill is active. This skill creates a read-only mode where Claude can explore files but not modify them:
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: safe-reader
description: Read files without making changes
@@ -385,12 +308,6 @@
Pass arguments to skills
Both you and Claude can pass arguments when invoking a skill. Arguments are available via the `$ARGUMENTS` placeholder. This skill fixes a GitHub issue by number. The `$ARGUMENTS` placeholder gets replaced with whatever follows the skill name:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: fix-issue
@@ -408,12 +325,6 @@
When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: migrate-component
description: Migrate a component from one framework to another
@@ -424,12 +335,6 @@
Running `/migrate-component SearchBar React Vue` replaces `$ARGUMENTS[0]` with `SearchBar`, `$ARGUMENTS[1]` with `React`, and `$ARGUMENTS[2]` with `Vue`. The same skill using the `$N` shorthand:
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: migrate-component
description: Migrate a component from one framework to another
@@ -451,12 +356,6 @@
Inject dynamic context
The `!`<command>`` syntax runs shell commands before the skill content is sent to Claude. The command output replaces the placeholder, so Claude receives actual data, not the command itself. This skill summarizes a pull request by fetching live PR data with the GitHub CLI. The `!`gh pr diff`` and other commands run first, and their output gets inserted into the prompt:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: pr-summary
@@ -511,12 +410,6 @@
This skill runs research in a forked Explore agent. The skill content becomes the task, and the agent provides read-only tools optimized for codebase exploration:
-Report incorrect code
-
-Copy
-
-Ask AI
-
---
name: deep-research
description: Research a topic thoroughly
@@ -547,22 +440,10 @@
By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. Built-in commands like `/compact` and `/init` are not available through the Skill tool. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
-Report incorrect code
-
-Copy
-
-Ask AI
-
# Add to deny rules:
Skill
**Allow or deny specific skills** using [permission rules](</docs/en/permissions>):
-
-Report incorrect code
-
-Copy
-
-Ask AI
# Allow only specific skills
Skill(commit)
@@ -595,21 +476,9 @@
Skills can bundle and run scripts in any language, giving Claude capabilities beyond what’s possible in a single prompt. One powerful pattern is generating visual output: interactive HTML files that open in your browser for exploring data, debugging, or creating reports. This example creates a codebase explorer: an interactive tree view where you can expand and collapse directories, see file sizes at a glance, and identify file types by color. Create the Skill directory:
-Report incorrect code
-
-Copy
-
-Ask AI
-
mkdir -p ~/.claude/skills/codebase-visualizer/scripts
Create `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script:
-
-Report incorrect code
-
-Copy
-
-Ask AI
---
name: codebase-visualizer
@@ -645,12 +514,6 @@
* A **collapsible tree** where you can expand and collapse directories, with color-coded file type indicators
The script requires Python but uses only built-in libraries, so there are no packages to install:
-
-Report incorrect code
-
-Copy
-
-Ask AI
#!/usr/bin/env python3
"""Generate an interactive collapsible tree visualization of a codebase."""
--- a/skills.md
+++ b/skills.md
@@ -16,7 +16,7 @@
---|---
`/batch <instruction>`| Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one background agent per unit in an isolated [git worktree](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>). Each agent implements its unit, runs tests, and opens a pull request. Requires a git repository. Example: `/batch migrate src/ from Solid to React`
`/claude-api`| Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL) and Agent SDK reference for Python and TypeScript. Covers tool use, streaming, batches, structured outputs, and common pitfalls. Also activates automatically when your code imports `anthropic`, `@anthropic-ai/sdk`, or `claude_agent_sdk`
-`/debug [description]`| Troubleshoot your current Claude Code session by reading the session debug log. Optionally describe the issue to focus the analysis
+`/debug [description]`| Enable debug logging for the current session and troubleshoot issues by reading the session debug log. Debug logging is off by default unless you started with `claude --debug`, so running `/debug` mid-session starts capturing logs from that point forward. Optionally describe the issue to focus the analysis
`/loop [interval] <prompt>`| Run a prompt repeatedly on an interval while the session stays open. Useful for polling a deployment, babysitting a PR, or periodically re-running another skill. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>)
`/simplify [focus]`| Review your recently changed files for code reuse, quality, and efficiency issues, then fix them. Spawns three review agents in parallel, aggregates their findings, and applies fixes. Pass text to focus on specific concerns: `/simplify focus on memory efficiency`
@@ -245,6 +245,7 @@
`context`| No| Set to `fork` to run in a forked subagent context.
`agent`| No| Which subagent type to use when `context: fork` is set.
`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
+`shell`| No| Shell to use for `!`command`` blocks in this skill. Accepts `bash` (default) or `powershell`. Setting `powershell` runs inline shell commands via PowerShell on Windows. Requires `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`.
####
Show diff (842 lines)
--- a/skills.md
+++ b/skills.md
@@ -0,0 +1,839 @@
+Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`.
+
+For built-in commands like `/help` and `/compact`, see the [built-in commands reference](</docs/en/commands>).**Custom commands have been merged into skills.** A file at `.claude/commands/deploy.md` and a skill at `.claude/skills/deploy/SKILL.md` both create `/deploy` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to control whether you or Claude invokes them, and the ability for Claude to load them automatically when relevant.
+
+Claude Code skills follow the [Agent Skills](<https://agentskills.io>) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
+
+##
+
+
+
+Bundled skills
+
+Bundled skills ship with Claude Code and are available in every session. Unlike [built-in commands](</docs/en/commands>), which execute fixed logic directly, bundled skills are prompt-based: they give Claude a detailed playbook and let it orchestrate the work using its tools. This means bundled skills can spawn parallel agents, read files, and adapt to your codebase. You invoke bundled skills the same way as any other skill: type `/` followed by the skill name. In the table below, `<arg>` indicates a required argument and `[arg]` indicates an optional one.
+
+Skill| Purpose
+---|---
+`/batch <instruction>`| Orchestrate large-scale changes across a codebase in parallel. Researches the codebase, decomposes the work into 5 to 30 independent units, and presents a plan. Once approved, spawns one background agent per unit in an isolated [git worktree](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>). Each agent implements its unit, runs tests, and opens a pull request. Requires a git repository. Example: `/batch migrate src/ from Solid to React`
+`/claude-api`| Load Claude API reference material for your project’s language (Python, TypeScript, Java, Go, Ruby, C#, PHP, or cURL) and Agent SDK reference for Python and TypeScript. Covers tool use, streaming, batches, structured outputs, and common pitfalls. Also activates automatically when your code imports `anthropic`, `@anthropic-ai/sdk`, or `claude_agent_sdk`
+`/debug [description]`| Troubleshoot your current Claude Code session by reading the session debug log. Optionally describe the issue to focus the analysis
+`/loop [interval] <prompt>`| Run a prompt repeatedly on an interval while the session stays open. Useful for polling a deployment, babysitting a PR, or periodically re-running another skill. Example: `/loop 5m check if the deploy finished`. See [Run prompts on a schedule](</docs/en/scheduled-tasks>)
+`/simplify [focus]`| Review your recently changed files for code reuse, quality, and efficiency issues, then fix them. Spawns three review agents in parallel, aggregates their findings, and applies fixes. Pass text to focus on specific concerns: `/simplify focus on memory efficiency`
+
+##
+
+
+
+Getting started
+
+###
+
+
+
+Create your first skill
+
+This example creates a skill that teaches Claude to explain code using visual diagrams and analogies. Since it uses default frontmatter, Claude can load it automatically when you ask how something works, or you can invoke it directly with `/explain-code`.
+
+1
+
+Create the skill directory
+
+Create a directory for the skill in your personal skills folder. Personal skills are available across all your projects.
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ mkdir -p ~/.claude/skills/explain-code
+
+2
+
+Write SKILL.md
+
+Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The `name` field becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.Create `~/.claude/skills/explain-code/SKILL.md`:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: explain-code
+ description: Explains code with visual diagrams and analogies. Use when explaining how code works, teaching about a codebase, or when the user asks "how does this work?"
+ ---
+
+ When explaining code, always include:
+
+ 1. **Start with an analogy**: Compare the code to something from everyday life
+ 2. **Draw a diagram**: Use ASCII art to show the flow, structure, or relationships
+ 3. **Walk through the code**: Explain step-by-step what happens
+ 4. **Highlight a gotcha**: What's a common mistake or misconception?
+
+ Keep explanations conversational. For complex concepts, use multiple analogies.
+
+3
+
+Test the skill
+
+You can test it two ways:**Let Claude invoke it automatically** by asking something that matches the description:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ How does this code work?
+
+**Or invoke it directly** with the skill name:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ /explain-code src/auth/login.ts
+
+Either way, Claude should include an analogy and ASCII diagram in its explanation.
+
+###
+
+
+
+Where skills live
+
+Where you store a skill determines who can use it:
+
+Location| Path| Applies to
+---|---|---
+Enterprise| See [managed settings](</docs/en/settings#settings-files>)| All users in your organization
+Personal| `~/.claude/skills/<skill-name>/SKILL.md`| All your projects
+Project| `.claude/skills/<skill-name>/SKILL.md`| This project only
+Plugin| `<plugin>/skills/<skill-name>/SKILL.md`| Where plugin is enabled
+
+When skills share the same name across levels, higher-priority locations win: enterprise > personal > project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.
+
+####
+
+
+
+Automatic discovery from nested directories
+
+When you work with files in subdirectories, Claude Code automatically discovers skills from nested `.claude/skills/` directories. For example, if you’re editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills. Each skill is a directory with `SKILL.md` as the entrypoint:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ my-skill/
+ ├── SKILL.md # Main instructions (required)
+ ├── template.md # Template for Claude to fill in
+ ├── examples/
+ │ └── sample.md # Example output showing expected format
+ └── scripts/
+ └── validate.sh # Script Claude can execute
+
+The `SKILL.md` contains the main instructions and is required. Other files are optional and let you build more powerful skills: templates for Claude to fill in, example outputs showing the expected format, scripts Claude can execute, or detailed reference documentation. Reference these files from your `SKILL.md` so Claude knows what they contain and when to load them. See Add supporting files for more details.
+
+Files in `.claude/commands/` still work and support the same frontmatter. Skills are recommended since they support additional features like supporting files.
+
+####
+
+
+
+Skills from additional directories
+
+Skills defined in `.claude/skills/` within directories added via `--add-dir` are loaded automatically and picked up by live change detection, so you can edit them during a session without restarting.
+
+CLAUDE.md files from `--add-dir` directories are not loaded by default. To load them, set `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1`. See [Load from additional directories](</docs/en/memory#load-from-additional-directories>).
+
+##
+
+
+
+Configure skills
+
+Skills are configured through YAML frontmatter at the top of `SKILL.md` and the markdown content that follows.
+
+###
+
+
+
+Types of skill content
+
+Skill files can contain any instructions, but thinking about how you want to invoke them helps guide what to include: **Reference content** adds knowledge Claude applies to your current work. Conventions, patterns, style guides, domain knowledge. This content runs inline so Claude can use it alongside your conversation context.
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: api-conventions
+ description: API design patterns for this codebase
+ ---
+
+ When writing API endpoints:
+ - Use RESTful naming conventions
+ - Return consistent error formats
+ - Include request validation
+
+**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically.
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: deploy
+ description: Deploy the application to production
+ context: fork
+ disable-model-invocation: true
+ ---
+
+ Deploy the application:
+ 1. Run the test suite
+ 2. Build the application
+ 3. Push to the deployment target
+
+Your `SKILL.md` can contain anything, but thinking through how you want the skill invoked (by you, by Claude, or both) and where you want it to run (inline or in a subagent) helps guide what to include. For complex skills, you can also add supporting files to keep the main skill focused.
+
+###
+
+
+
+Frontmatter reference
+
+Beyond the markdown content, you can configure skill behavior using YAML frontmatter fields between `---` markers at the top of your `SKILL.md` file:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: my-skill
+ description: What this skill does
+ disable-model-invocation: true
+ allowed-tools: Read, Grep
+ ---
+
+ Your skill instructions here...
+
+All fields are optional. Only `description` is recommended so Claude knows when to use the skill.
+
+Field| Required| Description
+---|---|---
+`name`| No| Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters).
+`description`| Recommended| What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content.
+`argument-hint`| No| Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`.
+`disable-model-invocation`| No| Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`.
+`user-invocable`| No| Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn’t invoke directly. Default: `true`.
+`allowed-tools`| No| Tools Claude can use without asking permission when this skill is active.
+`model`| No| Model to use when this skill is active.
+`effort`| No| [Effort level](</docs/en/model-config#adjust-effort-level>) when this skill is active. Overrides the session effort level. Default: inherits from session. Options: `low`, `medium`, `high`, `max` (Opus 4.6 only).
+`context`| No| Set to `fork` to run in a forked subagent context.
+`agent`| No| Which subagent type to use when `context: fork` is set.
+`hooks`| No| Hooks scoped to this skill’s lifecycle. See [Hooks in skills and agents](</docs/en/hooks#hooks-in-skills-and-agents>) for configuration format.
+
+####
+
+
+
+Available string substitutions
+
+Skills support string substitution for dynamic values in the skill content:
+
+Variable| Description
+---|---
+`$ARGUMENTS`| All arguments passed when invoking the skill. If `$ARGUMENTS` is not present in the content, arguments are appended as `ARGUMENTS: <value>`.
+`$ARGUMENTS[N]`| Access a specific argument by 0-based index, such as `$ARGUMENTS[0]` for the first argument.
+`$N`| Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second.
+`${CLAUDE_SESSION_ID}`| The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions.
+`${CLAUDE_SKILL_DIR}`| The directory containing the skill’s `SKILL.md` file. For plugin skills, this is the skill’s subdirectory within the plugin, not the plugin root. Use this in bash injection commands to reference scripts or files bundled with the skill, regardless of the current working directory.
+
+**Example using substitutions:**
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: session-logger
+ description: Log activity for this session
+ ---
+
+ Log the following to logs/${CLAUDE_SESSION_ID}.log:
+
+ $ARGUMENTS
+
+###
+
+
+
+Add supporting files
+
+Skills can include multiple files in their directory. This keeps `SKILL.md` focused on the essentials while letting Claude access detailed reference material only when needed. Large reference docs, API specifications, or example collections don’t need to load into context every time the skill runs.
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ my-skill/
+ ├── SKILL.md (required - overview and navigation)
+ ├── reference.md (detailed API docs - loaded when needed)
+ ├── examples.md (usage examples - loaded when needed)
+ └── scripts/
+ └── helper.py (utility script - executed, not loaded)
+
+Reference supporting files from `SKILL.md` so Claude knows what each file contains and when to load it:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ## Additional resources
+
+ - For complete API details, see [reference.md](reference.md)
+ - For usage examples, see [examples.md](examples.md)
+
+Keep `SKILL.md` under 500 lines. Move detailed reference material to separate files.
+
+###
+
+
+
+Control who invokes a skill
+
+By default, both you and Claude can invoke any skill. You can type `/skill-name` to invoke it directly, and Claude can load it automatically when relevant to your conversation. Two frontmatter fields let you restrict this:
+
+ * **`disable-model-invocation: true`** : Only you can invoke the skill. Use this for workflows with side effects or that you want to control timing, like `/commit`, `/deploy`, or `/send-slack-message`. You don’t want Claude deciding to deploy because your code looks ready.
+ * **`user-invocable: false`** : Only Claude can invoke the skill. Use this for background knowledge that isn’t actionable as a command. A `legacy-system-context` skill explains how an old system works. Claude should know this when relevant, but `/legacy-system-context` isn’t a meaningful action for users to take.
+
+This example creates a deploy skill that only you can trigger. The `disable-model-invocation: true` field prevents Claude from running it automatically:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: deploy
+ description: Deploy the application to production
+ disable-model-invocation: true
+ ---
+
+ Deploy $ARGUMENTS to production:
+
+ 1. Run the test suite
+ 2. Build the application
+ 3. Push to the deployment target
+ 4. Verify the deployment succeeded
+
+Here’s how the two fields affect invocation and context loading:
+
+Frontmatter| You can invoke| Claude can invoke| When loaded into context
+---|---|---|---
+(default)| Yes| Yes| Description always in context, full skill loads when invoked
+`disable-model-invocation: true`| Yes| No| Description not in context, full skill loads when you invoke
+`user-invocable: false`| No| Yes| Description always in context, full skill loads when invoked
+
+In a regular session, skill descriptions are loaded into context so Claude knows what’s available, but full skill content only loads when invoked. [Subagents with preloaded skills](</docs/en/sub-agents#preload-skills-into-subagents>) work differently: the full skill content is injected at startup.
+
+###
+
+
+
+Restrict tool access
+
+Use the `allowed-tools` field to limit which tools Claude can use when a skill is active. This skill creates a read-only mode where Claude can explore files but not modify them:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: safe-reader
+ description: Read files without making changes
+ allowed-tools: Read, Grep, Glob
+ ---
+
+###
+
+
+
+Pass arguments to skills
+
+Both you and Claude can pass arguments when invoking a skill. Arguments are available via the `$ARGUMENTS` placeholder. This skill fixes a GitHub issue by number. The `$ARGUMENTS` placeholder gets replaced with whatever follows the skill name:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: fix-issue
+ description: Fix a GitHub issue
+ disable-model-invocation: true
+ ---
+
+ Fix GitHub issue $ARGUMENTS following our coding standards.
+
+ 1. Read the issue description
+ 2. Understand the requirements
+ 3. Implement the fix
+ 4. Write tests
+ 5. Create a commit
+
+When you run `/fix-issue 123`, Claude receives “Fix GitHub issue 123 following our coding standards…” If you invoke a skill with arguments but the skill doesn’t include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed. To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: migrate-component
+ description: Migrate a component from one framework to another
+ ---
+
+ Migrate the $ARGUMENTS[0] component from $ARGUMENTS[1] to $ARGUMENTS[2].
+ Preserve all existing behavior and tests.
+
+Running `/migrate-component SearchBar React Vue` replaces `$ARGUMENTS[0]` with `SearchBar`, `$ARGUMENTS[1]` with `React`, and `$ARGUMENTS[2]` with `Vue`. The same skill using the `$N` shorthand:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: migrate-component
+ description: Migrate a component from one framework to another
+ ---
+
+ Migrate the $0 component from $1 to $2.
+ Preserve all existing behavior and tests.
+
+##
+
+
+
+Advanced patterns
+
+###
+
+
+
+Inject dynamic context
+
+The `!`<command>`` syntax runs shell commands before the skill content is sent to Claude. The command output replaces the placeholder, so Claude receives actual data, not the command itself. This skill summarizes a pull request by fetching live PR data with the GitHub CLI. The `!`gh pr diff`` and other commands run first, and their output gets inserted into the prompt:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: pr-summary
+ description: Summarize changes in a pull request
+ context: fork
+ agent: Explore
+ allowed-tools: Bash(gh *)
+ ---
+
+ ## Pull request context
+ - PR diff: !`gh pr diff`
+ - PR comments: !`gh pr view --comments`
+ - Changed files: !`gh pr diff --name-only`
+
+ ## Your task
+ Summarize this pull request...
+
+When this skill runs:
+
+ 1. Each `!`<command>`` executes immediately (before Claude sees anything)
+ 2. The output replaces the placeholder in the skill content
+ 3. Claude receives the fully-rendered prompt with actual PR data
+
+This is preprocessing, not something Claude executes. Claude only sees the final result.
+
+To enable [extended thinking](</docs/en/common-workflows#use-extended-thinking-thinking-mode>) in a skill, include the word “ultrathink” anywhere in your skill content.
+
+###
+
+
+
+Run skills in a subagent
+
+Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won’t have access to your conversation history.
+
+`context: fork` only makes sense for skills with explicit instructions. If your skill contains guidelines like “use these API conventions” without a task, the subagent receives the guidelines but no actionable prompt, and returns without meaningful output.
+
+Skills and [subagents](</docs/en/sub-agents>) work together in two directions:
+
+Approach| System prompt| Task| Also loads
+---|---|---|---
+Skill with `context: fork`| From agent type (`Explore`, `Plan`, etc.)| SKILL.md content| CLAUDE.md
+Subagent with `skills` field| Subagent’s markdown body| Claude’s delegation message| Preloaded skills + CLAUDE.md
+
+With `context: fork`, you write the task in your skill and pick an agent type to execute it. For the inverse (defining a custom subagent that uses skills as reference material), see [Subagents](</docs/en/sub-agents#preload-skills-into-subagents>).
+
+####
+
+
+
+Example: Research skill using Explore agent
+
+This skill runs research in a forked Explore agent. The skill content becomes the task, and the agent provides read-only tools optimized for codebase exploration:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: deep-research
+ description: Research a topic thoroughly
+ context: fork
+ agent: Explore
+ ---
+
+ Research $ARGUMENTS thoroughly:
+
+ 1. Find relevant files using Glob and Grep
+ 2. Read and analyze the code
+ 3. Summarize findings with specific file references
+
+When this skill runs:
+
+ 1. A new isolated context is created
+ 2. The subagent receives the skill content as its prompt (“Research $ARGUMENTS thoroughly…”)
+ 3. The `agent` field determines the execution environment (model, tools, and permissions)
+ 4. Results are summarized and returned to your main conversation
+
+The `agent` field specifies which subagent configuration to use. Options include built-in agents (`Explore`, `Plan`, `general-purpose`) or any custom subagent from `.claude/agents/`. If omitted, uses `general-purpose`.
+
+###
+
+
+
+Restrict Claude’s skill access
+
+By default, Claude can invoke any skill that doesn’t have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](</docs/en/permissions>) still govern baseline approval behavior for all other tools. Built-in commands like `/compact` and `/init` are not available through the Skill tool. Three ways to control which skills Claude can invoke: **Disable all skills** by denying the Skill tool in `/permissions`:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ # Add to deny rules:
+ Skill
+
+**Allow or deny specific skills** using [permission rules](</docs/en/permissions>):
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ # Allow only specific skills
+ Skill(commit)
+ Skill(review-pr *)
+
+ # Deny specific skills
+ Skill(deploy *)
+
+Permission syntax: `Skill(name)` for exact match, `Skill(name *)` for prefix match with any arguments. **Hide individual skills** by adding `disable-model-invocation: true` to their frontmatter. This removes the skill from Claude’s context entirely.
+
+The `user-invocable` field only controls menu visibility, not Skill tool access. Use `disable-model-invocation: true` to block programmatic invocation.
+
+##
+
+
+
+Share skills
+
+Skills can be distributed at different scopes depending on your audience:
+
+ * **Project skills** : Commit `.claude/skills/` to version control
+ * **Plugins** : Create a `skills/` directory in your [plugin](</docs/en/plugins>)
+ * **Managed** : Deploy organization-wide through [managed settings](</docs/en/settings#settings-files>)
+
+###
+
+
+
+Generate visual output
+
+Skills can bundle and run scripts in any language, giving Claude capabilities beyond what’s possible in a single prompt. One powerful pattern is generating visual output: interactive HTML files that open in your browser for exploring data, debugging, or creating reports. This example creates a codebase explorer: an interactive tree view where you can expand and collapse directories, see file sizes at a glance, and identify file types by color. Create the Skill directory:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ mkdir -p ~/.claude/skills/codebase-visualizer/scripts
+
+Create `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ ---
+ name: codebase-visualizer
+ description: Generate an interactive collapsible tree visualization of your codebase. Use when exploring a new repo, understanding project structure, or identifying large files.
+ allowed-tools: Bash(python *)
+ ---
+
+ # Codebase Visualizer
+
+ Generate an interactive HTML tree view that shows your project's file structure with collapsible directories.
+
+ ## Usage
+
+ Run the visualization script from your project root:
+
+ ```bash
+ python ~/.claude/skills/codebase-visualizer/scripts/visualize.py .
+ ```
+
+ This creates `codebase-map.html` in the current directory and opens it in your default browser.
+
+ ## What the visualization shows
+
+ - **Collapsible directories**: Click folders to expand/collapse
+ - **File sizes**: Displayed next to each file
+ - **Colors**: Different colors for different file types
+ - **Directory totals**: Shows aggregate size of each folder
+
+Create `~/.claude/skills/codebase-visualizer/scripts/visualize.py`. This script scans a directory tree and generates a self-contained HTML file with:
+
+ * A **summary sidebar** showing file count, directory count, total size, and number of file types
+ * A **bar chart** breaking down the codebase by file type (top 8 by size)
+ * A **collapsible tree** where you can expand and collapse directories, with color-coded file type indicators
+
+The script requires Python but uses only built-in libraries, so there are no packages to install:
+
+Report incorrect code
+
+Copy
+
+Ask AI
+
+ #!/usr/bin/env python3
+ """Generate an interactive collapsible tree visualization of a codebase."""
+
+ import json
+ import sys
+ import webbrowser
+ from pathlib import Path
+ from collections import Counter
+
+ IGNORE = {'.git', 'node_modules', '__pycache__', '.venv', 'venv', 'dist', 'build'}
+
+ def scan(path: Path, stats: dict) -> dict:
+ result = {"name": path.name, "children": [], "size": 0}
+ try:
+ for item in sorted(path.iterdir()):
+ if item.name in IGNORE or item.name.startswith('.'):
+ continue
+ if item.is_file():
+ size = item.stat().st_size
+ ext = item.suffix.lower() or '(no ext)'
+ result["children"].append({"name": item.name, "size": size, "ext": ext})
+ result["size"] += size
+ stats["files"] += 1
+ stats["extensions"][ext] += 1
+ stats["ext_sizes"][ext] += size
+ elif item.is_dir():
+ stats["dirs"] += 1
+ child = scan(item, stats)
+ if child["children"]:
+ result["children"].append(child)
+ result["size"] += child["size"]
+ except PermissionError:
+ pass
+ return result
+
+ def generate_html(data: dict, stats: dict, output: Path) -> None:
+ ext_sizes = stats["ext_sizes"]
+ total_size = sum(ext_sizes.values()) or 1
+ sorted_exts = sorted(ext_sizes.items(), key=lambda x: -x[1])[:8]
+ colors = {
+ '.js': '#f7df1e', '.ts': '#3178c6', '.py': '#3776ab', '.go': '#00add8',
+ '.rs': '#dea584', '.rb': '#cc342d', '.css': '#264de4', '.html': '#e34c26',
+ '.json': '#6b7280', '.md': '#083fa1', '.yaml': '#cb171e', '.yml': '#cb171e',
+ '.mdx': '#083fa1', '.tsx': '#3178c6', '.jsx': '#61dafb', '.sh': '#4eaa25',
+ }
+ lang_bars = "".join(
+ f'<div class="bar-row"><span class="bar-label">{ext}</span>'
+ f'<div class="bar" style="width:{(size/total_size)*100}%;background:{colors.get(ext,"#6b7280")}"></div>'
+ f'<span class="bar-pct">{(size/total_size)*100:.1f}%</span></div>'
+ for ext, size in sorted_exts
+ )
+ def fmt(b):
+ if b < 1024: return f"{b} B"
+ if b < 1048576: return f"{b/1024:.1f} KB"
+ return f"{b/1048576:.1f} MB"
+
+ html = f'''<!DOCTYPE html>
+ <html><head>
+ <meta charset="utf-8"><title>Codebase Explorer</title>
+ <style>
+ body {{ font: 14px/1.5 system-ui, sans-serif; margin: 0; background: #1a1a2e; color: #eee; }}
+ .container {{ display: flex; height: 100vh; }}
+ .sidebar {{ width: 280px; background: #252542; padding: 20px; border-right: 1px solid #3d3d5c; overflow-y: auto; flex-shrink: 0; }}
+ .main {{ flex: 1; padding: 20px; overflow-y: auto; }}
+ h1 {{ margin: 0 0 10px 0; font-size: 18px; }}
+ h2 {{ margin: 20px 0 10px 0; font-size: 14px; color: #888; text-transform: uppercase; }}
+ .stat {{ display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3d3d5c; }}
+ .stat-value {{ font-weight: bold; }}
+ .bar-row {{ display: flex; align-items: center; margin: 6px 0; }}
+ .bar-label {{ width: 55px; font-size: 12px; color: #aaa; }}
+ .bar {{ height: 18px; border-radius: 3px; }}
+ .bar-pct {{ margin-left: 8px; font-size: 12px; color: #666; }}
+ .tree {{ list-style: none; padding-left: 20px; }}
+ details {{ cursor: pointer; }}
+ summary {{ padding: 4px 8px; border-radius: 4px; }}
+ summary:hover {{ background: #2d2d44; }}
+ .folder {{ color: #ffd700; }}
+ .file {{ display: flex; align-items: center; padding: 4px 8px; border-radius: 4px; }}
+ .file:hover {{ background: #2d2d44; }}
+ .size {{ color: #888; margin-left: auto; font-size: 12px; }}
+ .dot {{ width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }}
+ </style>
+ </head><body>
+ <div class="container">
+ <div class="sidebar">
+ <h1>📊 Summary</h1>
+ <div class="stat"><span>Files</span><span class="stat-value">{stats["files"]:,}</span></div>
+ <div class="stat"><span>Directories</span><span class="stat-value">{stats["dirs"]:,}</span></div>
+ <div class="stat"><span>Total size</span><span class="stat-value">{fmt(data["size"])}</span></div>
+ <div class="stat"><span>File types</span><span class="stat-value">{len(stats["extensions"])}</span></div>
+ <h2>By file type</h2>
+ {lang_bars}
+ </div>
+ <div class="main">
+ <h1>📁 {data["name"]}</h1>
+ <ul class="tree" id="root"></ul>
+ </div>
+ </div>
+ <script>
+ const data = {json.dumps(data)};
+ const colors = {json.dumps(colors)};
+ function fmt(b) {{ if (b < 1024) return b + ' B'; if (b < 1048576) return (b/1024).toFixed(1) + ' KB'; return (b/1048576).toFixed(1) + ' MB'; }}
+ function render(node, parent) {{
+ if (node.children) {{
+ const det = document.createElement('details');
+ det.open = parent === document.getElementById('root');
+ det.innerHTML = `<summary><span class="folder">📁 ${{node.name}}</span><span class="size">${{fmt(node.size)}}</span></summary>`;
+ const ul = document.createElement('ul'); ul.className = 'tree';
+ node.children.sort((a,b) => (b.children?1:0)-(a.children?1:0) || a.name.localeCompare(b.name));
+ node.children.forEach(c => render(c, ul));
+ det.appendChild(ul);
+ const li = document.createElement('li'); li.appendChild(det); parent.appendChild(li);
+ }} else {{
+ const li = document.createElement('li'); li.className = 'file';
+ li.innerHTML = `<span class="dot" style="background:${{colors[node.ext]||'#6b7280'}}"></span>${{node.name}}<span class="size">${{fmt(node.size)}}</span>`;
+ parent.appendChild(li);
+ }}
+ }}
+ data.children.forEach(c => render(c, document.getElementById('root')));
+ </script>
+ </body></html>'''
+ output.write_text(html)
+
+ if __name__ == '__main__':
+ target = Path(sys.argv[1] if len(sys.argv) > 1 else '.').resolve()
+ stats = {"files": 0, "dirs": 0, "extensions": Counter(), "ext_sizes": Counter()}
+ data = scan(target, stats)
+ out = Path('codebase-map.html')
+ generate_html(data, stats, out)
+ print(f'Generated {out.absolute()}')
+ webbrowser.open(f'file://{out.absolute()}')
+
+See all 131 lines
+
+To test, open Claude Code in any project and ask “Visualize this codebase.” Claude runs the script, generates `codebase-map.html`, and opens it in your browser. This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the heavy lifting while Claude handles orchestration.
+
+##
+
+
+
+Troubleshooting
+
+###
+
+
+
+Skill not triggering
+
+If Claude doesn’t use your skill when expected:
+
+ 1. Check the description includes keywords users would naturally say
+ 2. Verify the skill appears in `What skills are available?`
+ 3. Try rephrasing your request to match the description more closely
+ 4. Invoke it directly with `/skill-name` if the skill is user-invocable
+
+###
+
+
+
+Skill triggers too often
+
+If Claude uses your skill when you don’t want it:
+
+ 1. Make the description more specific
+ 2. Add `disable-model-invocation: true` if you only want manual invocation
+
+###
+
+
+
+Claude doesn’t see all my skills
+
+Skill descriptions are loaded into context so Claude knows what’s available. If you have many skills, they may exceed the character budget. The budget scales dynamically at 2% of the context window, with a fallback of 16,000 characters. Run `/context` to check for a warning about excluded skills. To override the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable.
+
+##
+
+
+
+Related resources
+
+ * **[Subagents](</docs/en/sub-agents>)** : delegate tasks to specialized agents
+ * **[Plugins](</docs/en/plugins>)** : package and distribute skills with other extensions
+ * **[Hooks](</docs/en/hooks>)** : automate workflows around tool events
+ * **[Memory](</docs/en/memory>)** : manage CLAUDE.md files for persistent context
+ * **[Built-in commands](</docs/en/commands>)** : reference for built-in `/` commands
+ * **[Permissions](</docs/en/permissions>)** : control tool and skill access