• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLClaude Codedevelopment

agent-development

プラグイン
plugin-dev
ソース
GitHub で見る ↗
説明

このスキルは、ユーザーが以下のような依頼をする場合に使用してください: - エージェント(特定のタスクを自動実行するプログラム)を新たに作成する - エージェントを追加する - サブエージェント(親となるエージェント配下の子エージェント)を作成する - エージェントの冒頭情報(メタデータ)について - 説明文をいつ使うべきかについて - エージェントの例 - エージェントが利用するツール - エージェントの色設定 - 自律型エージェント(人間の指示なしに判断・行動するエージェント) - エージェント構造、システムプロンプト(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.

ユースケース
  • エージェントを新たに作成する
  • エージェントを追加する
  • サブエージェントを作成する
  • エージェントの設定について相談する
  • エージェント開発のベストプラクティスを知る
本文(日本語訳)

Claude Code プラグイン向けエージェント開発

概要

エージェントは、複雑な複数ステップのタスクを自律的に処理する独立した部分プロセスです。エージェントの構造、発動条件、システムプロンプト(指示文)の設計を理解することで、強力な自律機能を作成できます。

主な概念:

  • エージェント = 自律的な作業、コマンド = ユーザーが指示する操作
  • Markdown ファイル形式(先頭に YAML メタデータを含む)
  • 説明フィールドの例示を通じて発動
  • システムプロンプトがエージェントの動作を定義
  • モデルと色をカスタマイズ可能

エージェントのファイル構造

完全な形式

---
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:**
[返すべき内容]

メタデータフィールド

name(必須)

エージェントを識別し、呼び出すために使う名前。

形式: 小文字、数字、ハイフンのみ 文字数: 3~50字 ルール: 始まりと終わりは英数字で

良い例:

  • code-reviewer
  • test-generator
  • api-docs-writer
  • security-analyzer

悪い例:

  • helper(汎用すぎる)
  • -agent-(ハイフンで始まる/終わる)
  • my_agent(アンダースコアは使用不可)
  • ag(短すぎる、3字未満)

description(必須)

Claude がこのエージェントを発動する場面を定義します。最も重要なフィールド — エージェント登録時にコンテキストに読み込まれるため、ここで発動の判断が決まります。

必須の内容:

  1. 発動条件(「次のような場合に使用:」)
  2. 典型的なシナリオの簡潔な説明(文章形式)
  3. 本文の「When to invoke」セクションへの参照(詳細な例示)

形式:

Use this agent when [条件]. Typical triggers include [シナリオ1を文章で], [シナリオ2を文章で], and [シナリオ3を文章で]. See "When to invoke" in the agent body for worked scenarios.

ベストプラクティス:

  • 2~4個の発動シナリオを文章で記述する
  • 主動的な発動(AI が自ら判断)と受動的な発動(ユーザー指示)の両方を含める
  • 同じ意図の異なる言い方を含める
  • エージェントを使う「べきでない」場面も明記する
  • 詳細なシナリオは本文の「When to invoke」に箇条書き形式で記述する

model(必須)

エージェントが使用するモデル。

オプション:

  • inherit — 親と同じモデルを使う(推奨)
  • sonnet — Claude Sonnet(バランス型)
  • opus — Claude Opus(最も高性能、高コスト)
  • haiku — Claude Haiku(高速、低コスト)

推奨: 特別な理由がない限り inherit を使用してください。

color(必須)

UI 上でエージェントを区別するための色。

オプション: blue、cyan、green、yellow、magenta、red

ガイドライン:

  • 同じプラグイン内の異なるエージェントには異なる色を選ぶ
  • 同じ種類のエージェント同士は色を統一する
  • 青/シアン:分析や審査
  • 緑:成功志向のタスク
  • 黄:注意、検証
  • 赤:重要度が高い、セキュリティ関連
  • マゼンタ:創造的、生成タスク

tools(オプション)

エージェントが使用できるツールを限定します。

形式: ツール名の配列

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]: [対応方法]

ベストプラクティス

✅ すべき:

  • 二人称で書く(「You are...」「You will...」)
  • 責任内容を具体的に述べる
  • 段階的なプロセスを示す
  • 出力形式を定義する
  • 品質基準を含める
  • エッジケース(予期しない状況)に対応する
  • 10,000字以内に収める

❌ してはいけない:

  • 一人称で書く(「I am...」「I will...」)
  • 曖昧または汎用的な表現
  • プロセスステップの省略
  • 出力形式を未定義のまま
  • 品質に関するガイダンスをスキップ
  • エラーケースを無視

エージェントの作成

方法1:AI による生成補助

このプロンプトパターンを使用してください(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 を参照してください。

方法2:手作業による作成

  1. エージェント識別子を決める(3~50字、小文字、ハイフン)
  2. 発動条件と例を含む説明を書く
  3. モデルを選ぶ(通常は inherit)
  4. UI 識別用の色を選ぶ
  5. ツールを定義する(アクセスを制限する場合)
  6. 上記の構成に従ってシステムプロンプトを書く
  7. agents/agent-name.md として保存

検証ルール

識別子の検証

✅ 有効: code-reviewer, test-gen, api-analyzer-v2
❌ 無効: ag(短すぎ), -start(ハイフンで始まる), my_agent(アンダースコア使用)

ルール:

  • 3~50字
  • 小文字、数字、ハイフンのみ
  • 始まりと終わりは英数字
  • アンダースコア、スペース、特殊文字は不可

説明の検証

文字数: 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-name
  • サブディレクトリ付き:plugin:subdir:agent-name

エージェントのテスト

発動のテスト

エージェントが正しく発動するか検証するシナリオを作成してください:

  1. 発動例を含むエージェントを書く
  2. テストで例と似た表現を使う
  3. Claude がエージェントを読み込むか確認する
  4. エージェントが期待される動作をするか検証する

システムプロンプトのテスト

システムプロンプトが完全か確認してください:

  1. エージェントに典型的なタスクを与える
  2. プロセスステップに従っているか確認
  3. 出力形式が正しいか検証
  4. プロンプトに記載されたエッジケースをテストする
  5. 品質基準が満たされているか確認する

クイックリファレンス

最小限のエージェント

---
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"]

ベストプラクティス

すべき:

  • ✅ 説明に 2~4個の発動シナリオを文章で記載する
  • ✅ 詳細な実例は本文の「When to invoke」セクションに箇条書きで書く
  • ✅ 具体的な発動条件を書く
  • ✅ 特別な理由がない限り 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 — エージェントファイルの構造を検証
原文(English)を表示

Agent Development for Claude Code Plugins

Overview

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:

  • Agents are FOR autonomous work, commands are FOR user-initiated actions
  • Markdown file format with YAML frontmatter
  • Triggering via description field with examples
  • System prompt defines agent behavior
  • Model and color customization

Agent File Structure

Complete Format

---
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]

Frontmatter Fields

name (required)

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-reviewer
  • test-generator
  • api-docs-writer
  • security-analyzer

Bad examples:

  • helper (too generic)
  • -agent- (starts/ends with hyphen)
  • my_agent (underscores not allowed)
  • ag (too short, < 3 chars)

description (required)

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:

  1. Triggering conditions ("Use this agent when...")
  2. A short prose summary of the typical trigger scenarios
  3. A pointer to a "When to invoke" section in the agent body for the detailed worked scenarios

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:

  • Name 2-4 trigger scenarios in the prose summary
  • Cover both proactive (assistant invokes itself) and reactive (user requests) triggering
  • Cover different phrasings of the same intent
  • Be specific about when NOT to use the agent
  • Put detailed scenarios in the body under "When to invoke" as a bullet list of prose descriptions

model (required)

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.

color (required)

Visual identifier for agent in UI.

Options: blue, cyan, green, yellow, magenta, red

Guidelines:

  • Choose distinct colors for different agents in same plugin
  • Use consistent colors for similar agent types
  • Blue/cyan: Analysis, review
  • Green: Success-oriented tasks
  • Yellow: Caution, validation
  • Red: Critical, security
  • Magenta: Creative, generation

tools (optional)

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-only analysis: ["Read", "Grep", "Glob"]
  • Code generation: ["Read", "Write", "Grep"]
  • Testing: ["Read", "Bash", "Grep"]
  • Full access: Omit field or use ["*"]

System Prompt Design

The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly.

Structure

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]

Best Practices

✅ DO:

  • Write in second person ("You are...", "You will...")
  • Be specific about responsibilities
  • Provide step-by-step process
  • Define output format
  • Include quality standards
  • Address edge cases
  • Keep under 10,000 characters

❌ DON'T:

  • Write in first person ("I am...", "I will...")
  • Be vague or generic
  • Omit process steps
  • Leave output format undefined
  • Skip quality guidance
  • Ignore error cases

Creating Agents

Method 1: AI-Assisted Generation

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.

Method 2: Manual Creation

  1. Choose agent identifier (3-50 chars, lowercase, hyphens)
  2. Write description with examples
  3. Select model (usually inherit)
  4. Choose color for visual identification
  5. Define tools (if restricting access)
  6. Write system prompt with structure above
  7. Save as agents/agent-name.md

Validation Rules

Identifier Validation

✅ Valid: code-reviewer, test-gen, api-analyzer-v2
❌ Invalid: ag (too short), -start (starts with hyphen), my_agent (underscore)

Rules:

  • 3-50 characters
  • Lowercase letters, numbers, hyphens only
  • Must start and end with alphanumeric
  • No underscores, spaces, or special characters

Description Validation

Length: 10-5,000 characters Must include: Triggering conditions and examples Best: 200-1,000 characters with 2-4 examples

System Prompt Validation

Length: 20-10,000 characters Best: 500-3,000 characters Structure: Clear responsibilities, process, output format

Agent Organization

Plugin Agents Directory

plugin-name/
└── agents/
    ├── analyzer.md
    ├── reviewer.md
    └── generator.md

All .md files in agents/ are auto-discovered.

Namespacing

Agents are namespaced automatically:

  • Single plugin: agent-name
  • With subdirectories: plugin:subdir:agent-name

Testing Agents

Test Triggering

Create test scenarios to verify agent triggers correctly:

  1. Write agent with specific triggering examples
  2. Use similar phrasing to examples in test
  3. Check Claude loads the agent
  4. Verify agent provides expected functionality

Test System Prompt

Ensure system prompt is complete:

  1. Give agent typical task
  2. Check it follows process steps
  3. Verify output format is correct
  4. Test edge cases mentioned in prompt
  5. Confirm quality standards are met

Quick Reference

Minimal Agent

---
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]

Frontmatter Fields Summary

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"]

Best Practices

DO:

  • ✅ Name 2-4 trigger scenarios in the description (as prose)
  • ✅ Put detailed worked scenarios in a "When to invoke" body section, as prose bullets
  • ✅ Write specific triggering conditions
  • ✅ Use inherit for model unless specific need
  • ✅ Choose appropriate tools (least privilege)
  • ✅ Write clear, structured system prompts
  • ✅ Test agent triggering thoroughly

DON'T:

  • ❌ Use generic descriptions without trigger scenarios
  • ❌ Omit triggering conditions
  • ❌ Give all agents same color
  • ❌ Grant unnecessary tool access
  • ❌ Write vague system prompts
  • ❌ Skip testing

Additional Resources

Reference Files

For detailed guidance, consult:

  • references/system-prompt-design.md - Complete system prompt patterns
  • references/triggering-examples.md - Example formats and best practices
  • references/agent-creation-system-prompt.md - The exact prompt from Claude Code

Example Files

Working examples in examples/:

  • agent-creation-prompt.md - AI-assisted agent generation template
  • complete-agent-examples.md - Full agent examples for different use cases

Utility Scripts

Development tools in scripts/:

  • validate-agent.sh - Validate agent file structure
  • test-agent-trigger.sh - Test if agent triggers correctly

Implementation Workflow

To create an agent for a plugin:

  1. Define agent purpose and triggering conditions
  2. Choose creation method (AI-assisted or manual)
  3. Create agents/agent-name.md file
  4. Write frontmatter with all required fields
  5. Write system prompt following best practices
  6. Name 2-4 trigger scenarios in description (prose) and detail them in a "When to invoke" body section
  7. Validate with scripts/validate-agent.sh
  8. Test triggering with real scenarios
  9. Document agent in plugin README

Focus on clear triggering conditions and comprehensive system prompts for autonomous operation.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。