create-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

create-agent

create-agent

新規サブエージェント定義を
.claude/agents/<category>/<name>.md
として scaffold し、品質チェックまで自動化します。
Scaffolds new sub-agent definitions as
.claude/agents/<category>/<name>.md
and automates the process up to quality checks.

使い方

Usage

/create-agent quality/lint-runner     # カテゴリ指定で作成
/create-agent research/doc-fetcher    # research カテゴリに追加
/create-agent author/template-writer  # author カテゴリに追加
/create-agent                         # 引数省略時はインタラクティブに確認
サブエージェントの雛形は本スキル同梱の
sample/agent.sample.md
を参照します。
/create-agent quality/lint-runner     # Create with specified category
/create-agent research/doc-fetcher    # Add to research category
/create-agent author/template-writer  # Add to author category
/create-agent                         # Interactive confirmation when arguments are omitted
Refer to
sample/agent.sample.md
included with this skill for the sub-agent template.

カテゴリと model 選定指針

Category and Model Selection Guidelines

カテゴリパス役割推奨 model
research/
.claude/agents/research/
調査・情報収集・WebFetch
sonnet
author/
.claude/agents/author/
作成・編集(Edit/Write/Bash を使用)
sonnet
quality/
.claude/agents/quality/
レビュー・lint・検証(読み取り専用)
sonnet
(推論・レビュー)/
haiku
(機械的 lint のみ)
CategoryPathRoleRecommended Model
research/
.claude/agents/research/
Research, information gathering, WebFetch
sonnet
author/
.claude/agents/author/
Creation, editing (uses Edit/Write/Bash)
sonnet
quality/
.claude/agents/quality/
Review, linting, validation (read-only)
sonnet
(inference/review) /
haiku
(mechanical linting only)

model 詳細基準

Detailed Model Criteria

ユースケースmodel
機械的・集計・lint・frontmatter 検証
haiku
読解・生成・レビュー・調査
sonnet
複雑な設計判断・アーキテクチャ
opus
Use Casemodel
Mechanical, aggregation, linting, frontmatter validation
haiku
Reading comprehension, generation, review, research
sonnet
Complex design decisions, architecture
opus

tools 最小権限原則

Tools Least Privilege Principle

Agent カテゴリ許可ツール
読み取り専用(research/・quality/)
Read
Glob
Grep
のみ
作成・編集(author/)上記 +
Edit
Write
Bash
読み取り専用 Agent には
Edit
Write
Bash
含めない
Agent CategoryAllowed Tools
Read-only (research/・quality/)Only
Read
,
Glob
,
Grep
Creation/editing (author/)Above +
Edit
,
Write
,
Bash
Do not include
Edit
,
Write
, or
Bash
in read-only Agents.

subagent フォールバック(skills add 導入先向け)

Subagent Fallback (for skills add adopters)

本スキルが委譲する subagent(
agent-author
frontmatter-linter
)は Fandhe-AI/agent-cli-skills リポジトリの
.claude/agents/
定義を前提とする。導入先リポジトリに該当 subagent が存在しない場合は委譲せず、各 Step の委譲プロンプトに記載した入力・適用ルール・必須項目を main が直接実行して同じ成果物を作成する
frontmatter-linter
の代替としては Step 4 の検証観点の手動確認で足りる。適用ルール(
dotclaude-via-temp.md
等)は導入先に存在するもののみ適用し、存在しない場合は
.claude/agents/
へ直接作成してよい。
The subagents delegated by this skill (
agent-author
frontmatter-linter
) assume the
.claude/agents/
definitions from the Fandhe-AI/agent-cli-skills repository. If the corresponding subagent does not exist in the target repository, do not delegate; instead, the main skill will directly execute the input, application rules, and required items described in the delegation prompt for each step to create the same artifact. Manual confirmation of the validation points in Step 4 is sufficient as an alternative to
frontmatter-linter
. Apply only the rules that exist in the target repository (such as
dotclaude-via-temp.md
); if they do not exist, you may create them directly in
.claude/agents/
.

フロー

Flow

Step 1: カテゴリと responsibilities を確認する

Step 1: Confirm Category and Responsibilities

引数から
<category>/<agent-name>
を解析する。
  • カテゴリが
    research/
    author/
    quality/
    のいずれかであることを確認する
  • 上記以外のカテゴリが指定された場合はユーザーに確認して適切なカテゴリを選択する
  • Agent の責務(担当スコープ、委譲される場面)をユーザーに確認する
Parse
<category>/<agent-name>
from the arguments.
  • Verify that the category is one of
    research/
    ,
    author/
    , or
    quality/
  • If a category outside the above is specified, confirm with the user to select an appropriate category
  • Confirm the Agent's responsibilities (scope, scenarios for delegation) with the user

Step 2: agent-author に委譲してファイルを作成する

Step 2: Delegate to agent-author to Create File

**agent-author(subagent_type: agent-author)**に委譲してファイルを作成させる(存在しない場合は「subagent フォールバック」に従い main が直接作成する)。
重要:
agent-author
dotclaude-via-temp.md
に従い、
_/dotclaude/agents/<category>/<name>.md
を経由して最終配置する(
.claude/agents/
への直接書き込みは行わない)。
委譲プロンプト例:
subagent_type: agent-author
prompt: |
  目的: <category>/<agent-name> のサブエージェント定義を作成する
  入力:
    - Agent 名: <agent-name>
    - カテゴリ: <category>(research/author/quality/)
    - 役割・責務: <ユーザーから受け取った内容>
    - 雛形: 本スキル同梱の sample/agent.sample.md
    - 既存 Agent の参考: .claude/agents/ 配下の既存ファイル
  出力先: .claude/agents/<category>/<agent-name>.md
  適用ルール:
    - .claude/rules/agent-authoring.md(frontmatter・tools 最小権限・カテゴリ配置・本文骨子)
    - .claude/rules/dotclaude-via-temp.md(_/dotclaude/ 経由で作成して mv で最終配置)
  必須項目:
    - frontmatter: name(kebab-case), description(委譲される場面を具体的に記載),
                   model(選定基準に従う), tools(最小権限の原則)
    - 本文: # Agent名 → ## 役割 → ## 対象スコープ → ## 遵守する規約 → ## 手順/観点 →
            ## 完了条件 → ## 報告フォーマット
    - 読み取り専用 Agent には Edit・Write・Bash を含めない
Delegate to agent-author (subagent_type: agent-author) to create the file (if it does not exist, the main skill will create it directly according to "Subagent Fallback").
Important:
agent-author
follows
dotclaude-via-temp.md
and finalizes the placement via
_/dotclaude/agents/<category>/<name>.md
(does not write directly to
.claude/agents/
).
Example Delegation Prompt:
subagent_type: agent-author
prompt: |
  Purpose: Create a sub-agent definition for <category>/<agent-name>
  Input:
    - Agent Name: <agent-name>
    - Category: <category> (research/author/quality/)
    - Role & Responsibilities: <content received from user>
    - Template: sample/agent.sample.md included with this skill
    - Reference Existing Agents: Existing files under .claude/agents/
  Output Path: .claude/agents/<category>/<agent-name>.md
  Application Rules:
    - .claude/rules/agent-authoring.md (frontmatter, tools least privilege, category placement, body outline)
    - .claude/rules/dotclaude-via-temp.md (create via _/dotclaude/ and finalize with mv)
  Required Items:
    - frontmatter: name (kebab-case), description (specifically describe delegation scenarios),
                   model (follow selection criteria), tools (least privilege principle)
    - Body: # Agent Name → ## Role → ## Target Scope → ## Compliance Rules → ## Procedures/Perspectives →
            ## Completion Criteria → ## Report Format
    - Do not include Edit, Write, or Bash in read-only Agents

Step 3: model 選定と tools 設定を確認する

Step 3: Confirm Model Selection and Tools Configuration

agent-author
の作成結果を確認し、以下を検証する。
  • model
    がカテゴリ・用途に合った選定になっているか
  • tools
    が最小権限原則を守っているか
  • quality/
    カテゴリなのに
    Edit
    Write
    Bash
    が含まれていないか
Review the creation result from
agent-author
and verify the following:
  • Whether
    model
    is appropriately selected for the category and use case
  • Whether
    tools
    adhere to the least privilege principle
  • Whether
    Edit
    ,
    Write
    , or
    Bash
    are not included for
    quality/
    category Agents

Step 4: frontmatter-linter で検証する

Step 4: Validate with frontmatter-linter

**frontmatter-linter(subagent_type: frontmatter-linter)**に委譲して検証させる(存在しない場合は下記観点の手動確認で代替する)。
検証観点:
  • name
    が kebab-case で正しく設定されているか
  • model
    が規定値(haiku/sonnet/opus)のいずれかか
  • tools
    に最小権限を超えるものが含まれていないか
  • description
    が委譲される場面を具体的に説明しているか
  • .claude/agents/<category>/
    に正しく配置されているか
問題があれば
agent-author
に差し戻して修正させる。
Delegate to frontmatter-linter (subagent_type: frontmatter-linter) for validation (if it does not exist, substitute with manual confirmation of the following points).
Validation Points:
  • Whether
    name
    is correctly set in kebab-case
  • Whether
    model
    is one of the specified values (haiku/sonnet/opus)
  • Whether
    tools
    do not include items exceeding least privilege
  • Whether
    description
    specifically explains delegation scenarios
  • Whether it is correctly placed in
    .claude/agents/<category>/
If there are issues, send it back to
agent-author
for correction.

Step 5: CLAUDE.md の Sub-agents 表更新を案内する

Step 5: Guide to Update Sub-agents Table in CLAUDE.md

Agent 追加が完了したら以下を案内する。
✅ .claude/agents/<category>/<agent-name>.md を作成しました。

Agent の frontmatter 概要:
  name: <agent-name>
  model: <model>
  tools: [<tool-list>]

CLAUDE.md の Sub-agents 表・構造ツリーを更新するには:
  /update-docs
を実行してください。

このサブエージェントを呼び出すには、スキル内で以下を使用します:
  subagent_type: <agent-name>
After Agent addition is complete, guide the user with the following:
✅ Created .claude/agents/<category>/<agent-name>.md

Agent frontmatter summary:
  name: <agent-name>
  model: <model>
  tools: [<tool-list>]

To update the Sub-agents table and structure tree in CLAUDE.md:
  /update-docs
Please execute the above command.

To call this sub-agent within a skill, use:
  subagent_type: <agent-name>

検証

Validation

  1. .claude/agents/<category>/<agent-name>.md
    が正しいパスに存在することを確認する(
    agent-author
    が dotclaude-via-temp に従い
    _/dotclaude/agents/
    への一時作成から
    .claude/agents/
    への
    mv
    まで一貫して実行するため、
    create-agent
    側で
    mv
    を別途実行する必要はない)
  2. frontmatter の
    name:
    フィールドが
    <agent-name>
    と一致していることを確認する
  3. tools
    リストがカテゴリの最小権限ポリシーを遵守していることを確認する
  4. subagent_type: <agent-name>
    で呼び出せる状態になっているか確認する
  1. Confirm that
    .claude/agents/<category>/<agent-name>.md
    exists in the correct path (since
    agent-author
    follows dotclaude-via-temp to execute everything from temporary creation in
    _/dotclaude/agents/
    to
    mv
    to
    .claude/agents/
    , there is no need for
    create-agent
    to execute
    mv
    separately)
  2. Confirm that the
    name:
    field in frontmatches
    <agent-name>
  3. Confirm that the
    tools
    list complies with the category's least privilege policy
  4. Confirm that it can be called with
    subagent_type: <agent-name>

注意事項

Notes

  • dotclaude-via-temp 必須:
    agent-author
    .claude/agents/
    に直接書き込まず、
    _/dotclaude/agents/
    への一時作成から
    .claude/agents/
    への
    mv
    まで一貫して実行する。
    create-agent
    側で
    mv
    を別途実行する必要はない(詳細:
    .claude/rules/dotclaude-via-temp.md
  • rm -rf _/dotclaude
    は禁止
    :
    rmdir
    で空ディレクトリのみ削除する(他の並行作業との共有ディレクトリ)
  • 読み取り専用 Agent の tools:
    research/
    quality/
    カテゴリには
    Edit
    Write
    Bash
    を含めない
  • name の解決:
    subagent_type:
    による呼び出しは frontmatter の
    name:
    フィールドで解決される。カテゴリを移動しても呼び出しコードの変更が不要
  • update-docs の実行: Agent 追加後は必ず
    /update-docs
    CLAUDE.md
    を最新化する
  • dotclaude-via-temp is mandatory:
    agent-author
    does not write directly to
    .claude/agents/
    , but executes the entire process from temporary creation in
    _/dotclaude/agents/
    to
    mv
    to
    .claude/agents/
    . There is no need for
    create-agent
    to execute
    mv
    separately (details:
    .claude/rules/dotclaude-via-temp.md
    )
  • rm -rf _/dotclaude
    is prohibited
    : Only delete empty directories with
    rmdir
    (shared directory with other concurrent operations)
  • Tools for read-only Agents: Do not include
    Edit
    ,
    Write
    , or
    Bash
    in
    research/
    and
    quality/
    categories
  • Name resolution: Calls via
    subagent_type:
    are resolved using the
    name:
    field in frontmatter. No changes to calling code are needed even if the category is moved
  • Execute update-docs: Always run
    /update-docs
    to update
    CLAUDE.md
    after adding an Agent