spawn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spawn - Expert Agent Generator

Spawn - 专家Agent生成器

Generate world-class, comprehensive expert agent prompts for Claude Code. Each agent should be a definitive reference for its domain - the kind of guide a PhD-level practitioner would create.
Target quality: 500-1000 lines per agent with real code examples, complete configs, and detailed patterns.
Benchmark agents:
python-expert.md
(1600 lines),
claude-architect.md
(1242 lines),
react-expert.md
(440 lines)
为Claude Code生成世界级的、全面的专家Agent提示词。每个Agent都应成为其领域的权威参考——如同博士级从业者编写的指南。
**目标质量:**每个Agent包含500-1000行内容,附带真实代码示例、完整配置和详细模式。
基准Agent:
python-expert.md
(1600行)、
claude-architect.md
(1242行)、
react-expert.md
(440行)

Usage Modes

使用模式

Mode 1: Single Agent Generation

模式1:单个Agent生成

Generate one expert agent prompt for a specific technology platform.
Prompt for:
  • Technology platform/framework name
  • Scope (project-level or global/user-level)
  • Focus areas (optional: specific features, patterns, use cases)
  • Output format (markdown file or clipboard-ready text)
为特定技术平台生成一个专家Agent提示词。
需提供:
  • 技术平台/框架名称
  • 范围(项目级或全局/用户级)
  • 重点领域(可选:特定功能、模式、用例)
  • 输出格式(Markdown文件或可复制到剪贴板的文本)

Mode 2: Batch Agent Generation

模式2:批量Agent生成

Create multiple agent prompts from a list of technology platforms.
Accept:
  • Multi-line list of technology platforms
  • Scope (project-level or global/user-level)
  • Common focus areas (optional)
  • Output format (individual .md files or consolidated text)
从技术平台列表中创建多个Agent提示词。
支持输入:
  • 多行技术平台列表
  • 范围(项目级或全局/用户级)
  • 通用重点领域(可选)
  • 输出格式(独立.md文件或合并文本)

Mode 3: Architecture Analysis

模式3:架构分析

Analyze a tech stack or architecture description and suggest relevant agents.
Process:
  1. Read architecture description (from user input or file)
  2. Identify all technology platforms/services
  3. Ask for scope (project or global)
  4. Present checkbox selector for agent creation
  5. Generate selected agents
分析技术栈或架构描述,并推荐相关Agent。
流程:
  1. 读取架构描述(来自用户输入或文件)
  2. 识别所有技术平台/服务
  3. 询问范围(项目级或全局级)
  4. 展示Agent创建的多选选择器
  5. 生成选中的Agent

Agent File Format

Agent文件格式

All agents MUST be created as Markdown files with YAML frontmatter:
  • Project-level:
    .claude/agents/
    (current project only)
  • Global/User-level:
    ~/.claude/agents/
    or
    C:\Users\[username]\.claude\agents\
    (all projects)
File Structure:
markdown
---
name: technology-name-expert
description: When this agent should be used. Can include examples and use cases. No strict length limit - be clear and specific. Include "use PROACTIVELY" for automatic invocation.
model: inherit
color: blue
---

[Agent system prompt content here]
YAML Frontmatter Fields:
  • name
    (required): Unique identifier, lowercase-with-hyphens (e.g., "asus-router-expert")
  • description
    (required): Clear, specific description of when to use this agent
    • No strict length limit - prioritize clarity over brevity
    • Can include examples, use cases, and context
    • Use "use PROACTIVELY" or "MUST BE USED" to encourage automatic invocation
    • Multi-line YAML string format is fine for lengthy descriptions
  • tools
    (optional): Comma-separated list of allowed tools (e.g., "Read, Grep, Glob, Bash")
    • If omitted, agent inherits all tools from main session
    • Best practice: Only grant tools necessary for the agent's purpose (improves security and focus)
  • model
    (optional): Specify model ("sonnet", "opus", "haiku", or "inherit" to use main session model)
  • color
    (optional): Visual identifier in UI ("blue", "green", "purple", etc.)
File Creation: Agents can be created programmatically using the Write tool:
Project-level: .claude/agents/[platform]-expert.md
Global/User-level: ~/.claude/agents/[platform]-expert.md (or C:\Users\[username]\.claude\agents\ on Windows)
Choosing Scope:
  • Project Agent (
    .claude/agents/
    ): Specific to the current project, can be version controlled and shared with team
  • Global Agent (
    ~/.claude/agents/
    ): Available across all projects on your machine
After creation, the agent is immediately available for use with the Task tool.
所有Agent必须以带有YAML前置元数据的Markdown文件形式创建:
  • 项目级:
    .claude/agents/
    (仅当前项目可用)
  • 全局/用户级:
    ~/.claude/agents/
    C:\Users\[username]\.claude\agents\
    (所有项目可用)
文件结构:
markdown
---
name: technology-name-expert
description: 何时使用此Agent。可包含示例和用例。无严格长度限制——清晰明确即可。若需自动调用,请包含"use PROACTIVELY"。
model: inherit
color: blue
---

[Agent系统提示词内容]
YAML前置元数据字段:
  • name
    (必填):唯一标识符,采用小写连字符格式(例如:"asus-router-expert")
  • description
    (必填):清晰、具体的Agent使用场景描述
    • 无严格长度限制——优先保证清晰度而非简洁性
    • 可包含示例、用例和上下文
    • 若需鼓励自动调用,使用"use PROACTIVELY"或"MUST BE USED"
    • 冗长描述可使用多行YAML字符串格式
  • tools
    (可选):允许使用的工具列表(逗号分隔,例如:"Read, Grep, Glob, Bash")
    • 若省略,Agent将继承主会话的所有工具
    • **最佳实践:**仅授予Agent完成任务所需的工具(提升安全性和专注度)
  • model
    (可选):指定模型("sonnet"、"opus"、"haiku",或使用"inherit"继承主会话模型)
  • color
    (可选):UI中的视觉标识("blue"、"green"、"purple"等)
文件创建方式: 可通过Write工具以编程方式创建Agent:
项目级:.claude/agents/[platform]-expert.md
全局/用户级:~/.claude/agents/[platform]-expert.md(Windows系统为C:\Users\[username]\.claude\agents\[platform]-expert.md)
范围选择建议:
  • 项目Agent
    .claude/agents/
    ):仅适用于当前项目,可进行版本控制并与团队共享
  • 全局Agent
    ~/.claude/agents/
    ):在本机所有项目中可用
创建完成后,Agent可立即通过Task工具使用。

Claude Code Agent Documentation

Claude Code Agent文档

Essential Reading:
Key Concepts from Documentation:
  • Subagents operate in separate context windows with customized system prompts
  • Each subagent can have restricted tool access for focused capabilities
  • Multiple subagents can run concurrently for parallel processing
  • User-level agents (
    ~/.claude/agents/
    ) are available across all projects
  • Project-level agents (
    .claude/agents/
    ) are project-specific and shareable
  • Use
    /agents
    command for the recommended UI to manage agents
  • Start with Claude-generated agents, then customize for best results
  • Version control project-level subagents for team collaboration
必读内容:
文档核心概念:
  • 子Agent在独立的上下文窗口中运行,拥有自定义系统提示词
  • 每个子Agent可限制工具访问权限,以实现专注的能力
  • 多个子Agent可并发运行以实现并行处理
  • 用户级Agent(
    ~/.claude/agents/
    )可在所有项目中使用
  • 项目级Agent(
    .claude/agents/
    )为项目专用,可共享
  • 使用
    /agents
    命令通过推荐的UI管理Agent
  • 从Claude生成的Agent开始,然后根据需要自定义以获得最佳效果
  • 对项目级子Agent进行版本控制,以便团队协作

Generation Requirements

生成要求

For each agent, create a comprehensive expert prompt with:
Agent Content Structure (10-Part Template):
Every generated agent MUST follow this comprehensive 10-part structure:
  1. Part 1: Core Concepts - Fundamental principles, mental model, architecture overview
  2. Part 2: Essential Patterns (5-10 patterns) - Each with: when to use, full implementation (20-50 lines), variations, common mistakes
  3. Part 3: Advanced Techniques (3-5 techniques) - Deep dives with complete examples
  4. Part 4: Configuration - Complete dev config, complete prod config, environment variables table
  5. Part 5: Integration Patterns - Integration code for 2-3 common technologies
  6. Part 6: Testing Strategies - Unit tests with mocks, integration tests, test configuration
  7. Part 7: Error Handling - Custom exception hierarchy, retry/circuit breaker patterns, structured logging
  8. Part 8: Performance Optimization - Profiling techniques, optimization table, caching strategies
  9. Part 9: Security Considerations - Common vulnerabilities, security hardening checklist
  10. Part 10: Quick Reference - Common operations cheat sheet (20-30 snippets), CLI commands, troubleshooting table
Plus: Quality Checklist, Anti-Patterns (5-10 with bad/good code), Canonical Resources (10-15 URLs)
See
python-expert.md
and
react-expert.md
in agents/ for reference implementations.
Requirements:
  • YAML frontmatter at top with required fields (name, description)
  • Concise, actionable system prompt (not verbose)
  • Minimum 10 official/authoritative URLs
  • Include real, production-ready code examples (10+ code blocks)
  • Include complete configuration files (dev + prod)
  • Include testing patterns with actual test code
  • Focus on patterns, best practices, architecture
  • Include canonical references for expansion
  • Markdown formatted for direct use
  • Description field can be lengthy with examples if needed for clarity
为每个Agent创建全面的专家提示词,包含以下内容:
Agent内容结构(10部分模板):
每个生成的Agent必须遵循以下全面的10部分结构:
  1. 第1部分:核心概念 - 基本原则、思维模型、架构概述
  2. 第2部分:核心模式(5-10个模式) - 每个模式包含:适用场景、完整实现(20-50行)、变体、常见错误
  3. 第3部分:高级技术(3-5个技术) - 深度解析并附带完整示例
  4. 第4部分:配置 - 完整开发环境配置、完整生产环境配置、环境变量表
  5. 第5部分:集成模式 - 与2-3种常见技术的集成代码
  6. 第6部分:测试策略 - 带模拟的单元测试、集成测试、测试配置
  7. 第7部分:错误处理 - 自定义异常层级、重试/断路器模式、结构化日志
  8. 第8部分:性能优化 - 性能分析技术、优化表、缓存策略
  9. 第9部分:安全考量 - 常见漏洞、安全加固清单
  10. 第10部分:快速参考 - 常见操作速查表(20-30个代码片段)、CLI命令、故障排除表
附加内容:质量检查表、反模式(5-10个,附带错误/正确代码对比)、权威资源(10-15个URL)
参考实现可查看agents/目录下的
python-expert.md
react-expert.md
要求:
  • 顶部包含YAML前置元数据及必填字段(name、description)
  • 简洁、可执行的系统提示词(避免冗长)
  • 至少包含10个官方/权威URL
  • 包含真实的、生产就绪的代码示例(10个以上代码块)
  • 包含完整的配置文件(开发+生产)
  • 包含带实际测试代码的测试模式
  • 重点关注模式、最佳实践和架构
  • 包含可扩展的权威参考
  • 采用Markdown格式以便直接使用
  • 若需清晰说明,description字段可包含冗长内容及示例

Output Options

输出选项

Ask user to choose scope:
  1. Project Agent - Save to
    .claude/agents/
    (project-specific, version controlled)
  2. Global Agent - Save to
    ~/.claude/agents/
    or
    C:\Users\[username]\.claude\agents\
    (all projects)
Ask user to choose format:
  1. Clipboard-ready - Output complete markdown (with YAML frontmatter) in code block
  2. File creation - Use Write tool to save to appropriate agents directory based on scope
  3. Both - Create file using Write tool AND show complete content in chat for review
File Creation Process: When creating files programmatically:
  1. Generate complete agent content with YAML frontmatter
  2. Determine path based on scope selection:
    • Project:
      .claude/agents/[platform-name]-expert.md
    • Global:
      ~/.claude/agents/[platform-name]-expert.md
      (or Windows equivalent)
  3. Use Write tool with appropriate path
  4. Verify file was created successfully
  5. Agent is immediately available for use
询问用户选择范围:
  1. 项目Agent - 保存至
    .claude/agents/
    (项目专用,可版本控制)
  2. 全局Agent - 保存至
    ~/.claude/agents/
    C:\Users\[username]\.claude\agents\
    (所有项目可用)
询问用户选择格式:
  1. 可复制到剪贴板 - 在代码块中输出完整Markdown内容(含YAML前置元数据)
  2. 创建文件 - 使用Write工具保存至对应Agent目录(根据范围选择)
  3. 两者皆选 - 使用Write工具创建文件,并在聊天中显示完整内容以供审核
文件创建流程: 以编程方式创建文件时:
  1. 生成包含YAML前置元数据的完整Agent内容
  2. 根据范围选择确定路径:
    • 项目级:
      .claude/agents/[platform-name]-expert.md
    • 全局级:
      ~/.claude/agents/[platform-name]-expert.md
      (Unix/Mac)或
      C:\Users\[username]\.claude\agents\[platform-name]-expert.md
      (Windows)
  3. 使用Write工具写入对应路径
  4. 验证文件创建成功
  5. Agent可立即使用

Examples

示例

Example 1: Single Agent

示例1:单个Agent

User: /spawn
Agent: [Shows multi-tab AskUserQuestion with 5 tabs]
  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
  Tab 2 (Scope): Project Agent / Global Agent
  Tab 3 (Output): Create File / Show in Chat / Both
  Tab 4 (Platform): Custom Platform / [or popular options]
  Tab 5 (Focus): [Multi-select] General Coverage / Caching Patterns / Pub/Sub / etc.
User: [Selects all answers and submits once]
  Mode: Single Agent
  Scope: Global Agent
  Output: Both
  Platform: Redis (via Other field)
  Focus: General Coverage, Caching Patterns, Pub/Sub
Agent: [Generates Redis expert prompt and saves to ~/.claude/agents/redis-expert.md]
用户:/spawn
Agent:[显示包含5个标签页的多问题AskUserQuestion界面]
  标签页1(模式):单个Agent / 批量生成 / 架构分析
  标签页2(范围):项目Agent / 全局Agent
  标签页3(输出):创建文件 / 在聊天中显示 / 两者皆选
  标签页4(平台):自定义平台 / [或热门选项]
  标签页5(重点):[多选] 全面覆盖 / 缓存模式 / 发布/订阅 / 等
用户:[选择所有答案并一次性提交]
  模式:单个Agent
  范围:全局Agent
  输出:两者皆选
  平台:Redis(通过其他字段输入)
  重点:全面覆盖、缓存模式、发布/订阅
Agent:[生成Redis专家提示词并保存至~/.claude/agents/redis-expert.md]

Example 2: Batch Generation

示例2:批量生成

User: /spawn
Agent: [Shows multi-tab AskUserQuestion with 3 tabs]
  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
  Tab 2 (Scope): Project Agent / Global Agent
  Tab 3 (Output): Create Files / Show in Chat / Both
User: [Submits]
  Mode: Batch Generation
  Scope: Project Agent
  Output: Create Files
Agent: Please provide platforms (one per line):
User: PostgreSQL
Redis
RabbitMQ

Agent: [Creates 3 .md files in .claude/agents/ (project directory)]
用户:/spawn
Agent:[显示包含3个标签页的多问题AskUserQuestion界面]
  标签页1(模式):单个Agent / 批量生成 / 架构分析
  标签页2(范围):项目Agent / 全局Agent
  标签页3(输出):创建文件 / 在聊天中显示 / 两者皆选
用户:[提交]
  模式:批量生成
  范围:项目Agent
  输出:创建文件
Agent:请提供平台列表(每行一个):
用户:PostgreSQL
Redis
RabbitMQ

Agent:[在.claude/agents/(项目目录)中创建3个.md文件]

Example 3: Architecture Analysis

示例3:架构分析

User: /spawn
Agent: [Shows multi-tab AskUserQuestion with 3 tabs]
  Tab 1 (Mode): Single Agent / Batch Generation / Architecture Analysis
  Tab 2 (Scope): Project Agent / Global Agent
  Tab 3 (Output): Create Files / Show in Chat / Both
User: [Submits]
  Mode: Architecture Analysis
  Scope: Global Agent
  Output: Both
Agent: Describe your architecture or provide file path:
User: E-commerce platform: Next.js frontend, Node.js API, PostgreSQL, Redis cache, Stripe payments, AWS S3 storage, SendGrid emails
Agent: Found platforms: Next.js, Node.js, PostgreSQL, Redis, Stripe, AWS S3, SendGrid
[Shows multi-select AskUserQuestion]
User: [Selects: nextjs-expert, postgres-expert, redis-expert, stripe-expert]
Agent: [Generates 4 selected agents in ~/.claude/agents/]
用户:/spawn
Agent:[显示包含3个标签页的多问题AskUserQuestion界面]
  标签页1(模式):单个Agent / 批量生成 / 架构分析
  标签页2(范围):项目Agent / 全局Agent
  标签页3(输出):创建文件 / 在聊天中显示 / 两者皆选
用户:[提交]
  模式:架构分析
  范围:全局Agent
  输出:两者皆选
Agent:请描述你的架构或提供文件路径:
用户:电商平台:Next.js前端、Node.js API、PostgreSQL、Redis缓存、Stripe支付、AWS S3存储、SendGrid邮件
Agent:识别到的平台:Next.js、Node.js、PostgreSQL、Redis、Stripe、AWS S3、SendGrid
[显示多选AskUserQuestion选择器]
用户:[选择:nextjs-expert、postgres-expert、redis-expert、stripe-expert]
Agent:[在~/.claude/agents/中生成4个选中的Agent]

Implementation Steps

实现步骤

  1. Ask All Questions at Once using a single multi-question AskUserQuestion call:
    • Question 1 (header: "Mode"): Single Agent / Batch Generation / Architecture Analysis
    • Question 2 (header: "Scope"): Project Agent (this project only) / Global Agent (all projects)
    • Question 3 (header: "Output"): Create File / Show in Chat / Both
    For Single Mode, also ask in the same call:
    • Question 4 (header: "Platform"): Offer "Custom Platform" option (user types in Other field)
    • Question 5 (header: "Focus", multiSelect: true): General Coverage / [2-3 common focus areas for that tech]
  2. For Single Mode:
    • If user selected "Custom Platform", prompt for the platform name in chat
    • Generate comprehensive prompt based on answers
    • Create file and/or display based on output preference
  3. For Batch Mode:
    • Ask user to provide multi-line platform list in chat
    • For each platform:
      • Generate expert prompt
      • Save to
        .claude/agents/[platform]-expert.md
    • Report completion with file paths
  4. For Architecture Analysis:
    • Ask user for architecture description in chat
    • Parse and identify technologies
    • Present checkbox selector using AskUserQuestion (multiSelect: true)
    • Generate selected agents
    • Save to files based on output preference
  5. Generate Each Agent Prompt:
    • Research official docs (WebSearch or WebFetch)
    • Find 10+ authoritative URLs
    • Structure according to template above
    • Focus on patterns and best practices
    • Target 500-1000 lines with comprehensive patterns
    • Markdown formatted
  6. Output:
    • Determine file path based on Scope selection:
      • Project Agent:
        .claude/agents/[platform]-expert.md
      • Global Agent:
        ~/.claude/agents/[platform]-expert.md
        (Unix/Mac) or
        C:\Users\[username]\.claude\agents\[platform]-expert.md
        (Windows)
    • If "Create File" or "Both": Use Write tool with appropriate path and complete YAML frontmatter + system prompt
    • If "Show in Chat" or "Both": Display complete markdown (including frontmatter) in code block
    • Confirm creation with full file path
    • Remind user agent is immediately available via Task tool
Important: Always use a single AskUserQuestion call with multiple questions (2-4) to create the multi-tab interface. Never ask questions sequentially one at a time.
  1. 一次性询问所有问题:使用单个多问题AskUserQuestion调用:
    • 问题1(标题:"模式"):单个Agent / 批量生成 / 架构分析
    • 问题2(标题:"范围"):项目Agent(仅限当前项目) / 全局Agent(所有项目)
    • 问题3(标题:"输出"):创建文件 / 在聊天中显示 / 两者皆选
    对于单个Agent模式,在同一调用中额外询问:
    • 问题4(标题:"平台"):提供"自定义平台"选项(用户在其他字段输入)
    • 问题5(标题:"重点",multiSelect: true):全面覆盖 / [该技术的2-3个常见重点领域]
  2. 单个Agent模式处理:
    • 如果用户选择"自定义平台",在聊天中提示用户输入平台名称
    • 根据回答生成全面的提示词
    • 根据输出偏好创建文件和/或显示内容
  3. 批量模式处理:
    • 要求用户在聊天中提供多行平台列表
    • 针对每个平台:
      • 生成专家提示词
      • 保存至
        .claude/agents/[platform]-expert.md
    • 完成后报告文件路径
  4. 架构分析模式处理:
    • 要求用户在聊天中提供架构描述
    • 解析并识别技术栈
    • 使用AskUserQuestion展示多选选择器(multiSelect: true)
    • 生成选中的Agent
    • 根据输出偏好保存至文件
  5. 生成每个Agent提示词:
    • 研究官方文档(使用WebSearch或WebFetch)
    • 找到10个以上权威URL
    • 按照上述模板构建内容
    • 重点关注模式和最佳实践
    • 目标生成500-1000行内容,包含全面的模式
    • 采用Markdown格式
  6. 输出处理:
    • 根据范围选择确定文件路径:
      • 项目Agent
        .claude/agents/[platform]-expert.md
      • 全局Agent
        ~/.claude/agents/[platform]-expert.md
        (Unix/Mac)或
        C:\Users\[username]\.claude\agents\[platform]-expert.md
        (Windows)
    • 如果选择"创建文件"或"两者皆选":使用Write工具写入对应路径,包含完整YAML前置元数据和系统提示词
    • 如果选择"在聊天中显示"或"两者皆选":在代码块中显示完整Markdown内容(含前置元数据)
    • 确认创建成功并显示完整文件路径
    • 提醒用户Agent可立即通过Task工具使用
重要提示:始终使用单个包含多个问题(2-4个)的AskUserQuestion调用来创建多标签页界面。切勿逐个依次提问。

Quality Checklist

质量检查表

Before outputting each agent prompt, verify:
  • YAML frontmatter present with required fields (name, description)
  • Name uses lowercase-with-hyphens format
  • Description is clear and specific (length is flexible)
  • Tools field specified if restricting access (best practice: limit to necessary tools)
  • 10+ authoritative URLs included in system prompt
  • 10+ production-ready code examples included
  • Complete dev and prod configuration files
  • Testing patterns with actual test code
  • Error handling patterns and exception hierarchy
  • 5+ anti-patterns with bad/good code comparison
  • Concise and scannable system prompt
  • Clear use cases defined
  • Integration points identified
  • Common patterns referenced
  • Anti-patterns listed
  • Proper markdown formatting throughout
  • Filename matches name field:
    [name].md
  • Follows Claude Code subagent best practices (see documentation links above)
在输出每个Agent提示词前,需验证:
  • 包含YAML前置元数据及必填字段(name、description)
  • 名称采用小写连字符格式
  • 描述清晰具体(长度灵活)
  • 若限制工具访问则指定tools字段(最佳实践:仅授予必要工具)
  • 系统提示词中包含10个以上权威URL
  • 包含10个以上生产就绪的代码示例
  • 包含完整的开发和生产环境配置文件
  • 包含带实际测试代码的测试模式
  • 包含错误处理模式和异常层级
  • 包含5个以上反模式,附带错误/正确代码对比
  • 系统提示词简洁易读
  • 定义了清晰的使用场景
  • 识别了集成点
  • 引用了常见模式
  • 列出了反模式
  • 全程采用正确的Markdown格式
  • 文件名与name字段匹配:
    [name].md
  • 遵循Claude Code子Agent最佳实践(见上方文档链接)

Post-Generation

生成后操作

After creating agents, remind user:
  1. Review generated prompts
  2. Test agent with sample questions
  3. Refine based on actual usage
  4. Add to version control if satisfied
  5. Consult Claude Code documentation links above for advanced features and best practices
Additional Resources:
创建Agent后,提醒用户:
  1. 审核生成的提示词
  2. 使用示例问题测试Agent
  3. 根据实际使用情况优化
  4. 若满意则添加至版本控制
  5. 如需高级功能和最佳实践,请参考上方Claude Code文档链接
额外资源: