# claude-code-subagents-documentation-anthropic-2025-09-29

## Veille

Claude Code Subagents - Specialized AI Assistants - Context Management - Task Delegation - Anthropic Documentation

## Titre Article

Subagents - Claude Docs

## Date

2025-09-29

## URL

https://docs.anthropic.com/en/docs/claude-code/sub-agents

## Keywords

Claude Code, subagents, AI assistants, task-specific workflows, context management, system prompts, tools, delegation, code reviewer, debugger, data scientist, AI models, configuration, best practices, YAML frontmatter, Markdown files, tool permissions, `/agents` command

## Authors

Anthropic (documentation officielle)

## Ton

**Profile:** Professional-pedagogical | Instructional | Educational | Intermediate

The documentation adopts a standard technical writing tone, balancing thoroughness and accessibility. The systematic structure (Characteristics → Configuration → Examples → Best Practices) guides a progressive understanding. Precise technical terminology (YAML frontmatter, context windows, tool permissions) assumes a developer audience. Concrete code examples (code reviewer, debugger, data scientist) ground the abstract concepts. Prescriptive language for best practices provides clear guidance. Careful formatting, with clearly delineated sections, facilitates skim reading. No marketing discourse — purely instructional content. Typical quality of developer documentation (Stripe style, Anthropic docs) prioritizing clarity and practical usefulness.

## Pense-betes

- **Subagents = specialized AI assistants** with a specific purpose, separate context window, configurable tools, custom system prompt
- **Key benefits**: context preservation, specialized expertise, reusability, flexible tool permissions
- **Management via `/agents`** or direct files (Markdown + YAML frontmatter)
- **Configuration**: `name`, `description`, `tools` (optional), `model` (optional)
- **Invocation**: automatic by Claude Code or explicit by mentioning the name
- **File location**: `.claude/agents/` (project) or `~/.claude/agents/` (user)
- **Typical examples**: Code reviewer (Read, Grep, Glob, Bash), Debugger (Read, Edit, Bash, Grep, Glob), Data scientist (Bash, Read, Write)
- **Best practices**: start with Claude-generated agents, focused design, detailed prompts, limit tool access, version control for project agents
- **Chaining possible**: multiple subagents for complex workflows
- **Dynamic selection**: Claude chooses the appropriate subagent based on task/context

## RésuméDe400mots

The official Claude Code documentation introduces "subagents," specialized AI assistants designed to improve task-specific workflows and optimize context management within the development environment. These subagents are preconfigured AI personas to which Claude Code can delegate tasks, each operating with a distinct purpose and targeted domain expertise.

**Core Characteristics**

Each subagent has four essential attributes: an independent context window that avoids polluting the main conversational context, a configurable set of tools specific to its domain, and a customized system prompt guiding its behavior. This contextual isolation enables more focused and effective problem-solving, with fine-tuned instructions improving success rates on designated tasks.

**Structural Advantages**

Subagents offer four major benefits: **context preservation** by keeping the main conversation focused on high-level objectives, **specialized expertise** via detailed instructions for specific domains improving performance, **reusability** cross-projects with the ability to share across teams promoting consistent workflows, and **flexible permissions** with granular tool-access control per subagent type for enhanced security.

**Creation and Configuration**

Creation is initiated via the `/agents` command in Claude Code, allowing selection between project-level or user-level subagents. Users define the purpose and grant access to specific tools. Subagents are stored as Markdown files with YAML frontmatter: `.claude/agents/` for project-level, `~/.claude/agents/` for user-level. Configuration fields include `name` (unique identifier), `description` (purpose description), `tools` (optional comma-separated list), and `model` (optional specification such as `sonnet`, `opus`, `haiku`, or `inherit`).

**Practical Examples and Patterns**

The documentation provides three archetypal examples: **Code reviewer**, an expert in code quality and security using Read, Grep, Glob, Bash; **Debugger**, specialized in root cause analysis with Read, Edit, Bash, Grep, Glob; **Data scientist**, an expert in SQL and BigQuery analysis using Bash, Read, Write. These patterns illustrate how limiting tool access to the strict minimum improves security and focus.

**Management and Invocation**

The `/agents` command offers an interactive interface for viewing, creating, editing, deleting subagents, and managing tool permissions. Alternative: direct file management. Claude Code can automatically delegate tasks to subagents based on task description, subagent configuration, and current context. Explicit invocation is possible by mentioning the name.

**Best Practices and Advanced Use Cases**

Key recommendations include: starting with Claude-generated agents for initial calibration, designing focused subagents with clear responsibilities, writing detailed system prompts, limiting tool access to the strict minimum, and using version control for project subagents. Advanced uses include chaining multiple subagents for complex workflows and leveraging dynamic selection, where Claude automatically chooses the appropriate subagent based on context. This modular architecture enables flexible composition of specialized capabilities while maintaining separation of concerns and contextual clarity.

## GrapheDeConnaissance

- Anthropic —publie→ documentation subagents Claude Code (DOCUMENT, 0.99)
- Claude Code —utilise→ subagents (TECHNOLOGIE, 0.99)
- subagents —utilise→ context window séparé (CONCEPT, 0.98)
- subagents —utilise→ fichiers Markdown YAML frontmatter (TECHNOLOGIE, 0.97)
- Claude Code —permet→ subagents (CONCEPT, 0.98)
- subagents —améliore→ préservation du contexte (CONCEPT, 0.95)
- Claude Code —utilise→ Plan subagent (TECHNOLOGIE, 0.96)
- Plan subagent —s_applique_à→ plan mode (METHODOLOGIE, 0.97)
- subagents —permet→ chaînage de workflows (CONCEPT, 0.92)
- subagents —observé_dans→ répertoire .claude/agents/ (TECHNOLOGIE, 0.98)
- subagents —utilise→ MCP Tools (TECHNOLOGIE, 0.93)
- subagents —utilise→ agentId (CONCEPT, 0.9)

---
Canonical: https://www.thekb.eu/en/fiches/claude-code-subagents-documentation-anthropic-2025-09-29/
