Create deterministic Claude Code custom subagent definitions with supported frontmatter, description-driven delegation, bounded system prompts, least-privilege tools, permission and MCP policy, model selection, and validation checks. Use when the user asks to create an agent, add a subagent, make a custom agent, define an agent definition, or build an autonomous subprocess for a specific project responsibility. [EXPLICIT]
Create custom Claude Code subagents: autonomous subprocesses with isolated context, specific tools, independent permissions, and tailored system prompts. [EXPLICIT]
Use this skill when the user asks for a persistent subagent or custom agent definition, for example:
Use agent-constitution-creator instead when the user needs a full
governance constitution with identity, authority, memory, handoff, and
multi-agent operating rules.
assets/agent-spec-schema.json as the canonical structured input shape.assets/tool-policy.json to choose least-privilege tools,
disallowedTools, Agent, Skill, and MCP access while rejecting wildcard
access.assets/model-selection-policy.json to map complexity to Claude Code
model aliases, inherit, or a full Claude model id.assets/description-trigger-policy.json to keep descriptions focused on
WHEN the parent should spawn the agent.assets/frontmatter-policy.json for supported subagent frontmatter and
plugin-agent unsupported fields.assets/orchestration-selection-policy.json to decide whether the user
needs a custom subagent, built-in subagent, agent view session, agent team,
workflow, skill, hook, or main-conversation work.assets/hook-policy.json to separate subagent frontmatter hooks from
project-level SubagentStart and SubagentStop hooks.assets/agent-template.md as the rendering skeleton.scripts/compile-agent.py before finalizing an agent definition from
structured input.scripts/check.sh to verify positive and negative fixtures offline.Do not create an agent when a lighter artifact fits better:
| Situation | Better alternative |
|---|---|
| One-off task instruction | Inline response |
| Reusable multi-step workflow | Skill with assets and scripts |
| Simple output format change | Output style |
| Always-run automation | Hook |
| Persistent project rule | CLAUDE.md or AGENTS.md source |
| Fast read-only code search | Built-in Explore |
| Plan-mode codebase research | Built-in Plan |
| Complex one-off execution | Built-in general-purpose |
| Several independent full sessions to monitor | Agent view background sessions |
| Peer sessions that coordinate and challenge each other | Agent team |
| Dozens of repeatable delegated checks | Dynamic workflow |
Use a custom subagent when the responsibility is repeatable, self-contained, and better handled in an isolated context with an explicit tool or permission contract.
If the request is underspecified, ask only for the missing fields required by
assets/agent-spec-schema.json: responsibility, scope, read/write authority,
expected output, and complexity.
.claude/agents/*.md.Explore, Plan,
general-purpose.Normalize the request into five sections:
agent: name, display name, role, responsibility, scope, and non-goals.routing: trigger phrases, negative triggers, destination scope, model,
color, tools, disallowedTools, permission mode, scoped MCP, hooks, skills,
memory, background, effort, isolation, turn limits, and initial prompt.behavior: task statement, ordered process, output format, constraints, and
reasoning tier.quality: quality bar, validation checks, escalation triggers, and residual
risks.evidence: source labels and evidence tags for decisions that came from the
user, codebase, or inference.python3 skills/agent-creator/scripts/compile-agent.py \
--input skills/agent-creator/scripts/fixtures/agent-spec-input.jsonThe compiler emits Markdown by default and stable JSON with --format json.
It fails if the name is invalid, trigger conditions are missing, model or tools
are unsafe, process steps are too thin, output format is absent, constraints
lack a negative boundary, or collision rules are violated.
bash skills/agent-creator/scripts/check.sh to verify positive and
negative fixtures offline (the only validator shipped with this skill)..claude/agents/ or ~/.claude/agents/ as a
separate user-approved mutation.The full agent-file skeleton, the frontmatter decision matrix (all fields + plugin-agent
restrictions), built-in subagent distinctions, tool-restriction patterns, and the scoped
MCP/hooks/memory/isolation rules live in
references/frontmatter-and-fields.md. Load it when
authoring the actual file. Two rules stay here: description states WHEN to spawn (not WHAT);
default tools to read-only and widen only on demonstrated need (least privilege, Constitution
Art. 3).
| Need | Prefer |
|---|---|
| One repeatable isolated worker that returns a summary | Custom subagent |
| Several independent full Claude Code sessions to monitor, attach, or resume | Agent view / background sessions |
| Peer sessions that coordinate through a lead and shared task list | Agent team |
| Rerunnable orchestration with many agents and script-owned state | Dynamic workflow |
| Reusable prompts/assets/scripts in the main context | Skill |
| Event-triggered deterministic action | Hook |
| Principle | Rationale | Anti-pattern |
|---|---|---|
| Self-sufficient context | Agent has no parent history | Referencing "the file we discussed" |
| Bounded scope | Prevents scope creep | "Handle anything related to X" |
| Explicit output format | Enables downstream consumption | "Summarize your findings" |
| Concrete process steps | Reproducible behavior | "Use your best judgment" |
| Negative constraints | Prevents common mistakes | No constraints section |
| Self-consistent commands | Every cited script must exist in the package | Referencing a validator not shipped with this skill |
The full validation checklist and the edge-case playbook (project context, over-spawning,
verbose output, overlapping agents, agent-view vs subagent, plugin-agent limits) live in
references/validation-and-edge-cases.md. Gate every
generated agent through it (the Guardian role / scripts/check.sh enforce the same checks).
assets/source-map.mdreferences/domain-knowledge.mdassets/frontmatter-policy.jsonassets/orchestration-selection-policy.jsonassets/hook-policy.jsonscripts/compile-agent.pydescription WHEN-to-spawn, tools least-priv, prompt autosuficiente, sin colisión con builtins. [EXPLICIT].claude/agents/ es una mutación aparte aprobada por el usuario. [EXPLICIT]hooks/mcpServers/permissionMode; sub-spawns solo si Agent está en tools. [EXPLICIT]Capas del packet, cargables bajo demanda (disciplina ICM: una capa por vez, nunca todas juntas): references/ guías de profundidad (cargar UNA por etapa) · knowledge/ cuerpo de conocimiento · prompts/ prompts listos · examples/ salida de ejemplo · agents/ subagentes del packet · templates/ plantilla de output · scripts/ automatización local · assets/ recursos estáticos.
e8f986b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.