Custom agents extend base capabilities by handling specific tasks with isolated context windows, tool permissions, and system prompts. They are managed as subagents.
Create a Custom Agent
Method 1: Use create-agent (recommended)
Use the built-in create-agent skill to interactively create a custom agent:
/create-agent <your goal, for example, code review expert>
The create-agent skill guides you through these steps:
-
Define the agent name and description
-
Select required tool permissions
-
Auto-generate a system prompt template
-
Save the agent file to the correct location
For your first custom agent, use /create-agent to generate a correctly formatted configuration file.
Method 2: Create manually
Alternatively, create a .md file manually in one of these locations:
|
Location |
Path |
Scope |
|
User-level |
|
All projects |
|
Project-level |
|
Current project only |
Each agent file requires a frontmatter block for metadata and a system prompt:
---
name: code-review
description: A code review expert that checks code quality and security
tools: Read, Grep, Glob, Bash
---
You are a senior code reviewer. Ensure high code quality. Review checklist:
1. Code readability
2. Naming conventions
3. Error handling
4. Security checks
5. Test coverage
|
Field |
Required |
Description |
|
|
Yes |
Unique agent identifier |
|
|
Yes |
Brief description of function and expertise. Used for automatic agent selection |
|
|
No |
List of allowed tools, comma-separated |
Supported Tools
|
Tool Name |
Description |
|
|
Run shell commands |
|
|
Edit files |
|
|
Create or overwrite files |
|
|
Find files by pattern |
|
|
Search file contents |
|
|
Read files |
|
|
Fetch URL content |
|
|
Search the web with domain filtering |
Use in Your IDE
Method 1: Automatic Trigger
Describe your task in natural language. The model matches your intent to the appropriate agent:
Review the implementation of this API
The model detects your intent and invokes the code-review agent.
Method 2: Manual Trigger
Type /agent-name to trigger a specific agent:
/code-review