From productivity-skills
Create, configure, and orchestrate Claude Code subagents — specialized Claude instances with focused roles and limited tool access. Covers YAML frontmatter (name, description, tools, model, permissions, hooks, MCP servers), system prompt design, tool restriction patterns, background execution, and multi-agent orchestration. Use whenever the user mentions subagents, delegation, specialists, agent configs, `.claude/agents/`, the `/agents` command, or wants to parallelize work — even when they just say "background agent" or "delegate this".
How this skill is triggered — by the user, by Claude, or both
Slash command
/productivity-skills:agent-creatorWhen to use
When the user wants to create, edit, configure, or orchestrate a Claude Code subagent. Keywords — subagent, agent, delegate, specialist, `/agents`, `.claude/agents/`, agent config, background agent, parallel agents, orchestration, multi-agent workflow. Also trigger when the user asks how subagents work, which tools/models to choose, or how to restrict agent permissions. Skip when the user is working on a non-delegating skill or an API-level tool that has no subagent primitive.
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!-- canonical:writing-rules:start -->
These rules govern every prose artifact this skill emits — READMEs, CHANGELOGs, commit messages, PR bodies, release notes, doc paragraphs, non-trivial comments. Apply them at draft time, verify before output.
NEVER commit secrets)./humanize-en if installed.Subagents are specialized Claude instances that run in isolated contexts with focused roles and limited tool access. This skill covers how to create effective subagents, write strong system prompts, configure tool access, and orchestrate multi-agent workflows.
Subagents enable delegation of complex tasks to specialized agents that operate autonomously without user interaction, returning their final output to the main conversation.
Before drafting an agent, surface the four contract questions. If the user's spec is vague, ask these via AskUserQuestion rather than fabricating answers:
description field for routing.The description field carries triggers; the system prompt body carries workflow + output format. Both are derived from these answers.
/agents command.claude/agents/) or user-level (~/.claude/agents/)sonnet, opus, haiku, full model ID, or inherit)Example:
---
name: code-reviewer
description: Expert code reviewer. Use proactively after code changes to review for quality, security, and best practices.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a senior code reviewer focused on quality, security, and best practices.
## Focus Areas
- Code quality and maintainability
- Security vulnerabilities
- Performance issues
- Best practices adherence
## Output
Provide specific, actionable feedback with file:line references.
| Priority | Location | Scope |
|---|---|---|
| 1 (highest) | Managed settings | Organization-wide |
| 2 | --agents CLI flag | Current session |
| 3 | .claude/agents/ | Current project (git-shared) |
| 4 | ~/.claude/agents/ | All your projects |
| 5 (lowest) | Plugin's agents/ dir | Where plugin is enabled |
When names conflict, higher priority wins. Project agents override user-level agents.
All supported YAML frontmatter fields. Only name and description are required.
| Field | Required | Description |
|---|---|---|
name | Yes | Unique identifier, lowercase letters and hyphens |
description | Yes | When Claude should delegate to this agent. Write clear trigger conditions |
tools | No | Comma-separated allowlist. Inherits all tools if omitted |
disallowedTools | No | Comma-separated denylist, removed from inherited tools |
model | No | sonnet, opus, haiku, full model ID (e.g. claude-opus-4-8), or inherit. Defaults to inherit |
permissionMode | No | default, acceptEdits, auto, dontAsk, bypassPermissions, or plan |
maxTurns | No | Maximum agentic turns before auto-stop |
skills | No | Skills to load into agent context at startup (full content injected) |
mcpServers | No | MCP servers: string references or inline definitions |
hooks | No | Lifecycle hooks scoped to this agent |
memory | No | Persistent memory scope: user, project, or local |
background | No | true to always run as background task. Default: false |
effort | No | Effort level override: low, medium, high, max |
isolation | No | worktree to run in a temporary git worktree |
color | No | Display color: red, blue, green, yellow, purple, orange, pink, cyan |
initialPrompt | No | Auto-submitted first user turn when agent runs as main session (via --agent) |
Model resolution order: CLAUDE_CODE_SUBAGENT_MODEL env var > per-invocation model > frontmatter model > main conversation model.
Tool restriction patterns:
tools: Read, Grep, Glob — read-only analysisdisallowedTools: Write, Edit — inherit all except writestools: Agent(worker, researcher), Read — restrict which subagents can be spawned (main thread only)disallowedTools applied first, then tools resolved against remainderPlugin agents do not support hooks, mcpServers, or permissionMode (ignored for security).
Subagents are black boxes that cannot interact with users.
Subagents cannot spawn other subagents. Don't include Agent in a subagent's tools. This restriction only applies to subagents — main thread agents (via --agent) can spawn subagents.
Write the system prompt as the markdown body after frontmatter. The agent receives only this prompt (plus environment details), not the full Claude Code system prompt.
Agents can run in the background using the run_in_background parameter on the Agent tool, enabling parallel execution while the main conversation continues.
Launching: Set run_in_background: true on the Agent tool call. Returns an agent_id.
Retrieving results: The main conversation is automatically notified when background agents complete.
Parallel pattern: Launch multiple independent agents in a single message, then collect results:
Agent 1: code-reviewer (background)
Agent 2: security-scanner (background)
Agent 3: test-analyzer (background)
-> All run in parallel
-> Results collected when each completes
Resuming: Use SendMessage with the agent's ID to resume with full context preserved.
When to use background:
When NOT to use:
/agents command for interactive management (view, create, edit, delete)claude agents to list all configured agents from the command line.claude/agents/ or ~/.claude/agents/--agents '{...}' JSON for temporary agents that aren't saved to diskCore references:
Advanced topics:
tools + disallowedTools resolution is counterintuitive when both are set. Per § Configuration, disallowedTools applies first, then tools resolves against the remainder. Setting tools: Read, Write + disallowedTools: Write yields an agent with only Read; Write is denied before the allowlist sees it. Fix: use one mechanism, not both; prefer the allowlist for fine-grained control.hooks, mcpServers, permissionMode. Per § Configuration, these fields are stripped from plugin agents for security; the agent loads without them and emits no warning. Fix: for plugin agents, move hook logic into the system prompt; for full configurability, use project-level .claude/agents/ instead of plugin distribution.Agent in a subagent's tools is rejected at runtime. Multi-agent fan-out must happen from the main thread (or a --agent-launched main agent), never from inside a subagent. Fix: flatten the workflow so the main thread orchestrates the parallel subagents directly.CLAUDE_CODE_SUBAGENT_MODEL env var > per-invocation model > frontmatter model > main conversation model. An ambient CLAUDE_CODE_SUBAGENT_MODEL=claude-haiku-4-5-20251001 overrides a model: opus in frontmatter. Fix: explicitly set model in frontmatter to document the contract; verify against echo $CLAUDE_CODE_SUBAGENT_MODEL if behavior surprises.A well-configured agent has:
/claude-md — author and optimize CLAUDE.md / .claude/rules/*.md. Project-wide instructions pair naturally with .claude/agents/*.md definitions; use this skill for the agent specs and /claude-md for the surrounding project memory.npx claudepluginhub coroboros/agent-skills --plugin productivity-skillsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.