Part 1 of 8

Creating Agents

Two ways to create agent files.

Two Ways to Create Agents

Each agent is a markdown file in .claude/agents/. The filename becomes the agent name.

Option 1: Use the /agents command

Interactive method in Claude Code:

> /agents

You'll be prompted for name, description, model, and system prompt.

Option 2: Create files directly

Recommended for this guide — more control and easier version control.

Create markdown files in .claude/agents/ with the exact content provided in this guide.

Agent File Structure

---
name: agent-name
description: When to use this agent and examples
model: haiku | sonnet | opus
---

[Agent instructions go here]

The Frontmatter Matters

  • name: How you reference the agent (@agent-name)
  • description: Helps Claude Code know when to invoke it
  • model: Which Claude model to use (haiku is fast/cheap, opus is thorough)