Skip to main content
Agents

Best agent configurations

The most effective Claude Code agent configurations: code review, testing, refactoring, documentation, and deployment agents.

The must-have agents

Claude Code has a catalog of specialized agents, each optimized for a specific type of task. Here are the most useful agents organized by domain, with practical usage examples.

How to invoke an agent?

Agents can be invoked in two ways: either Claude Code uses them automatically when it deems the situation appropriate (if your CLAUDE.md configures it), or you ask for them explicitly in your prompt. For example: "Use the code-reviewer agent to analyze my diff".

Development

TDD Guide

The TDD (Test-Driven Development) guide enforces a rigorous workflow that ensures every feature is covered by tests.

When to useFor any new feature or bug fix
What it doesWrites tests first (RED), implements the minimum (GREEN), then refactors (IMPROVE)
Key advantageGuarantees 80%+ test coverage from the start
# Explicit invocation
> Use the tdd-guide agent to implement an email address
> validation function with edge cases
# Claude Code will:
# 1. Write the tests (nominal, edge, error cases)
# 2. Verify the tests fail (RED)
# 3. Implement the minimum to make them pass (GREEN)
# 4. Refactor to improve quality (IMPROVE)
# 5. Verify final coverage

Code Reviewer

The review agent analyzes modified code and produces a structured report with fix suggestions.

When to useAfter each code modification, before a commit
What it doesAnalyzes the diff, identifies bugs, performance issues, security flaws
Key advantageSystematic and reproducible review, ranked by severity
# Explicit invocation
> Use the code-reviewer agent to analyze my latest changes
# Claude Code produces a report:
# - CRITICAL: SQL injection in user query (auth.ts:42)
# - HIGH: Unvalidated input variable (utils.ts:18)
# - MEDIUM: N+1 loop in product retrieval (api.ts:95)
# - LOW: Non-descriptive variable name (helpers.ts:12)

Build Error Resolver

This agent diagnoses and fixes build errors methodically.

When to useWhen the build fails and the error isn't obvious
What it doesAnalyzes the error message, identifies the root cause, proposes and applies the fix
Key advantageIncremental resolution, fixes one error at a time and re-verifies
# Explicit invocation
> The build is failing with "Module not found". Use the
> build-error-resolver agent to diagnose and fix it.
# Claude Code will:
# 1. Read the complete error message
# 2. Identify the missing module
# 3. Check if it's an import, dependency, or config issue
# 4. Apply the minimal fix
# 5. Rerun the build to verify

Architecture

Planner

The planning agent creates a structured implementation plan before touching any code.

When to useBefore any major refactoring or complex new feature
What it doesProduces a plan with PRD, architecture, system design, prioritized task list
Key advantagePrevents coding too fast without thinking, identifies risks upfront
# Explicit invocation
> Use the planner agent to plan the refactoring of the
> payment module. We want to migrate from Stripe v2 to v3
> and add Apple Pay support.
# Claude Code produces:
# - PRD: objectives, success criteria, out of scope
# - Architecture: diagram of impacted components
# - Risks: backward compatibility, data migration
# - Task plan: 12 ordered tasks with estimates
# - Validation criteria: tests to write for each step

Architect

The architect agent handles system design decisions and structural technical choices.

When to useFor architecture decisions that impact multiple modules
What it doesAnalyzes options, compares trade-offs, recommends an approach
Key advantageTakes into account scalability, maintainability, and performance constraints
# Explicit invocation
> Use the architect agent to decide whether we should
> use a monorepo or multi-repo for our new project
> with 3 microservices and a frontend.
# Claude Code analyzes:
# - Team size and organization
# - Deployment frequency
# - Code sharing between services
# - CI/CD complexity
# → Argued recommendation with ADR (Architecture Decision Record)

Security

Security Reviewer

The security agent performs a systematic code audit looking for vulnerabilities.

When to useBefore each commit, and in depth before each release
What it doesChecks for SQL injection, XSS, CSRF, plaintext secrets, vulnerable dependencies
Key advantageExhaustive checklist, nothing gets missed
# Explicit invocation
> Use the security-reviewer agent to audit the
> authentication module before the release.
# Claude Code checks:
# No hardcoded secrets in source code
# All user inputs are validated
# Parameterized SQL queries (no concatenation)
# CSRF token missing on the login form
# Rate limiting not configured on /api/auth/login
# Passwords hashed with bcrypt (cost factor 12)
# Session cookie without HttpOnly flag

An agent doesn't replace a professional audit

The security-reviewer agent is an excellent safety net for day-to-day development, but it doesn't replace a professional security audit for critical applications. Use it as a first line of defense, not as your only protection.

Testing

E2E Runner

The E2E agent generates and runs end-to-end tests that simulate real user journeys.

When to useTo test critical user flows before a release
What it doesWrites Playwright tests that navigate, fill forms, verify results
Key advantageTests actual application behavior, not just code units
# Explicit invocation
> Use the e2e-runner agent to test the signup flow:
> form, confirmation email, first login, personalized
> home page.
# Claude Code generates and runs a complete Playwright test
# that simulates the entire user journey end-to-end

Maintenance

Refactor Cleaner

The refactoring agent identifies and removes dead code, unused dependencies, and obsolete patterns.

When to useDuring maintenance sprints, after a major migration
What it doesDetects unused code, unnecessary imports, phantom dependencies
Key advantageReduces codebase size and improves readability
# Explicit invocation
> Use the refactor-cleaner agent to clean up the
> src/utils/ folder. Identify dead code and
> functions that are never called.
# Claude Code analyzes:
# - formatDate() - never imported (dead code)
# - legacyParser.ts - entire file is unused
# - import lodash - only _.get is used, replace with optional chaining
# - calculateTax() - only used in a test, needs verification

Doc Updater

The documentation agent keeps technical docs up to date based on code changes.

When to useAfter a refactoring or adding new features
What it doesCompares current code with documentation, updates obsolete sections
Key advantageDocumentation stays synced with code, no manual effort
# Explicit invocation
> Use the doc-updater agent to update the documentation
> after the API module refactoring.
# Claude Code:
# 1. Compares existing docs with current code
# 2. Updates modified function signatures
# 3. Adds documentation for new routes
# 4. Fixes obsolete code examples
# 5. Verifies all internal links work

Summary table

AgentDomainMain useRecommended frequency
tdd-guideDevNew features with testsEvery feature
code-reviewerDevAutomated code reviewEvery commit
build-error-resolverDevBuild error diagnosisWhen the build fails
plannerArchitecturePlanning before codingComplex features
architectArchitectureStructural technical decisionsArchitecture choices
security-reviewerSecurityCode security auditBefore each release
e2e-runnerTestingUser flow testingBefore each release
refactor-cleanerMaintenanceDead code cleanupMaintenance sprints
doc-updaterMaintenanceDocumentation updatesAfter each refactoring

Next steps

Now that you know the available agents, learn how to combine them effectively.