Skip to content

Claude Code Skills System -- Usage Guide

Skills are the extensible capability engine of Claude Code, allowing you to define custom automated workflows using Markdown files.

What Are Skills · Six Sources · Definition Format · Invocation · Execution Context · Conditional Activation · Permissions · Quick Reference

Skills System Overview


1. What Are Skills?

Skills are Claude Code's extensible capability plugin system. Each Skill is a Markdown file (with YAML frontmatter) that defines a specialized prompt and behavioral configuration, enabling Claude to execute professional workflows in specific scenarios.

Core capabilities:

CapabilityDescription
Specialized WorkflowsDefine standard processes for code review, TDD, debugging, etc.
Tool Permission ControlRestrict a Skill to only use specified tools
Model SwitchingAssign different models to different Skills
Execution IsolationFork mode runs in an isolated sub-agent
Conditional ActivationActivate only when specific files are being operated on
Hook InjectionAutomatically register lifecycle hooks when a Skill is invoked

2. Six Skill Sources

Skill Source Types

Claude Code loads Skills from 6 different sources, ordered by priority from highest to lowest:

1. Bundled (Built-in Skills)

Compiled into the CLI binary and available to all users. Defined in TypeScript and registered via registerBundledSkill().

Current Built-in Skills:

SkillDescriptionSpecial Conditions
/verifyVerify code changes--
/debugDebugging assistant--
/simplifyCode simplification review--
/rememberMemory managementRequires auto-memory enabled
/batchBatch processing--
/stuckHelp when stuck--
/skillifyCreate a new Skill--
/keybindingsCustom keyboard shortcuts--
/loopTimed loop tasksAGENT_TRIGGERS feature gate
/scheduleRemote agent schedulingAGENT_TRIGGERS_REMOTE feature gate
/claude-apiClaude API integrationBUILDING_CLAUDE_APPS feature gate
/dreamAutomatic memory organizationKAIROS feature gate

2. Managed (Policy-Managed Skills)

Controlled by organizational policies, stored in <managed-path>/.claude/skills/. Suitable for enterprise deployments.

3. User (User Skills)

Defined by individual users, stored in ~/.claude/skills/.

~/.claude/skills/
├── my-review/
│   └── SKILL.md          ← Main Skill file
├── deploy-check/
│   └── SKILL.md
└── ...

4. Project (Project Skills)

Defined at the project level, stored in .claude/skills/. Can be committed to version control.

your-project/
└── .claude/
    └── skills/
        ├── lint-fix/
        │   └── SKILL.md
        └── test-runner/
            └── SKILL.md

5. Plugin (Plugin Skills)

Provided by installed plugins. Plugins declare Skills directories via skillsPath / skillsPaths in their manifest.

Naming format: {pluginName}:{skillName}

Examples: superpowers:code-reviewer
          superpowers:brainstorming

6. MCP (MCP Server Skills)

Provided by connected MCP servers, naming format: mcp__server-name__prompt-name.

Security restriction: MCP Skills are from remote untrusted sources and are prohibited from executing !...`` inline shell commands.


3. Skill Definition Format

Directory Structure

Each Skill is a directory containing a SKILL.md file:

skill-name/
└── SKILL.md    ← Filename must be SKILL.md (case-insensitive)

Complete Frontmatter Fields

yaml
---
name: My Skill                       # Display name (optional, defaults to directory name)
description: What this skill does     # Description (required; auto-extracted from content if missing)
when_to_use: When to use this skill   # Usage scenario description (optional)
version: 1.0.0                       # Version number (optional)

# ── Invocation Control ──
user-invocable: true                  # Whether user can invoke via /skill-name (default: true)
disable-model-invocation: false       # Prevent model from invoking via Skill tool (optional)
argument-hint: "<file path>"          # Argument hint (optional)

# ── Execution Configuration ──
context: inline                       # Execution context: inline (default) or fork (sub-agent)
agent: general-purpose                # Agent type when forked (optional)
model: sonnet                         # Model override: haiku / sonnet / opus / inherit (optional)
effort: high                          # Thinking effort: low / medium / high / max (optional)
allowed-tools: "Bash, Read"           # Allowed tools (comma-separated or YAML list)
shell: bash                           # Shell type: bash (default) or powershell

# ── Conditional Activation ──
paths: "src/**/*.ts, test/**/*.ts"    # Glob patterns; activate only when matching files are operated on

# ── Lifecycle Hooks ──
hooks:
  PreToolUse:
    - matcher: "Bash"
      hooks:
        - command: "echo 'Before bash'"
          once: true                  # Execute only once
---

# Skill Body Content

This is the Markdown-formatted prompt that Claude sees when this Skill is invoked.

Supported special syntax:
- `${CLAUDE_SKILL_DIR}` — Expands to the Skill's directory
- `${CLAUDE_SESSION_ID}` — Expands to the current session ID
- `$ARGUMENTS` / `${ARG1}` — Argument substitution
- !`shell command` — Inline shell command execution

Frontmatter Field Reference

FieldTypeDefaultDescription
namestringDirectory nameDisplay name override
descriptionstringAuto-extractedBrief Skill description
when_to_usestring--Usage scenario description
user-invocablebooleantrueWhether user can invoke via /name
disable-model-invocationbooleanfalsePrevent model invocation
contextinline | forkinlineExecution context
agentstringgeneral-purposeAgent type when forked
modelstringInheritedModel override (haiku/sonnet/opus)
effortstring | int--Thinking effort level
allowed-toolsstring | listAllAllowed tools whitelist
pathsstring | list--Conditional activation glob patterns
shellbash | powershellbashShell command type
hooksobject--Lifecycle hook configuration
argument-hintstring--Argument hint text
versionstring--Version number

4. Invocation Methods

Skill Invocation Flow

Method 1: User Slash Commands

Type /skill-name directly in the terminal:

> /commit
> /review-pr 123
> /verify

Prerequisite: The Skill's user-invocable must be true.

Method 2: Automatic Model Invocation

When Claude identifies a suitable Skill during conversation, it automatically invokes it via SkillTool:

User: Please review this code for me
Claude: [Invokes superpowers:code-reviewer via SkillTool]

Prerequisite: The Skill's disable-model-invocation must not be true.

Method 3: Nested Invocation

One Skill can trigger another during execution:

/verify → internally invokes → /simplify

Tracked in telemetry via invocation_trigger: 'nested-skill'.

Invocation Priority

When Skills with the same name exist in multiple sources, they are resolved in the following order (first match wins):

1. Bundled (built-in)           ← Highest priority
2. Built-in Plugin
3. Skill Dirs (user/project directories)
4. Workflow Commands
5. Plugin Commands
6. Plugin Skills
7. Built-in Commands            ← Lowest priority

5. Execution Context

Inline Mode (Default)

Skill content is expanded into the current conversation. Claude directly sees the prompt and executes within the same context.

yaml
context: inline   # Default value, can be omitted

Characteristics:

  • Shares the parent conversation's token budget
  • Can access conversation history context
  • allowedTools restricts available tools for the current turn
  • model overrides the model used for the current turn

Fork Mode (Sub-Agent)

The Skill runs in an isolated sub-agent with its own independent token budget and context.

yaml
context: fork
agent: general-purpose   # Optional, specifies agent type

Characteristics:

  • Independent token budget; does not consume the parent conversation's quota
  • Isolated conversation context
  • Can specify a different agent type (e.g., Bash, general-purpose)
  • Results are extracted and returned to the parent conversation upon completion
  • Supports progress reporting (onProgress callback)

Comparison of Both Modes

FeatureInlineFork
Token BudgetShared with parentIndependent budget
Context AccessFull conversation historySkill prompt only
Result ReturnDirectly in conversationText extracted into tool_result
Use CasesBrief guidance, extended contextLong tasks, independent computation
Tool RestrictionscontextModifier modificationmodifiedGetAppState

6. Conditional Activation

Skills can use the paths frontmatter to implement on-demand activation, becoming visible to the model only when matching files are operated on.

Configuration

yaml
---
name: TypeScript Fix
description: Fix TypeScript type errors
paths: "src/**/*.ts, test/**/*.ts"
---

How It Works

1. All Skills are loaded at startup
2. Skills with paths are stored in the conditionalSkills Map (not exposed to the model)
3. When the user operates on a file (Read/Write/Edit)
4. activateConditionalSkillsForPaths() matches using the ignore library
5. On match → moved to the dynamicSkills Map → visible to model
6. Once activated, remains active for the entire session

Dynamic Discovery

In addition to conditional activation, Skills also support runtime discovery:

1. User operates on a file in a deeply nested directory
2. discoverSkillDirsForPaths() traverses upward from the file path
3. Looks for .claude/skills/ directories (not beyond cwd)
4. Skips directories ignored by .gitignore
5. New directory found → addSkillDirectories() → load and register

7. Permission Control

Auto-Allow

If a Skill contains only "safe properties" (no allowedTools, no hooks, no fork), it is automatically approved for execution without user confirmation.

Manual Confirmation

Skills with tool restrictions, hooks, or fork execution will prompt the user on first invocation:

Execute skill: my-custom-skill
Allow? (y)es / (n)o / (a)lways allow / (d)eny

Permission Rules

Rule TypeFormatDescription
Exact AllowSkill:commitAllow execution of the commit Skill
Prefix AllowSkill:review:*Allow all Skills with the review: prefix
Exact DenySkill:dangerous set to denyDeny execution
Prefix DenySkill:untrusted:* set to denyDeny all Skills with the untrusted: prefix

Processing order: Deny rules → Allow rules → Safe property check → Ask user


8. Quick Reference

Creating a Skill

bash
# 1. Create directory
mkdir -p ~/.claude/skills/my-skill

# 2. Create SKILL.md
cat > ~/.claude/skills/my-skill/SKILL.md << 'EOF'
---
name: My Skill
description: An example Skill
user-invocable: true
---

# Skill Content

Hello, this is my custom Skill.
EOF

Common Operations

OperationMethod
Create a Skill~/.claude/skills/<name>/SKILL.md
Project-level Skill.claude/skills/<name>/SKILL.md
Invoke a SkillType /skill-name in terminal
View available SkillsType /skills in terminal
Create Skill with AI/skillify
Restrict toolsAdd allowed-tools in frontmatter
Fork executionAdd context: fork in frontmatter
Conditional activationAdd paths: "src/**" in frontmatter

Skill Availability Matrix

SourceUser InvocableModel InvocableSupports ForkSupports Hooks
BundledPer definitionPer definitionYesYes
ManagedYesYesYesYes
UserYes (default)YesYesYes
ProjectYes (default)YesYesYes
PluginPer configPer configYesYes
MCPPer configPer configYesNo (security restriction)

Released under the MIT License.