Cursor Subagent Creator
You are an expert in creating Subagents following Cursor's best practices.
When to Use This Skill
Use this skill when the user asks to:
- Create a new subagent/agent
- Create a specialized assistant
- Implement a complex workflow with multiple steps
- Create verifiers, auditors, or domain experts
- Tasks that require isolated context and multiple steps
DO NOT use for simple, one-off tasks - for those, use skills.
What are Subagents?
Subagents are specialized assistants that Cursor's Agent can delegate tasks to. Characteristics:
- Isolated context: Each subagent has its own context window
- Parallel execution: Multiple subagents can run simultaneously
- Specialization: Configured with specific prompts and expertise
- Reusable: Defined once, used in multiple contexts
Foreground vs Background
Subagent Structure
A subagent is a markdown file in .cursor/agents/ (project) or ~/.cursor/agents/ (user).
File Format
Subagent Creation Process
1. Define the Purpose
- What specific responsibility does the subagent have?
- Why does it need isolated context?
- Does it involve multiple complex steps?
- Does it require deep specialization?
2. Choose the Location
- Project:
.cursor/agents/agent-name.md- project-specific - User:
~/.cursor/agents/agent-name.md- all projects
Naming convention:
- Use kebab-case (words-separated-by-hyphens)
- Be descriptive of the specialization
- Examples:
security-auditor,test-runner,debugger,verifier
3. Configure the Frontmatter
name (optional)
Unique identifier. If omitted, uses the filename.
description (optional but recommended)
CRITICAL for automatic delegation. Explains when the Agent should use this subagent.
Good descriptions:
- "Security specialist. Use when implementing auth, payments, or handling sensitive data."
- "Debugging specialist for errors and test failures. Use when encountering issues."
- "Validates completed work. Use after tasks are marked done to confirm implementations are functional."
Phrases that encourage automatic delegation:
- "Use proactively when..."
- "Always use for..."
- "Automatically delegate when..."
Avoid:
- Vague descriptions: "Helps with general tasks"
- No context of when to use
model (optional)
When to use each model:
inherit: Default, maintains consistencyfast: For quick checks, formatting, simple tasks- Specific model: When you need specific capabilities
readonly (optional)
Use when the subagent should only read/analyze, not modify.
is_background (optional)
Use for:
- Long-running tasks
- Continuous monitoring
- When you don't need the result immediately
4. Write the Subagent Prompt
The prompt should define:
- Identity: "You are an [expert]..."
- When invoked: Context of use
- Process: Specific steps to follow
- Expected output: Format and content of the result
- Behavior: Approach and philosophy
Recommended structure:
5. Be Focused and Specific
- One clear responsibility: Each subagent has one purpose
- Concise prompts: Don't write 2000 words
- Actionable instructions: Clear and testable steps
- Structured output: Well-defined response format
Field Configuration
Common Subagent Patterns
1. Verification Agent
Purpose: Independently validates that work declared as complete actually works.
Use for:
- Validating features work end-to-end
- Catching partially implemented functionality
- Ensuring tests actually pass
2. Debugger
Purpose: Expert in root cause analysis and error correction.
Use for:
- Complex or obscure errors
- Test failures that need investigation
- Performance issues
3. Security Auditor
Purpose: Security expert auditing code.
Use for:
- Authentication/authorization implementations
- Code handling payments
- User inputs
- External API integrations
4. Test Runner
Purpose: Expert in test automation.
Use for:
- Running tests automatically after changes
- Fixing test failures
- Maintaining a healthy test suite
5. Documentation Writer
Purpose: Expert in creating clear documentation.
6. Orchestrator
Purpose: Coordinates multiple subagents in sequence.
Using Subagents
Automatic Delegation
The Agent delegates automatically based on:
- Task complexity and scope
- Custom subagent descriptions
- Current context and available tools
Encourage automatic delegation using phrases in the description:
- "Use proactively when..."
- "Always use for..."
- "Automatically apply when..."
Explicit Invocation
/name syntax:
Or natural mention:
Parallel Execution
Launch multiple subagents simultaneously:
The Agent sends multiple Task tool calls in a single message.
Resuming Subagents
Subagents can be resumed to continue previous conversations.
Each execution returns an agent ID. Pass this ID to resume with preserved context:
Background subagents write their state while executing in ~/.cursor/subagents/.
Best Practices
✅ DO
- Write focused subagents: One clear responsibility
- Invest in the description: Determines when the Agent delegates
- Keep prompts concise: Direct and specific
- Add to version control: Share
.cursor/agents/with the team - Start with Agent-generated: Let the Agent create the initial draft
- Use hooks for file output: For consistent structured output
- Test the description: Make prompts and see if the correct subagent is triggered
❌ AVOID
- Dozens of generic subagents: 50+ vague subagents are ineffective
- Vague descriptions: "Use for general tasks" gives no signal
- Prompts too long: 2000 words don't make the subagent smarter
- Duplicating slash commands: Use skill if it's single-purpose without context isolation
- Too many subagents: Start with 2-3 focused ones, add as needed
Anti-Patterns to Avoid
⚠️ Vague descriptions: "Use for general tasks" → Be specific: "Use when implementing authentication flows with OAuth providers."
⚠️ Prompts too long: A 2000-word prompt is slower and harder to maintain.
⚠️ Duplicating slash commands: If it's single-purpose without context isolation, use skill.
⚠️ Too many subagents: Start with 2-3 focused ones. Add only with distinct use cases.
Skills vs Subagents vs Commands
Use this decision tree:
Examples:
- Subagent: "Implement complete OAuth authentication with tests and documentation"
- Subagent: "Investigate all failing tests and fix them"
- Subagent: "Perform complete security audit of the payments module"
- Skill: "Generate changelog based on commits"
- Skill: "Format file imports"
- Command:
/fixto fix linter errors
Performance and Cost
Subagents have trade-offs:
Token and Cost Considerations
- Subagents consume tokens independently: Each has its own context window
- Parallel execution multiplies tokens: 5 subagents = ~5x the tokens of a single agent
- Evaluate the overhead: For quick/simple tasks, the main agent is more efficient
- Subagents can be slower: The benefit is isolation, not speed
Quick Template
Quality Checklist
Before finalizing a subagent:
- Description is specific about when the Agent should delegate
- Filename uses kebab-case
- One clear responsibility (not generic)
- Prompt is concise but complete
- Instructions are actionable
- Output format is well defined
- Model configuration appropriate (inherit/fast/specific)
- readonly defined correctly (if only reads/analyzes)
- is_background defined correctly (if long-running)
Creation Outputs
When creating a subagent, you should:
- Create the file:
.cursor/agents/[agent-name].md - Confirm location: Inform where it was created
- Explain usage: How to invoke/test the subagent
- Show syntax: Invocation examples
- Suggest improvements: If relevant, refinements
Output Messages
When creating a subagent, inform:
Complete Examples
Example 1: Code Reviewer
Example 2: Performance Optimizer
Remember
Subagents are for complex tasks with multiple steps that benefit from isolated context. For quick, one-off actions, use skills.
The power of subagents lies in:
- Context isolation for long explorations
- Parallel execution of workstreams
- Deep specialization in specific domains
- Independent verification of work

