|
| 1 | +--- |
| 2 | +name: meta-agent-creator |
| 3 | +description: Guide for creating specialized AI agents (subagents). This skill should be used when users want to create a new agent, define agent configurations, or need guidance on agent architecture. |
| 4 | +--- |
| 5 | + |
| 6 | +# Meta-Agent Creator |
| 7 | + |
| 8 | +A meta-skill that helps create new specialized agents for multi-agent orchestration systems. |
| 9 | +Supports Claude Code and OpenCode platforms. |
| 10 | + |
| 11 | +> **Output Language**: All generated agent content (prompts, descriptions) will be in **English**. |
| 12 | +
|
| 13 | +## Quick Start |
| 14 | + |
| 15 | +### Create a New Agent |
| 16 | + |
| 17 | +```bash |
| 18 | +# Initialize a new agent |
| 19 | +bun scripts/init-agent.ts <agent-name> --path <output-directory> --platform <platform> |
| 20 | + |
| 21 | +# Examples |
| 22 | +bun scripts/init-agent.ts security-auditor --path src/agents --platform opencode |
| 23 | +bun scripts/init-agent.ts data-analyst --path .claude/agents --platform claude-code |
| 24 | +``` |
| 25 | + |
| 26 | +### Validate Agent |
| 27 | + |
| 28 | +```bash |
| 29 | +bun scripts/validate-agent.ts <agent-file> |
| 30 | + |
| 31 | +# Examples |
| 32 | +bun scripts/validate-agent.ts src/agents/my-agent.ts |
| 33 | +bun scripts/validate-agent.ts .claude/agents/my-agent.ts |
| 34 | +``` |
| 35 | + |
| 36 | +## Agent Categories |
| 37 | + |
| 38 | +Choose the appropriate category based on agent purpose: |
| 39 | + |
| 40 | +| Category | Purpose | Model Tier | Examples | |
| 41 | +| --------------- | ------------------------------- | ---------------- | ----------------- | |
| 42 | +| `exploration` | Fast search, codebase discovery | LOW (haiku/fast) | explore, searcher | |
| 43 | +| `specialist` | Domain-specific implementation | MEDIUM (sonnet) | frontend, backend | |
| 44 | +| `advisor` | Read-only consultation | HIGH (opus) | oracle, architect | |
| 45 | +| `utility` | General helpers | LOW (haiku/fast) | writer, formatter | |
| 46 | +| `orchestration` | Multi-agent coordination | MEDIUM (sonnet) | orchestrator | |
| 47 | + |
| 48 | +## Agent Creation Workflow (5 Phases) |
| 49 | + |
| 50 | +### Phase 1: DEFINE PURPOSE |
| 51 | + |
| 52 | +**Goal**: Clarify agent's role and responsibilities. |
| 53 | + |
| 54 | +**Questions to Ask**: |
| 55 | + |
| 56 | +1. "What specific tasks should this agent handle?" |
| 57 | +2. "When should the orchestrator delegate to this agent?" |
| 58 | +3. "What domain expertise is required?" |
| 59 | +4. "Should it be read-only or have write access?" |
| 60 | + |
| 61 | +**Deliverables**: |
| 62 | + |
| 63 | +- Clear role definition |
| 64 | +- Trigger conditions for delegation |
| 65 | +- Required capabilities list |
| 66 | +- Access level decision (readonly vs full) |
| 67 | + |
| 68 | +### Phase 2: CLASSIFY |
| 69 | + |
| 70 | +**Goal**: Determine category and model tier. |
| 71 | + |
| 72 | +**Decision Matrix**: |
| 73 | + |
| 74 | +| If the agent needs... | Category | Model | Cost | |
| 75 | +| ------------------------------- | ------------- | -------------- | --------- | |
| 76 | +| Fast codebase search | exploration | haiku/fast | FREE | |
| 77 | +| Specific domain implementation | specialist | sonnet/inherit | CHEAP | |
| 78 | +| Complex reasoning, architecture | advisor | opus/inherit | EXPENSIVE | |
| 79 | +| Simple transformations | utility | haiku/fast | FREE | |
| 80 | +| Delegate to other agents | orchestration | sonnet/inherit | CHEAP | |
| 81 | + |
| 82 | +**Deliverables**: |
| 83 | + |
| 84 | +- Category assignment |
| 85 | +- Model tier selection |
| 86 | +- Cost classification |
| 87 | + |
| 88 | +### Phase 3: DESIGN PROMPT |
| 89 | + |
| 90 | +**Goal**: Write effective system prompt. |
| 91 | + |
| 92 | +**Prompt Structure**: |
| 93 | + |
| 94 | +```markdown |
| 95 | +## Role |
| 96 | + |
| 97 | +[1-2 sentence identity and expertise] |
| 98 | + |
| 99 | +## Core Capabilities |
| 100 | + |
| 101 | +- [Capability 1] |
| 102 | +- [Capability 2] |
| 103 | + |
| 104 | +## Workflow |
| 105 | + |
| 106 | +1. [Step 1] |
| 107 | +2. [Step 2] |
| 108 | + |
| 109 | +## Output Format |
| 110 | + |
| 111 | +[Structured output definition] |
| 112 | + |
| 113 | +## Constraints |
| 114 | + |
| 115 | +- [Constraint 1] |
| 116 | +- [Constraint 2] |
| 117 | +``` |
| 118 | + |
| 119 | +**Best Practices**: |
| 120 | + |
| 121 | +- Keep prompts concise (<500 words) |
| 122 | +- Use imperative form |
| 123 | +- Include specific output format |
| 124 | +- Define clear constraints |
| 125 | + |
| 126 | +### Phase 4: CONFIGURE |
| 127 | + |
| 128 | +**Goal**: Create platform-specific configuration. |
| 129 | + |
| 130 | +#### OpenCode / Claude Code (TypeScript) |
| 131 | + |
| 132 | +Location: `src/agents/<agent-name>.ts` |
| 133 | + |
| 134 | +```typescript |
| 135 | +export function createMyAgent(model: string): AgentConfig { |
| 136 | + return { |
| 137 | + name: "my-agent", |
| 138 | + description: "Agent description...", |
| 139 | + mode: "subagent", |
| 140 | + model, |
| 141 | + temperature: 0.1, |
| 142 | + tools: { include: ["read", "glob", "grep"] }, |
| 143 | + prompt: `System prompt...`, |
| 144 | + }; |
| 145 | +} |
| 146 | +``` |
| 147 | + |
| 148 | +### Phase 5: REGISTER & TEST |
| 149 | + |
| 150 | +**Goal**: Add agent to registry and verify functionality. |
| 151 | + |
| 152 | +**Registration Checklist**: |
| 153 | + |
| 154 | +- [ ] Add to agent definitions/index |
| 155 | +- [ ] Update orchestrator's available agents list |
| 156 | +- [ ] Add to delegation table if applicable |
| 157 | +- [ ] Test with sample delegation |
| 158 | + |
| 159 | +**Testing**: |
| 160 | + |
| 161 | +1. Invoke agent with representative task |
| 162 | +2. Verify output format matches spec |
| 163 | +3. Check tool restrictions are enforced |
| 164 | +4. Test edge cases |
| 165 | + |
| 166 | +## Platform Configurations |
| 167 | + |
| 168 | +### OpenCode / Claude Code Agent Fields |
| 169 | + |
| 170 | +| Field | Required | Description | |
| 171 | +| ------------- | -------- | ------------------------ | |
| 172 | +| `name` | Yes | Agent identifier | |
| 173 | +| `description` | Yes | Selection guide | |
| 174 | +| `mode` | Yes | Always `"subagent"` | |
| 175 | +| `model` | Yes | Model string | |
| 176 | +| `temperature` | No | Defaults to 0.1 | |
| 177 | +| `tools` | No | Tool whitelist/blacklist | |
| 178 | +| `prompt` | Yes | System prompt | |
| 179 | + |
| 180 | +## Common Agent Templates |
| 181 | + |
| 182 | +See `references/agent-templates.md` for ready-to-use templates: |
| 183 | + |
| 184 | +- Exploration Agent |
| 185 | +- Verification Agent |
| 186 | +- Debugger Agent |
| 187 | +- Security Auditor Agent |
| 188 | + |
| 189 | +## Anti-Patterns to Avoid |
| 190 | + |
| 191 | +| Anti-Pattern | Problem | Solution | |
| 192 | +| ----------------- | -------------------------- | ------------------------- | |
| 193 | +| Vague description | Orchestrator can't decide | Include specific triggers | |
| 194 | +| Too many tools | Security risk | Minimal tool set | |
| 195 | +| Long prompts | Slower, harder to maintain | Keep under 500 words | |
| 196 | +| Generic "helper" | No clear purpose | Single responsibility | |
| 197 | +| Missing readonly | Security for advisors | Set readonly: true | |
| 198 | +| Wrong model tier | Cost or quality issues | Match tier to complexity | |
| 199 | + |
| 200 | +## References |
| 201 | + |
| 202 | +- **Agent Templates**: See [references/agent-templates.md](references/agent-templates.md) for ready-to-use templates |
| 203 | +- **Agent Patterns**: See [../meta-skill-creator/references/agent-patterns.md](../meta-skill-creator/references/agent-patterns.md) for architecture guidance |
0 commit comments