Skip to content

Tutorial: Your First Agent

Step-by-step guide to creating a custom AI agent.

For a quick overview, see Getting Started: First Agent

Prerequisites

  • AIV installed and configured
  • Basic understanding of Markdown

Step 1: Plan Your Agent

Before writing, decide:

  • What role will the agent play?
  • What tasks should it excel at?
  • What model should it use?

Example: A code reviewer agent

Step 2: Create the File

bash
mkdir -p .claude/agents
touch .claude/agents/reviewer.md

Step 3: Write the Definition

markdown
---
name: reviewer
description: "Code reviewer focusing on best practices"
model: sonnet
---

# Code Reviewer

## Role
Expert code reviewer focused on:
- Code quality
- Security issues
- Performance
- Best practices

## Review Process
1. Read the code carefully
2. Identify issues by category
3. Suggest improvements
4. Provide examples

## Output Format
\`\`\`
## Summary
[Brief overview]

## Issues Found
### Critical
- [Issue description]

### Warnings
- [Issue description]

## Recommendations
1. [Recommendation]
\`\`\`

Step 4: Test Your Agent

bash
aiv "@reviewer Review this function: $(cat myfile.ts)"

Step 5: Iterate

Refine the agent based on results:

  • Add more specific instructions
  • Include example outputs
  • Adjust the model if needed

Next Steps

Released under the MIT License.