Skip to content

Agent Patterns

Agents are specialized AI experts that Claude Code delegates tasks to. Each has a focused responsibility, restricted tool access, and returns structured findings to the main conversation.

Agents are markdown files with YAML frontmatter:

---
name: agent-name
description: Brief description shown in agent list
tools: Grep, Glob, Read
model: sonnet
---
# Agent Instructions
You are a specialist at [specific task]...
  • name — kebab-case identifier, invoked as @catalyst-dev:{name}
  • description — Shown in agent list; explains when to use this agent
  • tools — Comma-separated list of allowed tools (restricts scope)
  • modelopus for complex analysis, sonnet for general research, haiku for fast lookups
AgentQuestion it AnswersTools
codebase-locatorWhere is X?Grep, Glob, Bash(ls)
codebase-analyzerHow does X work?Read, Grep, Glob
codebase-pattern-finderShow me examples of XRead, Grep, Glob
thoughts-locatorWhat do we know about X?Grep, Glob, Bash(ls)
thoughts-analyzerWhat were the decisions about X?Read, Grep, Glob
external-researchWhat do libraries/docs say about X?DeepWiki, Context7, Exa

Find files and directories without reading contents. Uses Grep, Glob, Bash(ls only) and runs on Haiku for speed.

Understand implementation details by reading specific files and tracing data flow. Uses Read, Grep, Glob and runs on Sonnet.

Find reusable patterns and examples across the codebase. Uses Read, Grep, Glob and runs on Sonnet.

Check correctness against specifications. Uses Read, Bash, Grep and runs on Sonnet.

Collect and summarize information from multiple sources. Uses Read, Grep, Glob and runs on Sonnet.

Each agent should answer one type of question. A codebase-locator finds files — it doesn’t analyze them. A codebase-analyzer understands implementation — it doesn’t suggest improvements.

Grant only the tools needed. Research agents get read-only tools; implementation commands get full access. Fewer tools means faster decisions and prevents accidental modifications.

Always include a “What NOT to Do” section:

## What NOT to Do
- Don't read file contents (just report locations)
- Don't analyze what the code does
- Don't suggest improvements

Define the expected output format so results are consistent and parseable:

## Output Format
### [Category]
- `path/to/file.ext:line` — Description

Use parallel when researching independent aspects:

@catalyst-dev:codebase-locator find payment files
@catalyst-dev:thoughts-locator search payment research
@catalyst-dev:codebase-pattern-finder show payment patterns

Use sequential when each step depends on the previous:

@catalyst-dev:codebase-locator find auth files
# Wait for results
@catalyst-dev:codebase-analyzer analyze src/auth/handler.js
  1. Create a markdown file in plugins/dev/agents/
  2. Add frontmatter with name, description, tools, and model
  3. Write clear instructions with responsibilities, strategy, output format, and boundaries
  4. Restart Claude Code to load the agent
  5. Test with @catalyst-dev:{name} task description

See Contributing for the complete agent template.