このスキルは、ユーザーが以下のような内容についてサポートが必要な場合に使用します: - エージェントを「作成する」「追加する」「サブエージェント(別のエージェントから呼び出すエージェント)を記述する」 - エージェント用の冒頭メタデータ(frontmatter) - 説明文を使用する場面 - エージェントの具体例 - エージェントが使用するツール - エージェントのカラー設定 - 自律的に動作するエージェント(autonomous agent) - エージェント構造、システムプロンプト(AIの基本的な動作指示)、起動条件、またはClaude Codeプラグイン向けのエージェント開発のベストプラクティス(推奨手法)に関するガイダンス
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
Agent とは、複雑な複数ステップのタスクを自律的に処理するサブプロセスです。 Agent の構造・起動条件・システムプロンプトの設計を理解することで、強力な自律機能を構築できます。
主要コンセプト:
description フィールドとサンプルを使ったトリガー設定---
name: agent-identifier
description: 次のような場合に使用: [起動条件]。典型的なトリガーとして [シナリオ1(散文)]、[シナリオ2(散文)]、[シナリオ3(散文)] などがあります。詳細な具体例は Agent 本体の "When to invoke" セクションを参照してください。
model: inherit
color: blue
tools: ["Read", "Write", "Grep"]
---
あなたは [Agent の役割説明] です...
## When to invoke
[代表的なシナリオを2〜4個、散文形式で記述。例:]
- **[シナリオ名].** [状況の説明と Agent が行うべき内容。]
- **[シナリオ名].** [同上。]
**中核的な責務:**
1. [責務 1]
2. [責務 2]
**分析プロセス:**
[ステップバイステップのワークフロー]
**出力フォーマット:**
[返すべき内容]
名前空間の管理や呼び出しに使用する Agent の識別子。
フォーマット: 小文字・数字・ハイフンのみ使用可 長さ: 3〜50 文字 パターン: 先頭と末尾は英数字であること
良い例:
code-reviewertest-generatorapi-docs-writersecurity-analyzer悪い例:
helper(汎用的すぎる)-agent-(ハイフンで始まり・終わっている)my_agent(アンダースコアは不可)ag(短すぎる。3 文字未満)Claude がこの Agent をいつ起動すべきかを定義します。 このフィールドが最も重要です — Agent が登録されるたびにコンテキストへ読み込まれ、ハーネスがディスパッチのタイミングを判断するために使用されます。
必須の記載内容:
フォーマット:
次のような場合に使用: [条件]。典型的なトリガーとして [シナリオ1(散文)]、[シナリオ2(散文)]、[シナリオ3(散文)] などがあります。詳細な具体例は Agent 本体の "When to invoke" セクションを参照してください。
ベストプラクティス:
Agent が使用するモデルを指定します。
選択肢:
inherit — 親と同じモデルを使用(推奨)sonnet — Claude Sonnet(バランス型)opus — Claude Opus(最高性能・高コスト)haiku — Claude Haiku(高速・低コスト)推奨: 特定のモデル機能が必要な場合を除き、inherit を使用してください。
UI 上で Agent を視覚的に識別するための色。
選択肢: blue、cyan、green、yellow、magenta、red
ガイドライン:
Agent が使用できるツールを制限します。
フォーマット: ツール名の配列
tools: ["Read", "Write", "Grep", "Bash"]
デフォルト: 省略した場合、Agent はすべてのツールにアクセスできます
ベストプラクティス: 最小権限の原則に従い、必要最低限のツールのみに絞る
よく使うツールセット:
["Read", "Grep", "Glob"]["Read", "Write", "Grep"]["Read", "Bash", "Grep"]["*"] を使用Markdown 本文が Agent のシステムプロンプトになります。 Agent に直接語りかける二人称("You are...")で記述してください。
標準テンプレート:
あなたは [ドメイン] を専門とする [役割] です。
**中核的な責務:**
1. [主要な責務]
2. [副次的な責務]
3. [その他の責務...]
**分析プロセス:**
1. [ステップ 1]
2. [ステップ 2]
3. [ステップ 3]
[...]
**品質基準:**
- [基準 1]
- [基準 2]
**出力フォーマット:**
以下の形式で結果を提供してください:
- [含めるべき内容]
- [構造の仕方]
**エッジケース:**
以下の状況に対処してください:
- [エッジケース 1]: [対処法]
- [エッジケース 2]: [対処法]
✅ 推奨事項:
❌ 非推奨事項:
以下のプロンプトパターンを使用します(Claude Code より抜粋):
Create an agent configuration based on this request: "[YOUR DESCRIPTION]"
Requirements:
1. Extract core intent and responsibilities
2. Design expert persona for the domain
3. Create comprehensive system prompt with:
- Clear behavioral boundaries
- Specific methodologies
- Edge case handling
- Output format
- A "When to invoke" section listing 2-4 trigger scenarios as prose bullets
4. Create identifier (lowercase, hyphens, 3-50 chars)
5. Write description with triggering conditions and a short prose summary of trigger scenarios
Return JSON with:
{
"identifier": "agent-name",
"whenToUse": "Use this agent when... Typical triggers include [...]. See \"When to invoke\" in the agent body.",
"systemPrompt": "You are..."
}
生成された JSON をフロントマター付きの Agent ファイル形式に変換してください。
完全なテンプレートは examples/agent-creation-prompt.md を参照してください。
inherit)agents/agent-name.md として保存する✅ 有効: code-reviewer, test-gen, api-analyzer-v2
❌ 無効: ag(短すぎる)、-start(ハイフン始まり)、my_agent(アンダースコア)
ルール:
長さ: 10〜5,000 文字 必須: 起動条件とサンプルを含めること 推奨: サンプルを 2〜4 個含む 200〜1,000 文字
長さ: 20〜10,000 文字 推奨: 500〜3,000 文字 構造: 責務・プロセス・出力フォーマットを明確に記述すること
plugin-name/
└── agents/
├── analyzer.md
├── reviewer.md
└── generator.md
agents/ ディレクトリ内のすべての .md ファイルは自動的に検出されます。
Agent には自動的に名前空間が付与されます:
agent-nameplugin:subdir:agent-nameAgent が正しく起動されることを検証するテストシナリオを作成します:
システムプロンプトが完全であることを確認します:
---
name: simple-agent
description: 次のような場合に使用: [条件]。典型的なトリガーとして [トリガー1] や [トリガー2] などがあります。詳細な具体例は Agent 本体の "When to invoke" セクションを参照してください。
model: inherit
color: blue
---
あなたは [X を行う] Agent です。
## When to invoke
- **[シナリオ A].** [説明。]
- **[シナリオ B].** [説明。]
プロセス:
1. [ステップ 1]
2. [ステップ 2]
出力: [提供すべき内容]
| フィールド | 必須 | フォーマット | 例 |
|---|---|---|---|
| name | 必須 | 小文字-ハイフン | code-reviewer |
| description | 必須 | 散文形式のトリガー | 次のような場合に使用:... 典型的なトリガーとして... |
| model | 必須 | inherit/sonnet/opus/haiku | inherit |
| color | 必須 | カラー名 | blue |
| tools | 任意 | ツール名の配列 | ["Read", "Grep"] |
推奨事項:
inherit を使用するAgents are autonomous subprocesses that handle complex, multi-step tasks independently. Understanding agent structure, triggering conditions, and system prompt design enables creating powerful autonomous capabilities.
Key concepts:
---
name: agent-identifier
description: Use this agent when [triggering conditions]. Typical triggers include [scenario 1 in prose], [scenario 2 in prose], and [scenario 3 in prose]. See "When to invoke" in the agent body for worked scenarios.
model: inherit
color: blue
tools: ["Read", "Write", "Grep"]
---
You are [agent role description]...
## When to invoke
[Two to four representative scenarios written as prose, e.g.:]
- **[Scenario name].** [What the situation looks like and what the agent should do.]
- **[Scenario name].** [Same.]
**Your Core Responsibilities:**
1. [Responsibility 1]
2. [Responsibility 2]
**Analysis Process:**
[Step-by-step workflow]
**Output Format:**
[What to return]
Agent identifier used for namespacing and invocation.
Format: lowercase, numbers, hyphens only Length: 3-50 characters Pattern: Must start and end with alphanumeric
Good examples:
code-reviewertest-generatorapi-docs-writersecurity-analyzerBad examples:
helper (too generic)-agent- (starts/ends with hyphen)my_agent (underscores not allowed)ag (too short, < 3 chars)Defines when Claude should trigger this agent. This is the most critical field — it is loaded into context whenever the agent is registered, so the harness can decide when to dispatch.
Must include:
Format:
Use this agent when [conditions]. Typical triggers include [scenario 1 in prose], [scenario 2 in prose], and [scenario 3 in prose]. See "When to invoke" in the agent body for worked scenarios.
Best practices:
Which model the agent should use.
Options:
inherit - Use same model as parent (recommended)sonnet - Claude Sonnet (balanced)opus - Claude Opus (most capable, expensive)haiku - Claude Haiku (fast, cheap)Recommendation: Use inherit unless agent needs specific model capabilities.
Visual identifier for agent in UI.
Options: blue, cyan, green, yellow, magenta, red
Guidelines:
Restrict agent to specific tools.
Format: Array of tool names
tools: ["Read", "Write", "Grep", "Bash"]
Default: If omitted, agent has access to all tools
Best practice: Limit tools to minimum needed (principle of least privilege)
Common tool sets:
["Read", "Grep", "Glob"]["Read", "Write", "Grep"]["Read", "Bash", "Grep"]["*"]The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly.
Standard template:
You are [role] specializing in [domain].
**Your Core Responsibilities:**
1. [Primary responsibility]
2. [Secondary responsibility]
3. [Additional responsibilities...]
**Analysis Process:**
1. [Step one]
2. [Step two]
3. [Step three]
[...]
**Quality Standards:**
- [Standard 1]
- [Standard 2]
**Output Format:**
Provide results in this format:
- [What to include]
- [How to structure]
**Edge Cases:**
Handle these situations:
- [Edge case 1]: [How to handle]
- [Edge case 2]: [How to handle]
✅ DO:
❌ DON'T:
Use this prompt pattern (extracted from Claude Code):
Create an agent configuration based on this request: "[YOUR DESCRIPTION]"
Requirements:
1. Extract core intent and responsibilities
2. Design expert persona for the domain
3. Create comprehensive system prompt with:
- Clear behavioral boundaries
- Specific methodologies
- Edge case handling
- Output format
- A "When to invoke" section listing 2-4 trigger scenarios as prose bullets
4. Create identifier (lowercase, hyphens, 3-50 chars)
5. Write description with triggering conditions and a short prose summary of trigger scenarios
Return JSON with:
{
"identifier": "agent-name",
"whenToUse": "Use this agent when... Typical triggers include [...]. See \"When to invoke\" in the agent body.",
"systemPrompt": "You are..."
}
Then convert to agent file format with frontmatter.
See examples/agent-creation-prompt.md for complete template.
inherit)agents/agent-name.md✅ Valid: code-reviewer, test-gen, api-analyzer-v2
❌ Invalid: ag (too short), -start (starts with hyphen), my_agent (underscore)
Rules:
Length: 10-5,000 characters Must include: Triggering conditions and examples Best: 200-1,000 characters with 2-4 examples
Length: 20-10,000 characters Best: 500-3,000 characters Structure: Clear responsibilities, process, output format
plugin-name/
└── agents/
├── analyzer.md
├── reviewer.md
└── generator.md
All .md files in agents/ are auto-discovered.
Agents are namespaced automatically:
agent-nameplugin:subdir:agent-nameCreate test scenarios to verify agent triggers correctly:
Ensure system prompt is complete:
---
name: simple-agent
description: Use this agent when [condition]. Typical triggers include [trigger 1] and [trigger 2]. See "When to invoke" in the agent body.
model: inherit
color: blue
---
You are an agent that [does X].
## When to invoke
- **[Scenario A].** [Description.]
- **[Scenario B].** [Description.]
Process:
1. [Step 1]
2. [Step 2]
Output: [What to provide]
| Field | Required | Format | Example |
|---|---|---|---|
| name | Yes | lowercase-hyphens | code-reviewer |
| description | Yes | Prose triggers | Use when... Typical triggers include... |
| model | Yes | inherit/sonnet/opus/haiku | inherit |
| color | Yes | Color name | blue |
| tools | No | Array of tool names | ["Read", "Grep"] |
DO:
inherit for model unless specific needDON'T:
For detailed guidance, consult:
references/system-prompt-design.md - Complete system prompt patternsreferences/triggering-examples.md - Example formats and best practicesreferences/agent-creation-system-prompt.md - The exact prompt from Claude CodeWorking examples in examples/:
agent-creation-prompt.md - AI-assisted agent generation templatecomplete-agent-examples.md - Full agent examples for different use casesDevelopment tools in scripts/:
validate-agent.sh - Validate agent file structuretest-agent-trigger.sh - Test if agent triggers correctlyTo create an agent for a plugin:
agents/agent-name.md filescripts/validate-agent.shFocus on clear triggering conditions and comprehensive system prompts for autonomous operation.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。