このスキルは、ユーザーが以下のような依頼をする場合に使用してください: - エージェント(特定のタスクを自動実行するプログラム)を新たに作成する - エージェントを追加する - サブエージェント(親となるエージェント配下の子エージェント)を作成する - エージェントの冒頭情報(メタデータ)について - 説明文をいつ使うべきかについて - エージェントの例 - エージェントが利用するツール - エージェントの色設定 - 自律型エージェント(人間の指示なしに判断・行動するエージェント) - エージェント構造、システムプロンプト(AIの動作指示)、動作条件、またはClaudeコードプラグイン開発のベストプラクティスに関する指針が必要な場合
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.
エージェントは、複雑な複数ステップのタスクを自律的に処理する独立した部分プロセスです。エージェントの構造、発動条件、システムプロンプト(指示文)の設計を理解することで、強力な自律機能を作成できます。
主な概念:
---
name: agent-identifier
description: Use this agent when [発動条件]. Typical triggers include [シナリオ1を文章で], [シナリオ2を文章で], and [シナリオ3を文章で]. See "When to invoke" in the agent body for worked scenarios.
model: inherit
color: blue
tools: ["Read", "Write", "Grep"]
---
You are [エージェントの役割説明]...
## When to invoke
[2~4つの代表的なシナリオを文章で記述。例:]
- **[シナリオ名].** [状況の説明と、エージェントが何をすべきか。]
- **[シナリオ名].** [同様に記述。]
**Your Core Responsibilities:**
1. [責任1]
2. [責任2]
**Analysis Process:**
[段階的な処理フロー]
**Output Format:**
[返すべき内容]
エージェントを識別し、呼び出すために使う名前。
形式: 小文字、数字、ハイフンのみ 文字数: 3~50字 ルール: 始まりと終わりは英数字で
良い例:
code-reviewertest-generatorapi-docs-writersecurity-analyzer悪い例:
helper(汎用すぎる)-agent-(ハイフンで始まる/終わる)my_agent(アンダースコアは使用不可)ag(短すぎる、3字未満)Claude がこのエージェントを発動する場面を定義します。最も重要なフィールド — エージェント登録時にコンテキストに読み込まれるため、ここで発動の判断が決まります。
必須の内容:
形式:
Use this agent when [条件]. Typical triggers include [シナリオ1を文章で], [シナリオ2を文章で], and [シナリオ3を文章で]. See "When to invoke" in the agent body for worked scenarios.
ベストプラクティス:
エージェントが使用するモデル。
オプション:
inherit — 親と同じモデルを使う(推奨)sonnet — Claude Sonnet(バランス型)opus — Claude Opus(最も高性能、高コスト)haiku — Claude Haiku(高速、低コスト)推奨: 特別な理由がない限り inherit を使用してください。
UI 上でエージェントを区別するための色。
オプション: blue、cyan、green、yellow、magenta、red
ガイドライン:
エージェントが使用できるツールを限定します。
形式: ツール名の配列
tools: ["Read", "Write", "Grep", "Bash"]
デフォルト: 省略した場合、すべてのツールにアクセス可能
ベストプラクティス: 最小権限の原則に従い、必要最小限のツールに限定する
一般的なツールセット:
["Read", "Grep", "Glob"]["Read", "Write", "Grep"]["Read", "Bash", "Grep"]["*"] を使用Markdown の本文がエージェントのシステムプロンプトになります。二人称で、エージェントに直接指示するように書いてください。
標準テンプレート:
You are [役割] specializing in [専門分野].
**Your Core Responsibilities:**
1. [主な責任]
2. [次の責任]
3. [その他の責任...]
**Analysis Process:**
1. [ステップ1]
2. [ステップ2]
3. [ステップ3]
[...]
**Quality Standards:**
- [品質基準1]
- [品質基準2]
**Output Format:**
Provide results in this format:
- [含めるべき内容]
- [構成方法]
**Edge Cases:**
Handle these situations:
- [エッジケース1]: [対応方法]
- [エッジケース2]: [対応方法]
✅ すべき:
❌ してはいけない:
このプロンプトパターンを使用してください(Claude Code から抽出):
Create an agent configuration based on this request: "[あなたの説明]"
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..."
}
その後、メタデータを付けてエージェントファイル形式に変換してください。
詳細は examples/agent-creation-prompt.md を参照してください。
inherit)agents/agent-name.md として保存✅ 有効: code-reviewer, test-gen, api-analyzer-v2
❌ 無効: ag(短すぎ), -start(ハイフンで始まる), my_agent(アンダースコア使用)
ルール:
文字数: 10~5,000字 必須: 発動条件と例 推奨: 200~1,000字で 2~4個の例を記載
文字数: 20~10,000字 推奨: 500~3,000字 構成: 明確な責任、プロセス、出力形式を含む
plugin-name/
└── agents/
├── analyzer.md
├── reviewer.md
└── generator.md
agents/ フォルダ内のすべての .md ファイルが自動検出されます。
エージェントは自動的にネームスペース化されます:
agent-nameplugin:subdir:agent-nameエージェントが正しく発動するか検証するシナリオを作成してください:
システムプロンプトが完全か確認してください:
---
name: simple-agent
description: Use this agent when [条件]. Typical triggers include [発動例1] and [発動例2]. See "When to invoke" in the agent body.
model: inherit
color: blue
---
You are an agent that [機能].
## When to invoke
- **[シナリオA].** [説明]
- **[シナリオB].** [説明]
Process:
1. [ステップ1]
2. [ステップ2]
Output: [提供内容]
| フィールド | 必須 | 形式 | 例 |
|---|---|---|---|
| name | ◎ | 小文字ハイフン | code-reviewer |
| description | ◎ | 文章形式の発動条件 | Use when... Typical triggers include... |
| model | ◎ | inherit/sonnet/opus/haiku | inherit |
| color | ◎ | 色の名前 | blue |
| tools | — | ツール名の配列 | ["Read", "Grep"] |
すべき:
inherit を使うしてはいけない:
詳細なガイダンスは以下を参照してください:
references/system-prompt-design.md — システムプロンプトの完全なパターンreferences/triggering-examples.md — 発動例の形式とベストプラクティスreferences/agent-creation-system-prompt.md — Claude Code で使用される正式なプロンプトexamples/ フォルダの実行可能な例:
agent-creation-prompt.md — AI による支援テンプレートcomplete-agent-examples.md — ユースケース別の完全な実例scripts/ の開発ツール:
validate-agent.sh — エージェントファイルの構造を検証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 による自動翻訳です。