Claude Code agent generation system that creates custom agents and sub-agents with enhanced YAML frontmatter, tool access patterns, and MCP integration support following proven production patterns
npx skills add https://github.com/alirezarezvani/claude-code-skill-factory --skill agent-factory
A comprehensive system for generating production-ready Claude Code agents and sub-agents. This skill provides templates, standards, and generation tools to create custom agents that seamlessly integrate with Claude Code's agent system.
This skill helps you create custom Claude Code agents for any domain or workflow. It generates properly formatted agent files that Claude Code can automatically discover and invoke when relevant.
Every generated agent includes rich metadata:
---
name: agent-name-kebab-case
description: When to invoke this agent
tools: Read, Write, Edit # Comma-separated
model: sonnet # sonnet|opus|haiku|inherit
color: green # Visual categorization
field: frontend # Domain area
expertise: expert # beginner|intermediate|expert
mcp_tools: mcp__playwright # MCP integrations
---
Development: frontend, backend, fullstack, mobile, devops
Quality: testing, security, performance
Strategic: product, architecture, research, design
Domain: data, ai, content, finance, infrastructure
AGENT_NAME: my-custom-agent
DESCRIPTION: What this agent does and when to invoke it
DOMAIN_FIELD: frontend
TOOLS_NEEDED: Read, Write, Edit, Bash
.claude/agents/ or ~/.claude/agents/@agent-factory
Create a custom agent:
Name: api-integration-specialist
Type: Implementation
Domain: backend
Description: API integration expert for third-party services
Capabilities: OAuth, REST clients, error handling
Tools: Read, Write, Edit, Bash
MCP: mcp__github
Output: Complete .claude/agents/api-integration-specialist.md file
Each generated agent is a single Markdown file:
---
name: custom-agent
description: Triggers auto-invocation
tools: Read, Write, Edit
model: sonnet
color: green
field: backend
expertise: expert
mcp_tools: mcp__github
---
You are a [role] specializing in [domain].
When invoked:
1. [Step 1]
2. [Step 2]
3. [Step 3]
[Detailed instructions]
[Checklists]
[Best practices]
[Output format]
1. product-planner → Creates requirements
2. frontend-developer + backend-developer → Build (parallel)
3. test-runner → Validates (sequential)
4. code-reviewer → Reviews (sequential)
1. debugger → Analyzes issue
2. [appropriate-dev-agent] → Fixes
3. test-runner → Validates fix
1. code-reviewer → Quality review (can run solo)
2. security-auditor → Security scan (can run solo)
Common MCP servers to integrate:
Agents automatically reference MCP tools in their capabilities when configured.
Agents consume system resources. Monitor with:
ps aux | grep -E "mcp|npm|claude" | wc -l
Safe ranges:
Warnings:
✅ Safe: 4-5 strategic agents in parallel
✅ Safe: 2-3 implementation agents coordinated
❌ Unsafe: Quality agents in parallel (crashes system)
Generated Agent Files:
Place in one of these locations:
Project agents (shared with team):
.claude/agents/custom-agent.md
Personal agents (available everywhere):
~/.claude/agents/custom-agent.md
Create custom agents for:
Use the AGENTS_FACTORY_PROMPT.md template when:
Version: 1.0.0
Last Updated: October 22, 2025
Compatibility: Claude Code (agents system)
Template Location: documentation/templates/AGENTS_FACTORY_PROMPT.md
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Replace with description of the skill and when Claude should use it.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Take alirezarezvani/agent-factory from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.