SUBAGENTS.md.tmpl
2.2 KB94 lines
---type: subagentsscope: project-roottags:- claude- subagents- referencecreated: [YYYY-MM-DD]updated: [YYYY-MM-DD]---<!--SUBAGENTS.md: Sub-agent definitions for this project.Only generate this file if the project actually uses sub-agents.Most small/medium projects don't need them.Sub-agents are warranted when:- Tasks split cleanly into specialist roles- The project benefits from forced separation of concerns (e.g., a hygienestep that strips bias from prompts before they hit a research agent)- The project runs long agentic loops where a sub-agent prevents context bloat--># [PROJECT NAME]: Sub-agentsThis project uses [N] sub-agents. Dispatch them per the rules below.## When to use a sub-agent vs. doing it inline[2-3 sentences on the principle for this project. E.g., "Use a sub-agent when the task requires a clean context (no prior conversation bias), or when the task will produce >2k tokens of intermediate work that doesn't need to live in the main thread."]---## [SUBAGENT-NAME]**Role:** [One sentence. What this agent does and nothing else.]**Model:** [Opus / Sonnet / Haiku], because [why]. See [[MODEL_GUIDE]] for project-wide model rules.**When to dispatch:**- [Trigger condition]- [Trigger condition]**Do NOT dispatch when:**- [Anti-trigger]**Prompt structure:**```[Required opening: role statement, scope][Required context: what the agent needs to know]Task: [The specific task being delegated]Constraints:- [Constraint]- [Constraint]Return format:[Exact format the agent should respond in]```**Returns:** [What the calling context should expect to receive. Format and shape.]**Example dispatch:**> [A real-shaped invocation showing what calling this agent looks like in practice.]---## [SUBAGENT-NAME][Same structure as above.]---## Sub-agent chain patterns<!-- If sub-agents are commonly chained, document the pattern here. -->### Pattern: [NAME]**Sequence:** [Agent A] → [Agent B] → [Agent C]**When:** [Trigger for this whole chain]**Hand-off rules:**- [Agent A] returns [X]; [Agent B] consumes [X] as [Y]- [Agent B] returns [Z]; [Agent C] consumes [Z]**Failure modes to watch for:**- [What goes wrong and how to detect it]