AgentSkillsCN

meta-agent-creator

创建专门的 AI 代理(子代理)指南。当用户希望创建新代理、定义代理配置,或需要代理架构方面的指导时,可使用此技能。

SKILL.md
--- frontmatter
name: meta-agent-creator
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.

Meta-Agent Creator

A meta-skill that helps create new specialized agents for multi-agent orchestration systems. Supports Claude Code and OpenCode platforms.

Output Language: All generated agent content (prompts, descriptions) will be in English.

Quick Start

Create a New Agent

bash
# Initialize a new agent
bun scripts/init-agent.ts <agent-name> --path <output-directory> --platform <platform>

# Examples
bun scripts/init-agent.ts security-auditor --path src/agents --platform opencode
bun scripts/init-agent.ts data-analyst --path .claude/agents --platform claude-code

Validate Agent

bash
bun scripts/validate-agent.ts <agent-file>

# Examples
bun scripts/validate-agent.ts src/agents/my-agent.ts
bun scripts/validate-agent.ts .claude/agents/my-agent.ts

Agent Categories

Choose the appropriate category based on agent purpose:

CategoryPurposeModel TierExamples
explorationFast search, codebase discoveryLOW (haiku/fast)explore, searcher
specialistDomain-specific implementationMEDIUM (sonnet)frontend, backend
advisorRead-only consultationHIGH (opus)oracle, architect
utilityGeneral helpersLOW (haiku/fast)writer, formatter
orchestrationMulti-agent coordinationMEDIUM (sonnet)orchestrator

Agent Creation Workflow (5 Phases)

Phase 1: DEFINE PURPOSE

Goal: Clarify agent's role and responsibilities.

Questions to Ask:

  1. "What specific tasks should this agent handle?"
  2. "When should the orchestrator delegate to this agent?"
  3. "What domain expertise is required?"
  4. "Should it be read-only or have write access?"

Deliverables:

  • Clear role definition
  • Trigger conditions for delegation
  • Required capabilities list
  • Access level decision (readonly vs full)

Phase 2: CLASSIFY

Goal: Determine category and model tier.

Decision Matrix:

If the agent needs...CategoryModelCost
Fast codebase searchexplorationhaiku/fastFREE
Specific domain implementationspecialistsonnet/inheritCHEAP
Complex reasoning, architectureadvisoropus/inheritEXPENSIVE
Simple transformationsutilityhaiku/fastFREE
Delegate to other agentsorchestrationsonnet/inheritCHEAP

Deliverables:

  • Category assignment
  • Model tier selection
  • Cost classification

Phase 3: DESIGN PROMPT

Goal: Write effective system prompt.

Prompt Structure:

markdown
## Role

[1-2 sentence identity and expertise]

## Core Capabilities

- [Capability 1]
- [Capability 2]

## Workflow

1. [Step 1]
2. [Step 2]

## Output Format

[Structured output definition]

## Constraints

- [Constraint 1]
- [Constraint 2]

Best Practices:

  • Keep prompts concise (<500 words)
  • Use imperative form
  • Include specific output format
  • Define clear constraints

Phase 4: CONFIGURE

Goal: Create platform-specific configuration.

OpenCode / Claude Code (TypeScript)

Location: src/agents/<agent-name>.ts

typescript
export function createMyAgent(model: string): AgentConfig {
  return {
    name: "my-agent",
    description: "Agent description...",
    mode: "subagent",
    model,
    temperature: 0.1,
    tools: { include: ["read", "glob", "grep"] },
    prompt: `System prompt...`,
  };
}

Phase 5: REGISTER & TEST

Goal: Add agent to registry and verify functionality.

Registration Checklist:

  • Add to agent definitions/index
  • Update orchestrator's available agents list
  • Add to delegation table if applicable
  • Test with sample delegation

Testing:

  1. Invoke agent with representative task
  2. Verify output format matches spec
  3. Check tool restrictions are enforced
  4. Test edge cases

Platform Configurations

OpenCode / Claude Code Agent Fields

FieldRequiredDescription
nameYesAgent identifier
descriptionYesSelection guide
modeYesAlways "subagent"
modelYesModel string
temperatureNoDefaults to 0.1
toolsNoTool whitelist/blacklist
promptYesSystem prompt

Common Agent Templates

See references/agent-templates.md for ready-to-use templates:

  • Exploration Agent
  • Verification Agent
  • Debugger Agent
  • Security Auditor Agent

Anti-Patterns to Avoid

Anti-PatternProblemSolution
Vague descriptionOrchestrator can't decideInclude specific triggers
Too many toolsSecurity riskMinimal tool set
Long promptsSlower, harder to maintainKeep under 500 words
Generic "helper"No clear purposeSingle responsibility
Missing readonlySecurity for advisorsSet readonly: true
Wrong model tierCost or quality issuesMatch tier to complexity

References