Skip to main content
Agents are specialized AI assistants with deep knowledge in specific domains. They act as expert team members, each with their own skills, tools, and workflows tailored to particular development tasks.

What Are Agents?

Agents are markdown files (.md) stored in .claude/agents/ that define:
  • Expertise area - Domain knowledge and specialization
  • Tools - Which Claude Code tools the agent can use
  • Model - Which Claude model to use (sonnet, opus, haiku)
  • Instructions - How the agent approaches tasks
  • Communication patterns - How the agent interacts with users and other agents
Agents are essentially specialized prompts that Claude Code loads when invoked. They provide consistent, expert-level assistance for specific tasks.

Agent Structure

Agents use YAML frontmatter followed by markdown instructions:

Frontmatter Fields

Agent Categories

Agents are organized by domain expertise:
Core development specialists:
  • frontend-developer - React, Vue, Angular expert
  • backend-developer - API and server-side development
  • fullstack-developer - End-to-end application development
  • mobile-developer - iOS and Android applications
  • devops-engineer - Infrastructure and deployment

Using Agents

Installation

Install agents using the CLI:

Invocation

Once installed, agents are available in Claude Code:
Or reference them in conversations:
Agents appear in Claude Code’s agent picker automatically after installation.

Real-World Examples

Example 1: Frontend Developer Agent

File: .claude/agents/frontend-developer.md

Execution Flow

  1. Context Discovery - Map existing frontend landscape
  2. Development Execution - Build components with TypeScript
  3. Handoff and Documentation - Deliver with tests and docs
@frontend-developer Create a dashboard with real-time data visualization using React and TypeScript
@api-security-audit Review the authentication endpoints in src/api/auth.js
This prevents redundant questions and ensures agents have full context.

Agent-to-Agent Handoffs

Agents can delegate specialized tasks:

Tool Permissions

Agents specify which tools they need:
Only grant agents the minimum tools they need. A documentation agent doesn’t need Bash access.

Model Selection

Choose the right model for each agent:
Best for: Most development tasks
  • Balanced performance and cost
  • 200K context window
  • Strong coding capabilities
  • Good for agents that need to read/write code

Creating Custom Agents

You can create your own agents:
1

Create Agent File

Create .claude/agents/my-agent.md
2

Add Frontmatter

Define name, description, tools, and model
3

Write Instructions

Provide clear, specific instructions for the agent’s behavior
4

Test

Invoke the agent in Claude Code: @my-agent Task description
For detailed guidance on creating agents, see Creating Components.

Agent Best Practices

1. Clear Scope Definition

Define exactly when to use the agent:

2. Context Gathering

Always gather context before starting work:
  • Query context-manager for project information
  • Check existing patterns and conventions
  • Validate assumptions with targeted questions

3. Structured Communication

Provide clear status updates:

4. Documentation

Document all deliverables:
  • File locations and purposes
  • Integration points
  • Configuration changes
  • Next steps

Global Agents

Create agents that work across all projects:
Global agents are stored in ~/.claude/agents/ and available everywhere.

Next Steps

Browse Agent Library

Explore 400+ available agents

Create Custom Agents

Build your own specialized agents

Commands

Learn about custom slash commands

Global Agents

Create globally accessible agents