Skill Creator

Verified 中级 Intermediate 流程型 Process ⚡ Claude Code 专属 ⚡ Claude Code Optimized
4 min read · 197 lines

Anthropic official skill creation guide: progressive disclosure design + six-step process

Skill Creator

Overview

Anthropic's official guide for creating high-quality Claude skills. A systematic process from requirement definition through packaging and iteration.

What Skills Provide

  • Specialized workflows: Step-by-step domain guidance
  • Tool integrations: Connect external services via MCP or scripts
  • Domain expertise: Encode expert knowledge as reusable instructions
  • Bundled resources: Scripts, references, templates, and assets

Core Design Principles

Conciseness

The context window is a shared resource. Skills should contain only the minimum information needed.

Appropriate Degrees of Freedom

Overly rigid skills can't adapt to real scenarios. Leave reasonable room for Claude's judgment.

Progressive Disclosure

Three-level loading system for maximum token efficiency:

Level Content When Loaded
Level 1 YAML frontmatter Always in system prompt
Level 2 SKILL.md body When Claude deems skill relevant
Level 3 Linked files (references/) On demand

Skill File Structure

your-skill-name/
├── SKILL.md                  # Required — main skill file
├── scripts/                  # Optional — executable code
│   ├── process_data.py
│   └── validate.sh
├── references/               # Optional — documentation
│   ├── api-guide.md
│   └── examples/
└── assets/                   # Optional — templates, icons
    └── report-template.md

Six-Step Creation Process

Step 1: Understand the Skill

Define use cases with concrete examples. Write 2-3 real requests users would make.

Step 2: Plan Reusable Content

Determine what's universal guidance (SKILL.md) vs. specialized reference (references/).

Step 3: Initialize the Skill

Create folder structure and write YAML frontmatter:

---
name: your-skill-name          # kebab-case, required
description: >                 # Required: what + when
  Describe skill functionality and trigger conditions.
  Include specific phrases users might say.
---

Step 4: Write SKILL.md

  • Put critical instructions at the top
  • Use numbered steps and clear structure
  • Mark key info with ## Important / ## Critical headers
  • Reference bundled resources with clear paths

Step 5: Package the Skill

  • Folder names in kebab-case
  • SKILL.md spelling is case-sensitive
  • No README.md inside the skill folder
  • Keep SKILL.md under 5,000 words

Step 6: Iterate Based on Usage

Signal Meaning Action
Skill doesn't trigger when it should Description too vague Add trigger phrases and keywords
Triggers on unrelated tasks Description too broad Add negative triggers
Inconsistent results Instructions ambiguous Improve steps, add error handling

YAML Frontmatter Fields

Field Required Description
name No Display name (lowercase, hyphens, max 64 chars)
description Recommended What + when, < 1024 chars. Claude uses this to decide when to load
argument-hint No Hint shown during autocomplete
disable-model-invocation No true prevents Claude from auto-loading. Default: false
user-invocable No false hides from / menu. Default: true
allowed-tools No Tools Claude can use without asking permission when skill is active
model No Model to use when skill is active (e.g., sonnet, haiku)
context No Set to fork to run in an isolated subagent context
agent No Subagent type when context: fork is set (e.g., Explore)
hooks No Hooks scoped to this skill's lifecycle
license No e.g., MIT, Apache-2.0
metadata No Custom key-value pairs (author, version, etc.)

Invocation Control Matrix

Frontmatter Config User Can Invoke Claude Can Invoke Context Loading
(default) Description always in context, full skill on invoke
disable-model-invocation: true Description not in context
user-invocable: false Description always in context

Skill Locations & Priority

Location Path Scope
Enterprise Managed settings All users in org
Personal ~/.claude/skills/<name>/SKILL.md All your projects
Project .claude/skills/<name>/SKILL.md This project only
Plugin <plugin>/skills/<name>/SKILL.md Where plugin is enabled

Priority: Enterprise > Personal > Project. Plugin skills use plugin-name:skill-name namespace.

Description budget: 2% of context window, fallback 16,000 characters. Override with SLASH_COMMAND_TOOL_CHAR_BUDGET env var.

String Substitutions

Dynamic variables available in skill body:

Variable Description
$ARGUMENTS All arguments passed when invoking
$ARGUMENTS[N] / $N Specific argument by 0-based index
${CLAUDE_SESSION_ID} Current session ID
${CLAUDE_SKILL_DIR} Directory containing the skill's SKILL.md

Dynamic Context Injection

Use !`command` syntax to execute shell commands before skill content is sent to Claude, injecting real-time data into context:

---
name: pr-summary
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---
## Pull Request Context
- PR diff: !`gh pr diff`
- PR comments: !`gh pr view --comments`

This is a powerful pattern — it lets skills access live data (Git status, API responses, environment info) rather than just static text.

Subagent Execution Pattern

Set context: fork to run the skill in an isolated subagent, where the skill body becomes the subagent's prompt:

---
name: code-review
context: fork
agent: general-purpose
model: sonnet
allowed-tools: Read, Grep, Glob
---
You are a senior code reviewer. Review the recent changes...

Use cases:

  • Isolated context to avoid polluting the main conversation
  • Restricted tool access for safety
  • Different model selection for specific tasks

Best Practices

  • Code is more reliable than language: Use scripts for critical validation, not just prose
  • Iterate on one task first: Get a single hard task working in conversation, then extract it into a skill
  • The description field is the most important part: It determines when Claude loads your skill
  • Skills are living documents: Plan to iterate continuously, not write once
  • Leverage dynamic context: !`command` lets skills inject real-time data
  • Use subagent isolation: context: fork prevents complex skills from polluting main conversation context
  • Mind the description budget: All skill descriptions share 2% of context window — keep descriptions concise

相关技能 Related Skills