From rcc
Guides creation of specialized Claude Code subagents in .claude/agents/ using TDD process with tasks like RED test, GREEN agent write, and refactor. Use for 'create agent', 'add reviewer', or isolated tasks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rcc:writing-subagentsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Writing subagents IS creating specialized workers with isolated contexts.**
Writing subagents IS creating specialized workers with isolated contexts.
Subagents run via the Agent tool with their own context window, tools, and system prompt. Use for tasks that benefit from focused expertise.
Core principle: One agent, one responsibility. Bloated agents become unfocused.
Violating the letter of the rules is violating the spirit of the rules.
Pattern: Skill Steps Handoff: none Next: none
Before ANY action, create task list using TaskCreate:
TaskCreate for EACH task below:
- Subject: "[writing-subagents] Task N: <action>"
- ActiveForm: "<doing action>"
Tasks:
Announce: "Created 7 tasks. Starting execution..."
Execution rules:
TaskUpdate status="in_progress" BEFORE starting each taskTaskUpdate status="completed" ONLY after verification passesTaskList to confirm all completed| TDD Phase | Subagent Creation | What You Do |
|---|---|---|
| RED | Test without agent | Perform task in main context, note issues |
| Verify RED | Document problems | Note context pollution, scope creep |
| GREEN | Write agent | Create focused agent addressing problems |
| Verify GREEN | Test invocation | Verify agent runs with correct tools/prompt |
| REFACTOR | Optimize | Reduce tools, sharpen system prompt |
Goal: Understand what specialized task needs isolation.
Questions to answer:
When to use subagents:
Built-in subagent types (consider BEFORE creating custom agents):
| Type | Model | Tools | Use Case |
|---|---|---|---|
Explore | Haiku | Read-only (no Write/Edit) | Fast codebase search, analysis |
Plan | Inherit | Read-only | Research and planning |
general-purpose | Inherit | All | Complex multi-step tasks |
Decision: Can a built-in type handle this? If yes, use it directly via the Agent tool — no agent file needed.
Verification: Can describe the agent's single responsibility in one sentence.
Goal: Perform the task in main context. Note issues that arise.
Process:
Verification: Documented at least 1 issue (context pollution, focus loss, inconsistency) from running task in main context.
Goal: Create agent file addressing the problems you documented.
.claude/agents/ # Project-level
~/.claude/agents/ # User-level (global)
---
name: agent-name
description: What this agent does. Use proactively when [triggers].
tools: Read, Grep, Glob, Bash
model: sonnet
---
System prompt for the agent.
## Role
[Clear description of the agent's responsibility]
## Process
[Steps the agent should follow]
## Output Format
[Expected output structure]
See references/agent-spec.md for full configuration fields, model selection, context:fork guidelines, and tool permissions.
Key rules:
name: lowercase with hyphens, matches filenamedescription: include "Use proactively when..." for auto-invoketools: minimal set (principle of least privilege). Subagents CANNOT request permissions at runtime.hooks, mcpServers, or permissionMode| Agent Type | Recommended Tools |
|---|---|
| Code reviewer | Read, Grep, Glob |
| Test runner | Read, Bash, Grep |
| Explorer | Read, Glob, Grep, Bash |
| Writer | Read, Edit, Write |
Verification:
Goal: Verify agent file structure is correct.
Checklist:
.claude/agents/ directoryname and descriptionVerification: All checklist items pass.
Goal: Verify agent can be invoked via Agent tool.
Test:
Agent tool:
- subagent_type: "[plugin:]agent-name"
- prompt: "Test invocation"
Check:
Verification: Agent invocation succeeds without errors.
Goal: Run agent on real task and verify quality.
Process:
Verification:
Goal: Have subagent reviewed by subagent-reviewer.
Agent tool:
- subagent_type: "rcc:subagent-reviewer"
- prompt: "Review subagent at [path/to/agent.md]"
Outcomes:
This is the REFACTOR phase: Close loopholes identified by reviewer.
Verification: subagent-reviewer returns "Pass" rating.
These thoughts mean you're rationalizing. STOP and reconsider:
All of these mean: You're about to create a weak agent. Follow the process.
| Excuse | Reality |
|---|---|
| "Needs all tools" | More tools = more ways to go wrong. Minimize. |
| "Multi-purpose agent" | Jack of all trades = master of none. One job. |
| "Main context works" | Context pollution is invisible until it's a problem. |
| "Simple prompt" | Simple ≠ correct. Test the behavior. |
| "Opus is better" | Opus costs 15x haiku. Use appropriate model. |
digraph subagent_creation {
rankdir=TB;
start [label="Need subagent", shape=doublecircle];
analyze [label="Task 1: Analyze\nrequirements", shape=box];
need_agent [label="Needs\nisolation?", shape=diamond];
no_agent [label="Use main\ncontext", shape=box];
baseline [label="Task 2: RED\nTest without agent", shape=box, style=filled, fillcolor="#ffcccc"];
write [label="Task 3: GREEN\nWrite agent file", shape=box, style=filled, fillcolor="#ccffcc"];
validate [label="Task 4: Validate\nstructure", shape=box];
invoke [label="Task 5: Test\ninvocation", shape=box];
invoke_pass [label="Invocation\nworks?", shape=diamond];
verify [label="Task 6: Verify\nbehavior", shape=box];
review [label="Task 7: REFACTOR\nQuality review", shape=box, style=filled, fillcolor="#ccccff"];
review_pass [label="Review\npassed?", shape=diamond];
done [label="Agent complete", shape=doublecircle];
start -> analyze;
analyze -> need_agent;
need_agent -> no_agent [label="no"];
need_agent -> baseline [label="yes"];
baseline -> write;
write -> validate;
validate -> invoke;
invoke -> invoke_pass;
invoke_pass -> verify [label="yes"];
invoke_pass -> write [label="no"];
verify -> review;
review -> review_pass;
review_pass -> done [label="pass"];
review_pass -> write [label="fail\nfix issues"];
}
advising-architecture skill for component classification guidancenpx claudepluginhub wayne930242/reflexive-claude-codeGuides creating, configuring, and orchestrating Claude Code subagents and Task tool. Covers prompts, tools, models, file structures, and multi-agent workflows.
Claude Code subagent lifecycle: creation, configuration, evaluation, and troubleshooting. Invoke whenever task involves any interaction with Claude Code subagents — designing, debugging, iterating, or deciding when to delegate work to isolated agent contexts.
Creates bite-sized, testable implementation plans from specs or requirements, with file structure and task decomposition. Activates before coding multi-step tasks.