Spawn

From 0xDarkMatter/claude-mods · View interactive version

Spawn is an AI agent skill from the GitHub repository 0xDarkMatter/claude-mods. Generate PhD-level expert-agent prompt files (.md) for Claude Code - authoring, not runtime. For spawning parallel RUNTIME workers use fleet-worker/fleetflow (via parallel-ops). Triggers: spawn agent, create agent file, generate expert prompt, new agent persona.

How to use this skill

Skill file

Spawn - Expert Agent Generator

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: firecrawl-expert.md (1026 lines), project-organizer.md (610 lines)

Usage Modes

Mode 1: Single Agent Generation

Generate one expert agent prompt for a specific technology platform.

Prompt for:

Mode 2: Batch Agent Generation

Create multiple agent prompts from a list of technology platforms.

Accept:

Mode 3: Architecture Analysis

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 File Format

All agents MUST be created as Markdown files with YAML frontmatter:

File Structure:

---
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:

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:

After creation, Claude Code picks the file up within seconds and the agent is available

through the Agent tool (named Task before Claude Code 2.1.63; Task(...) still works as an

alias). The one exception: the first agent in an agents/ directory that did not exist when

the session started needs a session restart to load.

Claude Code Agent Documentation

Essential Reading:

Key Concepts from Documentation:

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 firecrawl-expert.md and project-organizer.md in agents/ for reference implementations.

Requirements:

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:
  1. Use Write tool with appropriate path
  2. Verify file was created successfully
  3. Agent is immediately available for use

Examples

Example 1: Single 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]

Example 2: Batch Generation

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)]

Example 3: Architecture Analysis

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, redis-expert, stripe-expert, sendgrid-expert]
Agent: [Generates 4 selected agents in ~/.claude/agents/]

Implementation Steps

  1. Ask All Questions at Once using a single multi-question AskUserQuestion call:

For Single Mode, also ask in the same call:

  1. For Single Mode:
  1. For Batch Mode:
  1. For Architecture Analysis:
  1. Generate Each Agent Prompt:
  1. Output:

this created the agents/ directory)

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.

Quality Checklist

Before outputting each agent prompt, verify:

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:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.