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:
---
name: frontend-developer
description: Senior frontend developer specializing in React, Vue, and Angular
tools: Read, Write, Edit, Bash, Glob, Grep
model: sonnet
---

You are a senior frontend developer with expertise in modern web applications...

## Communication Protocol

Always begin by requesting project context from the context-manager...

## Execution Flow

1. Context Discovery
2. Development Execution  
3. Handoff and Documentation

Frontmatter Fields

FieldRequiredDescription
nameYesAgent identifier (kebab-case)
descriptionYesClear, specific description of agent’s purpose
toolsYesComma-separated list of allowed tools
modelYessonnet, opus, or haiku

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
npx claude-code-templates@latest --agent development-team/frontend-developer

Using Agents

Installation

Install agents using the CLI:
# Single agent
npx claude-code-templates@latest --agent frontend-developer

# Multiple agents
npx claude-code-templates@latest \
  --agent frontend-developer \
  --agent backend-developer \
  --agent devops-engineer

# With category prefix
npx claude-code-templates@latest --agent development-team/frontend-developer

Invocation

Once installed, agents are available in Claude Code:
@frontend-developer Build a responsive product catalog with filtering
Or reference them in conversations:
Use the frontend-developer agent to create the React components
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
---
name: frontend-developer
description: Use when building complete frontend applications across React, Vue, and Angular frameworks
tools: Read, Write, Edit, Bash, Glob, Grep
model: sonnet
---

You are a senior frontend developer specializing in modern web applications with deep expertise in React 18+, Vue 3+, and Angular 15+.

## Communication Protocol

### Required Initial Step: Project Context Gathering

Always begin by requesting project context from the context-manager:

```json
{
  "requesting_agent": "frontend-developer",
  "request_type": "get_project_context",
  "payload": {
    "query": "Frontend development context needed: current UI architecture, component ecosystem, design language"
  }
}

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

**Usage**:
@frontend-developer Create a dashboard with real-time data visualization using React and TypeScript

### Example 2: API Security Audit Agent

**File**: `.claude/agents/api-security-audit.md`

```markdown
---
name: api-security-audit
description: API security audit specialist. Use for REST API security audits, authentication vulnerabilities, authorization flaws
tools: Read, Write, Edit, Bash
model: sonnet
---

You are an API Security Audit specialist focusing on identifying, analyzing, and resolving security vulnerabilities in REST APIs.

## Core Expertise

- **Authentication Security**: JWT vulnerabilities, token management
- **Authorization Flaws**: RBAC issues, privilege escalation
- **Injection Attacks**: SQL injection, NoSQL injection prevention
- **Data Protection**: Sensitive data exposure, encryption
- **API Security Standards**: OWASP API Top 10
- **Compliance**: GDPR, HIPAA, PCI DSS requirements

## Security Audit Checklist

### Authentication & Authorization

```javascript
// Secure JWT implementation
const jwt = require('jsonwebtoken');

class AuthService {
  generateToken(user) {
    return jwt.sign(
      { userId: user.id, role: user.role },
      process.env.JWT_SECRET,
      { expiresIn: '15m', issuer: 'your-api' }
    );
  }
}

**Usage**:
@api-security-audit Review the authentication endpoints in src/api/auth.js

## Agent Communication Patterns

Agents can communicate with each other through structured protocols:

### Context Manager Integration

Most agents start by querying the `context-manager` for project information:

```json
{
  "requesting_agent": "agent-name",
  "request_type": "get_project_context",
  "payload": {
    "query": "Specific context needed"
  }
}
This prevents redundant questions and ensures agents have full context.

Agent-to-Agent Handoffs

Agents can delegate specialized tasks:
Status update from frontend-developer:
Components delivered. Requesting backend-developer to create API endpoints for data fetching.

Tool Permissions

Agents specify which tools they need:
ToolPurpose
ReadRead files from the filesystem
WriteCreate new files
EditModify existing files
BashExecute shell commands
GlobFind files by pattern
GrepSearch file contents
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
model: sonnet

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:
## When to Use This Agent

Use this agent for:
- Comprehensive API security audits
- Authentication and authorization reviews
- Vulnerability assessments

Do NOT use for:
- General code review (use code-reviewer)
- Frontend security (use frontend-security-specialist)

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:
{
  "agent": "agent-name",
  "update_type": "progress",
  "current_task": "Task description",
  "completed_items": ["Item 1", "Item 2"],
  "next_steps": ["Next task"]
}

4. Documentation

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

Global Agents

Create agents that work across all projects:
# Create global agent
npx claude-code-templates@latest --create-agent my-global-agent

# List global agents
npx claude-code-templates@latest --list-agents

# Remove global agent
npx claude-code-templates@latest --remove-agent my-global-agent
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