Skip to main content
commandsSource-backedReview first Safety Privacy

Create Claude Code Subagents with /agents

Create and manage specialized Claude Code subagents using the interactive /agents command or Markdown definition files in .claude/agents/, with scoped tools, model selection, and isolated context.

by JSONbored·added 2025-10-25·
HarnessClaude Code
Invocation:/agents
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/sub-agents, https://github.com/JSONbored/awesome-claude/blob/main/content/commands/subagent-create.mdx
Safety notes
Subagents can be granted Bash, Write, and Edit tools, letting them execute commands and modify files; scope tools with the tools/disallowedTools frontmatter to enforce least privilege., permissionMode values acceptEdits, dontAsk, and especially bypassPermissions reduce or skip permission prompts; bypassPermissions lets a subagent run operations without approval (including writes to config directories) and should be used with caution., Background subagents run with permissions already granted in the session and auto-deny any tool call that would otherwise prompt, so review what tools a background subagent inherits., mcpServers in subagent frontmatter can connect external MCP servers; plugin subagents ignore the hooks, mcpServers, and permissionMode fields for security reasons.
Privacy notes
Project subagents in .claude/agents/ are checked into version control, so their system prompts and any embedded context are shared with collaborators; avoid putting secrets in subagent files., Persistent memory (memory: user/project/local) writes accumulated notes to ~/.claude/agent-memory/ or .claude/agent-memory(-local)/; project-scope memory can be committed to the repo., Subagent transcripts are stored under ~/.claude/projects/.../subagents/ as agent-*.jsonl and persist until cleaned up per the cleanupPeriodDays setting (default 30 days).
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-25

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

100/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

4 safety and 3 privacy notes across 3 risk areas. Review closely: credentials & tokens, permissions & scopes.

3 areas
  • SafetyPermissions & scopesSubagents can be granted Bash, Write, and Edit tools, letting them execute commands and modify files; scope tools with the tools/disallowedTools frontmatter to enforce least privilege.
  • SafetyPermissions & scopespermissionMode values acceptEdits, dontAsk, and especially bypassPermissions reduce or skip permission prompts; bypassPermissions lets a subagent run operations without approval (including writes to config directories) and should be used with caution.
  • SafetyCredentials & tokensBackground subagents run with permissions already granted in the session and auto-deny any tool call that would otherwise prompt, so review what tools a background subagent inherits.
  • SafetyPermissions & scopesmcpServers in subagent frontmatter can connect external MCP servers; plugin subagents ignore the hooks, mcpServers, and permissionMode fields for security reasons.
  • PrivacyCredentials & tokensProject subagents in .claude/agents/ are checked into version control, so their system prompts and any embedded context are shared with collaborators; avoid putting secrets in subagent files.
  • PrivacyPermissions & scopesPersistent memory (memory: user/project/local) writes accumulated notes to ~/.claude/agent-memory/ or .claude/agent-memory(-local)/; project-scope memory can be committed to the repo.
  • PrivacyExecution & processesSubagent transcripts are stored under ~/.claude/projects/.../subagents/ as agent-*.jsonl and persist until cleaned up per the cleanupPeriodDays setting (default 30 days).

Safety notes

  • Subagents can be granted Bash, Write, and Edit tools, letting them execute commands and modify files; scope tools with the tools/disallowedTools frontmatter to enforce least privilege.
  • permissionMode values acceptEdits, dontAsk, and especially bypassPermissions reduce or skip permission prompts; bypassPermissions lets a subagent run operations without approval (including writes to config directories) and should be used with caution.
  • Background subagents run with permissions already granted in the session and auto-deny any tool call that would otherwise prompt, so review what tools a background subagent inherits.
  • mcpServers in subagent frontmatter can connect external MCP servers; plugin subagents ignore the hooks, mcpServers, and permissionMode fields for security reasons.

Privacy notes

  • Project subagents in .claude/agents/ are checked into version control, so their system prompts and any embedded context are shared with collaborators; avoid putting secrets in subagent files.
  • Persistent memory (memory: user/project/local) writes accumulated notes to ~/.claude/agent-memory/ or .claude/agent-memory(-local)/; project-scope memory can be committed to the repo.
  • Subagent transcripts are stored under ~/.claude/projects/.../subagents/ as agent-*.jsonl and persist until cleaned up per the cleanupPeriodDays setting (default 30 days).

Schema details

Install type
copy
Reading time
9 min
Difficulty score
100
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/sub-agentshttps://docs.claude.com/en/docs/claude-code/sub-agentshttps://code.claude.com/docs/en/cli-reference
Runtime and command metadata
Command syntax
/agents
Full copyable content
/agents

About this resource

Claude Code does not have a /subagent-create command. Subagents are created and managed with the built-in /agents command, by writing a Markdown file with YAML frontmatter under .claude/agents/ or ~/.claude/agents/, or by passing the --agents flag at launch. This entry documents the real workflow.

What a subagent is

A subagent is a specialized assistant that runs in its own context window with a custom system prompt, its own tool access, and independent permissions. When a task matches a subagent's description, Claude can delegate to it; the subagent works independently and returns only its result, keeping verbose output (logs, search results, file dumps) out of your main conversation.

Claude Code also ships built-in subagents that it uses automatically: Explore (fast, read-only codebase search on Haiku), Plan (read-only research during plan mode), and general-purpose (full tools for multi-step work).

The /agents command (recommended)

Run /agents in an interactive session to open a tabbed interface:

/agents
  • Running tab: lists live and recently finished subagents; open or stop them.
  • Library tab: view all available subagents (built-in, project, user, plugin), create new ones with guided setup or "Generate with Claude", edit configuration and tool access, and delete custom subagents.

Creating one through /agents walks you through: choosing a scope (Personal ~/.claude/agents/ or Project .claude/agents/), generating or writing the name/description/system prompt, selecting which tools it may use, picking a model, choosing a display color, and optionally enabling persistent memory. Subagents created through /agents take effect immediately, with no restart.

This is a built-in Claude Code command. There are no flags like --code-reviewer, --tools=, --parallel=, --status, or --list — those are not part of Claude Code.

Subagent definition files

A subagent is a Markdown file with YAML frontmatter followed by the system prompt body. Store it by scope:

Location Scope
.claude/agents/ Current project (check into version control)
~/.claude/agents/ All your projects (personal)
Plugin agents/ directory Where the plugin is enabled

Example .claude/agents/code-reviewer.md:

---
name: code-reviewer
description: Expert code review specialist. Use proactively after writing or modifying code.
tools: Read, Grep, Glob, Bash
model: inherit
---

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

When invoked:
1. Run git diff to see recent changes
2. Focus on modified files
3. Begin review immediately

Provide feedback by priority: Critical issues, Warnings, Suggestions.
Include specific examples of how to fix each issue.

If you edit a file on disk directly, restart the session to load it. (Files created through /agents load immediately.)

Supported frontmatter fields

Only name and description are required. Real fields from the documentation include:

  • name — unique lowercase-hyphen identifier (the filename need not match).
  • description — when Claude should delegate to this subagent.
  • tools — allowlist of tools (inherits all if omitted).
  • disallowedTools — denylist removed from the inherited/specified set.
  • modelsonnet, opus, haiku, fable, a full model ID (e.g. claude-opus-4-8), or inherit (default).
  • permissionModedefault, acceptEdits, auto, dontAsk, bypassPermissions, or plan.
  • skills — Skills to preload into the subagent's context.
  • mcpServers — MCP servers scoped to this subagent.
  • hooks — lifecycle hooks scoped to the subagent.
  • memory — persistent memory scope: user, project, or local.
  • maxTurns, effort, background, isolation (worktree), color, initialPrompt.

Scoping tools (least privilege)

Restrict capability with tools (allowlist) or disallowedTools (denylist). A read-only researcher:

---
name: safe-researcher
description: Research agent with restricted capabilities
tools: Read, Grep, Glob, Bash
---

If both fields are set, disallowedTools is applied first, then tools resolves against what remains. A tool listed in both is removed.

Session-scoped subagents via CLI

Define ephemeral subagents (not saved to disk) when launching:

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

Run an entire session as one subagent with claude --agent code-reviewer (its system prompt, tools, and model replace the defaults for the main thread).

Invoking subagents

  • Automatic delegation: Claude reads each subagent's description and the task to decide when to delegate. Add "use proactively" to the description to encourage it.
  • Natural language: "Use the code-reviewer subagent to look at my recent changes."
  • @-mention: type @ and pick the subagent (e.g. @agent-code-reviewer) to guarantee that subagent runs for the task.

When to use this

Reach for a subagent when a side task produces verbose output you do not need in the main context, when you want to enforce specific tool restrictions, or when self-contained work can return just a summary. For reusable prompts that run in the main context instead of an isolated one, consider Skills.

Source citations

Add this badge to your README

Show that Create Claude Code Subagents with /agents is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/commands/subagent-create.svg)](https://heyclau.de/entry/commands/subagent-create)

How it compares

Create Claude Code Subagents with /agents side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

2 trust signals differ across this comparison (Source provenance, Submitter).

Field

Create and manage specialized Claude Code subagents using the interactive /agents command or Markdown definition files in .claude/agents/, with scoped tools, model selection, and isolated context.

Open dossier

Delegate repository maintenance to Claude Code subagents: docs drift scans, dependency report triage, README sync checks, and stale issue grooming with scoped tools, read-first policies, and human merge gates.

Open dossier

Build autonomous agents with the Claude Agent SDK and Claude Code subagents: the query loop, built-in tools, subagent delegation, and permission controls.

Open dossier

A CLAUDE.md rule set that turns Claude into a prompt-engineering reviewer for coding work — enforcing explicit requirements, task decomposition, example-driven prompts, and context management.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceDiffersSource-backedSubmission linkedSource submissionSource-backedSource-backed
SubmitterDifferskiannidev
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
BrandGitHub Copilot logoGitHub Copilot
Categorycommandsguidesguidesrules
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredkiannidevJSONboredJSONbored
Added2025-10-252026-06-162025-10-272025-10-16
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesSubagents can be granted Bash, Write, and Edit tools, letting them execute commands and modify files; scope tools with the tools/disallowedTools frontmatter to enforce least privilege. permissionMode values acceptEdits, dontAsk, and especially bypassPermissions reduce or skip permission prompts; bypassPermissions lets a subagent run operations without approval (including writes to config directories) and should be used with caution. Background subagents run with permissions already granted in the session and auto-deny any tool call that would otherwise prompt, so review what tools a background subagent inherits. mcpServers in subagent frontmatter can connect external MCP servers; plugin subagents ignore the hooks, mcpServers, and permissionMode fields for security reasons.Maintenance subagents can propose file edits and shell commands—start read-only and add write tools only after review policy exists. Parallel subagents multiply tool calls; cap concurrent maintenance runs on large monorepos to control cost and noise. Dependency upgrade suggestions require human verification against semver, license, and security advisories before merge.Agents built with the Agent SDK run real tools (Bash commands, file edits, web fetches) autonomously in your process and on your filesystem; scope capability with allowed_tools/permission_mode and review what each tool and connected MCP server can do before granting it.This rule is prompt guidance, not executable code, but its example prompts direct Claude to generate authentication and payment logic (bcrypt password hashing, JWT issuance, Stripe payments); review and test generated security- and money-handling code before using it in production.
Privacy notesProject subagents in .claude/agents/ are checked into version control, so their system prompts and any embedded context are shared with collaborators; avoid putting secrets in subagent files. Persistent memory (memory: user/project/local) writes accumulated notes to ~/.claude/agent-memory/ or .claude/agent-memory(-local)/; project-scope memory can be committed to the repo. Subagent transcripts are stored under ~/.claude/projects/.../subagents/ as agent-*.jsonl and persist until cleaned up per the cleanupPeriodDays setting (default 30 days).Maintenance scans read internal docs, issue titles, dependency manifests, and CI configuration that may describe unreleased features. Subagent transcripts may retain file paths and package names from private forks; avoid pasting customer data into maintenance prompts. External MCP connectors can expose additional metadata—document what each maintenance subagent may read.The SDK authenticates with ANTHROPIC_API_KEY (or a third-party provider's credentials); keep the key in an environment variable, never in agent prompts or committed code. Connected MCP servers and the WebFetch/WebSearch tools can send project data to external systems.Example prompts reference credentials and third-party providers (JWT, Supabase auth, Stripe); keep API keys, tokens, and secrets in environment variables or a secrets manager and never paste them into prompts or commit them.
Prerequisites— none listed
  • Claude Code with subagents available for your account and project.
  • Recurring maintenance work that benefits from separate specialist context.
  • Documented human owners for merges, label changes, and dependency upgrades.
  • Optional MCP or GitHub integrations scoped to maintenance repositories only.
— none listed— none listed
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.