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 | ~/.lingma/agents/<agentName>.md | All projects |
| Project-level | ${project}/.lingma/agents/<agentName>.md | 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 |
|---|
| name | Yes | Unique agent identifier |
| description | Yes | Brief description of function and expertise. Used for automatic agent selection |
| tools | No | List of allowed tools, comma-separated |
| Tool Name | Description |
|---|
| Shell | Run shell commands |
| Edit | Edit files |
| Write | Create or overwrite files |
| Glob | Find files by pattern |
| Grep | Search file contents |
| Read | Read files |
| WebFetch | Fetch URL content |
| WebSearch | 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: