subagent-factory
Create specialized Claude Code agents on-the-fly. Guides through agent definition file creation with proper frontmatter, effective prompts, and tool scoping. USE WHEN user says 'create agent', 'new subagent', 'make an agent for', 'build agent', 'spawn agent', or wants to define custom agents for specific tasks.
What this skill does
# Subagent Factory Factory for creating specialized Claude Code agents. Generates agent definition files with proper configuration, effective system prompts, and appropriate tool access. ## When to Activate This Skill - User says: "create agent", "new subagent", "build agent" - User wants: Custom agents for specific tasks - User needs: Agent definition files, system prompts, tool configuration - User asks: How to make specialized agents, how to delegate work ## Two Creation Modes ### Quick Mode (Direct Creation) Fast path for experienced users. Minimal questions, direct file generation. **Use when**: You know exactly what agent you need. See: `workflows/quick-create.md` ### Interview Mode (Guided Creation) Interactive workflow with questions and customization at each step. **Use when**: Exploring agent design, learning the process, or creating complex agents. See: `workflows/interview-create.md` ## Quick Reference: Agent Schema ### Required Frontmatter Fields ```yaml --- name: agent-name # REQUIRED: kebab-case identifier description: When to use this agent # REQUIRED: natural language triggers --- ``` ### Optional Frontmatter Fields ```yaml tools: Read, Write, Bash # Comma-separated, omit to inherit all model: sonnet # sonnet|opus|haiku|inherit permissionMode: default # Permission handling mode skills: skill-name # Auto-load skills ``` ### System Prompt (Markdown Body) The Markdown content after frontmatter is the agent's system prompt. **Key elements**: 1. Identity/role definition 2. Clear responsibilities 3. Step-by-step workflow 4. Concrete checklists 5. Output format specification 6. Boundaries (DO/DO NOT) ## Core Principles ### 1. Single Responsibility Each agent should have ONE clear purpose, not multiple loosely-related tasks. ### 2. Right Altitude Not too prescriptive (brittle if-else logic), not too vague (unhelpful platitudes). Give clear guidance that lets the agent think. ### 3. Explicit Tool Scoping Grant minimum necessary tools. Read-only agents don't need Write. Reviewers don't need Bash. ### 4. Progressive Examples Include 3-5 concrete examples showing desired behavior patterns. ### 5. Actionable Instructions Use imperative form: "Run tests", "Analyze code", "Generate report" (not "The tests are run"). ## Navigation ### Deep Documentation - `references/agent-schema.md` - Complete frontmatter reference - `references/task-tool-reference.md` - Task tool parameters and usage - `references/prompt-patterns.md` - Effective prompt engineering patterns - `references/advanced-features.md` - Hooks, slash commands, MCP integration ### Workflows - `workflows/quick-create.md` - Fast agent creation steps - `workflows/interview-create.md` - Interactive guided creation ## Agent Types by Tool Access ### Read-Only Agents (Reviewers, Auditors) ```yaml tools: Read, Grep, Glob ``` **Use for**: Code review, security audits, compliance checks ### Research Agents (Analysts) ```yaml tools: Read, Grep, Glob, WebFetch, WebSearch, Write (if need to save research) ``` **Use for**: Technology research, documentation lookup, best practices ### Code Writers (Implementers) ```yaml tools: Read, Write, Edit, Bash, Grep, Glob ``` **Use for**: Feature implementation, bug fixes, refactoring ### Full-Stack Agents (End-to-End) ```yaml tools: Read, Write, Edit, Bash, Grep, Glob, WebFetch # Plus MCP tools as needed ``` **Use for**: Complete feature delivery, integration work ## Common Agent Patterns ### Security Reviewer **Purpose**: Analyze code for vulnerabilities **Tools**: Read, Grep, Glob **Key checklist**: Input validation, authentication, secrets, SQL injection, XSS, CSRF ### Test Runner **Purpose**: Execute tests, diagnose failures, propose fixes **Tools**: Read, Edit, Write, Bash, Grep, Glob **Key workflow**: Run tests → Diagnose failures → Propose fixes → Verify ### Tech Researcher **Purpose**: Investigate technologies, APIs, best practices **Tools**: Read, Grep, Glob, WebFetch, WebSearch **Key output**: Comparison matrix, recommendation with rationale, next steps ### Code Implementer **Purpose**: Build features following specifications **Tools**: Read, Write, Edit, Bash, Grep, Glob **Key workflow**: Understand requirements → Design → Implement → Test → Document ## File Location Agent definitions go in: - **Project-level**: `.claude/agents/` (version controlled, team-shared) - **User-level**: `~/.claude/agents/` (personal agents) **Precedence**: Project agents override user agents with same name. ## Task Tool Integration Agents are invoked via the Task tool: ``` Use the security-reviewer agent to analyze the authentication module for vulnerabilities. ``` **Built-in agent types**: - `general-purpose` - Full tools, Sonnet model - `explore` - Read-only, Haiku model (fast searches) - `plan` - Research and analysis during planning **Custom agents**: Reference by name from `.claude/agents/` **Parallel execution**: Up to 10 concurrent agents (automatic queuing for more) ## Key Insights 1. **System prompt is Markdown body, NOT frontmatter** - Common mistake 2. **Tool inheritance** - Omit `tools` field to inherit all; specify to restrict 3. **Model selection** - Use `haiku` for fast searches, `sonnet` for balanced work, `opus` for complex reasoning 4. **Token overhead** - Each agent spawn costs ~20k tokens; balance parallelization 5. **Context isolation** - Each agent has independent context window (prevents cross-contamination) ## Quick Start **Simple example**: ```markdown # .claude/agents/test-runner.md --- name: test-runner description: Run tests, diagnose failures, propose fixes. Use after code changes. tools: Read, Edit, Bash, Grep model: sonnet --- You are a test automation specialist. ## Workflow 1. Run test suite using project test command 2. If failures: capture output, read test files, diagnose root cause 3. Propose minimal fix with rationale 4. Re-run to verify ## Output Format - Test results summary - Failure analysis (if any) - Proposed fixes with evidence ``` For detailed examples and patterns, see reference documentation. ## Next Steps 1. Choose creation mode (quick or interview) 2. Define agent purpose and responsibilities 3. Select appropriate tools 4. Write effective system prompt 5. Test with realistic scenarios 6. Iterate based on failures Start with `workflows/quick-create.md` for direct creation or `workflows/interview-create.md` for guided process.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.