本文へ移動
cccskills
無料GitHub で公開

claude-subagent-reference

Claude Code subagent runtime and plugin-agent reference. Use when creating, configuring, or debugging subagent definitions, nested spawning, startup context, model precedence, or plugin field restrictions.

インストール方法を見る

含まれるファイル(8)

  • SKILL.md12.6 KB
  • references/agent-teams.md7.0 KB
  • references/example-subagents.md6.0 KB
  • references/fork-mode.md3.4 KB
  • references/hooks-for-subagents.md5.8 KB
  • references/memory-and-context.md6.6 KB
  • references/model-and-effort.md4.3 KB
  • references/tool-and-permission-control.md7.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

SOURCE: https://code.claude.com/docs/en/sub-agents (accessed 2026-09-24)

Claude Code Subagents — Reference

Subagents are specialized AI assistants that run in their own context window with custom system prompts, specific tool access, and independent permissions. Use one when a task would flood your main conversation with output you won't reference again; the subagent does the work in its own context and returns only a summary.

Subagents help you:

  • Preserve context by keeping exploration and implementation out of your main conversation
  • Enforce constraints by limiting which tools a subagent can use
  • Reuse configurations across projects with user-level subagents
  • Control costs by routing tasks to faster, cheaper models like Haiku

Subagents can spawn nested subagents up to three layers below the main conversation by default. Set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH; 1 disables nesting. At the limit Claude Code withholds Agent, except forks retain it and receive an error. Interactive launchers wait for background children; non-interactive launchers report late child results to the main conversation. A fork cannot spawn another fork.

SOURCE: https://code.claude.com/docs/en/sub-agents#let-subagents-spawn-their-own-subagents (accessed 2026-09-24)


Built-in subagents

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Built-in subagents (accessed 2026-05-28)

Claude Code includes built-in subagents. Explore and Plan skip CLAUDE.md files and the parent session's git status for speed. Every other built-in and custom subagent loads both.

AgentModelToolsPurpose
ExploreInheritsRead-onlyFile discovery, code search, codebase exploration. Thoroughness: quick / medium / very thorough
PlanInheritsRead-onlyCodebase research during plan mode
general-purposeInheritsAllComplex multi-step tasks requiring both exploration and modification
statusline-setupSonnet—Invoked automatically for /statusline
claude-code-guideHaiku—Invoked automatically for Claude Code questions

Explore inherits the main conversation model as of v2.1.198. On the Anthropic API the inherited model is capped at Opus; on other providers it inherits directly. A user or project agent named Explore overrides the built-in and uses its own model field.


Scope and file locations

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Choose the subagent scope (accessed 2026-05-28)

Subagent files are Markdown files with YAML frontmatter. When multiple subagents share the same name, the higher-priority location wins.

LocationScopePriority
Managed settingsOrganization-wide1 (highest)
--agents CLI flagCurrent session only2
.claude/agents/Current project3
~/.claude/agents/All your projects4
Plugin agents/ directoryWhere plugin is enabled5 (lowest)

Project subagents (.claude/agents/) are scanned recursively — subdirectories are allowed but do not affect the agent's name (identity comes only from the name frontmatter field). Keep name values unique across the whole tree.

Plugin subagents use scoped identifiers: agents/review/security.md in plugin my-plugin registers as my-plugin:review:security.

For plugin subagent security restrictions (hooks, mcpServers, permissionMode are silently ignored in plugin agents), see /claude-plugins-reference-2026.

Subagents load at session start. If you add or edit a subagent file directly on disk, restart your session to load it. Subagents created through the /agents interface take effect immediately.


Frontmatter fields

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Supported frontmatter fields (accessed 2026-05-28)

Project, user, and managed agents require name and description; all other fields are optional. Plugin agents still load without valid name frontmatter by using the file path. If their frontmatter does not parse, they use a generic plugin description and ignore its fields. Supply both fields for stable identity and accurate routing even though plugin loading has fallbacks.

FieldRequiredDescription
nameScope-dependentRequired outside plugins. Plugin agents fall back to their file path. Must not start with - or contain :. Hooks receive this as agent_type; filename need not match
descriptionScope-dependentRequired outside plugins. Write clearly for plugin routing even though invalid plugin frontmatter gets a generic fallback. Include "use proactively" to encourage automatic delegation
toolsNoCSV string or YAML list allowlist. Bare Agent enables depth-limited nested spawning in a subagent definition; parenthesized type lists apply only to claude --agent.
disallowedToolsNoCSV string or YAML list denylist.
modelNosonnet, opus, haiku, fable, full model ID, or inherit.
permissionModeNodefault, acceptEdits, auto, dontAsk, bypassPermissions, plan, or manual. Ignored for plugin agents.
maxTurnsNoMaximum agentic turns before the subagent stops
skillsNoSkills to preload into the subagent's context at startup. Full skill content is injected (not just the description). Cannot preload skills with disable-model-invocation: true. See /claude-skills-overview-2026 for skill authoring
mcpServersNoMCP servers available to this subagent. Each entry: a server name string (reuses parent connection) or an inline definition. Silently ignored for plugin subagents. Inline servers connect when the subagent starts and disconnect when it finishes
hooksNoLifecycle hooks scoped to this subagent. Silently ignored for plugin subagents. Stop hooks are auto-converted to SubagentStop at runtime. See ./references/hooks-for-subagents.md
memoryNoPersistent memory scope: user, project, or local. Enables cross-session learning. See ./references/memory-and-context.md
backgroundNoSet true to force background execution. Otherwise Claude Code chooses foreground or background from session and fork-mode rules
omitClaudeMdNoOmit user, project, and local CLAUDE.md files at startup
effortNoEffort level override when this subagent is active: low, medium, high, xhigh, max. Overrides session level but not CLAUDE_CODE_EFFORT_LEVEL env var. See ./references/model-and-effort.md
isolationNoSet worktree to run the subagent in a temporary git worktree (isolated repo copy). Auto-cleaned up if no changes made. Supported in plugin subagents. See ./references/memory-and-context.md
colorNoDisplay color in task list: red, blue, green, yellow, purple, orange, pink, or cyan
initialPromptNoAuto-submitted as the first user turn when this agent runs as the main session via --agent or the agent setting. Commands and skills are processed. Prepended to any user-provided prompt
experimentalNoExperimental subagent options

Plugin agents support the documented plugin subset, including omitClaudeMd, effort, and experimental. They ignore hooks, mcpServers, and permissionMode for security and do not support initialPrompt.

SOURCE: https://code.claude.com/docs/en/sub-agents#supported-frontmatter-fields and https://code.claude.com/docs/en/plugins-reference#agents (accessed 2026-09-24)


Tools not available in subagents

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Available tools (accessed 2026-05-28)

These tools are unavailable to subagents even when listed in the tools field (they depend on the main conversation's UI or session state):

  • AskUserQuestion
  • EnterPlanMode
  • ExitPlanMode (unless permissionMode: plan)
  • ScheduleWakeup
  • WaitForMcpServers

Minimal example

---
name: code-reviewer
description: Expert code reviewer. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.
tools: Read, Grep, Glob, Bash
model: inherit
---

You are a senior code reviewer ensuring high standards of code quality and security.

When invoked, run git diff to see recent changes, focus on modified files, and begin review immediately.

Provide feedback organized by priority: Critical issues (must fix), Warnings (should fix), Suggestions (consider improving).

Invocation patterns

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Invoke subagents explicitly (accessed 2026-05-28)

Three patterns in escalating strength:

Natural language — Claude decides whether to delegate:

Use the test-runner subagent to fix failing tests

@-mention — guarantees this specific subagent runs for one task (type @ and pick from typeahead, or type manually):

@"code-reviewer (agent)" look at the auth changes

For plugin subagents, type @agent- followed by the scoped name, for example @agent- + my-plugin:code-reviewer.

Session-wide — entire session uses this subagent's system prompt, tool restrictions, and model:

claude --agent code-reviewer

For plugin subagents with name conflicts, use the scoped name: claude --agent my-plugin:security-reviewer

Set as project default in .claude/settings.json:

{ "agent": "code-reviewer" }

The --agent CLI flag overrides the agent setting when both are present.


CLI-defined subagents

SOURCE: https://code.claude.com/docs/en/sub-agents.md § Choose the subagent scope (accessed 2026-05-28)

Define subagents in JSON at launch — exist only for that session:

claude --agents '{
  "code-reviewer": {
    "description": "Expert code reviewer. Use proactively after code changes.",
    "prompt": "You are a senior code reviewer...",
    "tools": ["Read", "Grep", "Glob", "Bash"],
    "model": "sonnet"
  }
}'

The --agents flag accepts the same fields as file-based frontmatter. Use prompt for the system prompt (equivalent to the markdown body in file-based subagents).


Key environment variables

SOURCE: https://code.claude.com/docs/en/env-vars.md (accessed 2026-05-28)

VariablePurpose
CLAUDE_CODE_SUBAGENT_MODELDefault after per-invocation and frontmatter selections; before parent inheritance
CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1Force the configured subagent-model default
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTHSet nested subagent depth; 1 disables nesting
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1Enable agent teams (v2.1.32+). See ./references/agent-teams.md
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1Disable all background task functionality
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE% of context capacity at which auto-compaction triggers (default ~95%)
TASK_MAX_OUTPUT_LENGTHMax characters in subagent output before truncation (default 32000, max 160000)
CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS=1Disable all built-in subagent types (non-interactive mode only)

Reference files

TopicFile
Tool allowlist/denylist, Agent() spawn restrictions, permission modes./references/tool-and-permission-control.md
Model aliases, CLAUDE_CODE_SUBAGENT_MODEL, effort levels./references/model-and-effort.md
Hooks in frontmatter vs settings.json, SubagentStart/Stop schemas./references/hooks-for-subagents.md
Memory scopes, what loads at startup, worktrees, compaction, resume./references/memory-and-context.md
Fork mode and /subtask./references/fork-mode.md
Agent teams vs subagents, enabling, best practices./references/agent-teams.md
Full example subagent definitions with hook scripts./references/example-subagents.md

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Add automated documentation updater to any Claude skill. Creates a Python sync script that downloads upstream docs, processes markdown for AI consumption, and maintains local cache with configurable refresh. Collects template variables, then delegates implementation through 5-phase workflow. Use when adding auto-updating reference documentation to plugins or skills.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

SAM-style feature initiation workflow — discovery through codebase analysis, architecture spec, task decomposition, validation, and context manifest. Use when a user asks to add a feature, plan a feature, or convert an idea into an executable SAM plan.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

Browser automation for AI agents using the agent-browser CLI and Playwright. Use when navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, logging into sites, or automating any browser task. Triggers on "open a website", "fill out a form", "click a button", "scrape data", "test this web app", "automate browser actions", or any programmatic web interaction request.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

Runs the description-drift experiment — spawns all Claude Code agents simultaneously to collect self-reported capabilities, then compares them against static frontmatter descriptions to reveal how reliable orchestrator routing based on descriptions actually is. Use when measuring description drift across the agent fleet, re-running the capability collection experiment, analyzing a specific agent's self-reported capabilities, or auditing whether frontmatter descriptions accurately reflect agent behavior.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

Create or adapt Claude Code agent definitions. Use when creating an agent, changing subagent configuration, selecting agent scope, or designing a specialized delegation role.

日本語の概要は準備中です。原文の説明を表示しています。

Jamie-BitFlight/claude_skills672026年10月12日 更新

Jamie-BitFlight のスキルをすべて見る

このスキルの問題を報告する