エージェントスキル
NEWClaudeが自動的に適用するマークダウンベースのカスタムスキルでClaudeの機能を拡張します
エージェントスキルとは?
スキルは、Claudeに特定の作業方法を教えるマークダウンファイルです。スキルはモデル呼び出し方式です:Claudeがリクエストに基づいてどのスキルを使用するかを決定します。スキルの説明に一致する質問をすると、Claudeが自動的にそのスキルを適用します。
自動アクティベーション
Claudeはスキルが関連するときを検出し、自動的に適用します
マークダウンベース
YAMLフロントマターと指示を含むシンプルなSKILL.mdファイル
ホットリロード
スキルは作成または変更時に自動的にロードされます
スキルの配置場所
| 場所 | パス | 適用対象 |
|---|---|---|
| Enterprise | Managed Settings | All users in organization |
| Personal | ~/.claude/skills/ | You, across all projects |
| Project | .claude/skills/ | Anyone in this repository |
| Plugin | skills/ in plugin | Anyone with plugin installed |
優先順位:Enterprise > Personal > Project > Plugin(名前の競合時は高い方が優先)
SKILL.mdの構造
シンプルなスキル
---
name: explaining-code
description: Explains code with visual diagrams and analogies. Use when explaining how code works.
---
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
3. **Walk through the code**: Explain step-by-step what happens
4. **Highlight a gotcha**: What's a common mistake?高度なスキル
---
name: pdf-processing
description: Extract text, fill forms, merge PDFs. Use when working with PDF files.
allowed-tools: Read, Bash(python:*)
model: claude-opus-4-5-20251101
context: fork
---
# PDF Processing
## Quick start
Extract text:
```python
import pdfplumber
with pdfplumber.open("doc.pdf") as pdf:
text = pdf.pages[0].extract_text()
```
For form filling, see [FORMS.md](FORMS.md).利用可能なメタデータフィールド
| Field | Required | Description |
|---|---|---|
| name | Yes | Lowercase letters, numbers, hyphens (max 64 chars) |
| description | Yes | What it does and when to use (max 1024 chars) |
| allowed-tools | No | Restrict tools Claude can use (e.g., Read, Grep, Bash) |
| model | No | Override model (e.g., claude-opus-4-5-20251101) |
| context | No | Set to "fork" for isolated sub-agent context |
| agent | No | Agent type when context: fork (Explore, Plan, etc.) |
| hooks | No | Define PreToolUse, PostToolUse, Stop handlers |
| user-invocable | No | Show in slash menu (default: true) |
フック付きスキル
スキルは、スキルのライフサイクル中に実行されるフックを定義できます。フックはスキルにスコープされ、スキル完了時に自動的にクリーンアップされます。
例:セキュリティチェックフック
---
name: secure-operations
description: Perform operations with additional security checks
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/security-check.sh $TOOL_INPUT"
once: true
---
Security-first operations with automatic validation.スキル vs 他のオプション
| Use This | When You Want To... | When It Runs |
|---|---|---|
| Skills | Give Claude specialized knowledge | Claude chooses when relevant |
| Slash Commands | Create reusable prompts | You type /command |
| CLAUDE.md | Set project-wide instructions | Loaded every conversation |
| Subagents | Delegate to separate context | Claude delegates or explicit |
| Hooks | Run scripts on events | On specific tool events |
| MCP Servers | Connect to external tools | Claude calls as needed |
マルチファイルスキル(段階的公開)
複雑なスキルの場合は、段階的公開を使用してください:SKILL.mdに必須情報を入れ、詳細ドキュメントは必要な時だけClaudeが読む別ファイルに入れます。
pdf-processing/
├── SKILL.md # Overview and navigation
├── FORMS.md # Loaded when needed
├── REFERENCE.md # Loaded when needed
└── scripts/
├── fill_form.py # Executed, not loaded
└── validate.py
Tip: SKILL.mdは500行未満に保ちましょう。スクリプトはコンテキストにロードせずに実行できます。
スキルのテスト
利用可能なスキルを表示
What Skills are available?スキルをテスト
スキルの説明に一致する質問をしてみてください:
How does this code work?