Skip to main content

Custom Agents

10.1 Agent Definition File Format

Agent definition files are stored at .claude/agents/{name}.md, using YAML front matter:
---
name: agent-name
description: |
  One-line description of what this agent does.
tools: Read, Write, Edit, Bash, Glob, Grep
model: opus
---
# Agent Name

Agent instructions go here...

10.2 Available Tools and Model Selection

Available tools:
ToolDescription
ReadRead files
WriteWrite files
EditEdit files
BashExecute commands
GlobFile search
GrepContent search
TaskInvoke sub-Agents
SkillInvoke Skills
mcp__exa__web_search_exaWeb search
mcp__exa__get_code_context_exaCode search
mcp__chrome-devtools__*Browser automation
Model selection:
ModelUse Case
opusComplex tasks (implementation, checking, debugging)
sonnetMedium tasks
haikuSimple, fast tasks

10.3 Modifying Existing Agents

For example, adding timeout control to the Check Agent:
---
name: check
description: |
  Code quality check expert with 10-minute timeout.
tools: Read, Write, Edit, Bash, Glob, Grep
model: opus
timeout: 600000
---

10.4 Creating a New Agent

---
name: test
description: |
  Test writing expert. Writes comprehensive tests for code changes.
tools: Read, Write, Edit, Bash, Glob, Grep
model: opus
---
# Test Agent

You are the Test Agent in the Trellis workflow.

## Core Responsibilities

1. **Analyze code changes** - Understand what was modified
2. **Write unit tests** - Cover new functionality
3. **Write integration tests** - Test cross-module interactions
4. **Run tests** - Verify all tests pass

## Workflow

### Step 1: Get Changes

```bash
git diff --name-only

Step 2: Identify Testable Code

For each changed file, identify functions/components that need tests.

Step 3: Write Tests

Follow existing test patterns in the codebase.

Step 4: Run Tests

pnpm test

---