# Subagent Template This template is used to generate specialized subagent files. ## Template Structure ```markdown --- description: "{specific_task_description}" mode: subagent temperature: 0.1 --- # {Subagent Name} {area_of_expertise} {specific_task_this_agent_completes} {how_this_fits_in_larger_system} {Specialist_Type} expert with deep knowledge of {specific_domain} {Specific, measurable objective this agent accomplishes} {Description of what this parameter is and acceptable values} {Description of what this parameter is and acceptable values} {additional parameters as needed} conversation_history full_system_state unstructured_context {First thing to do} 1. {Substep 1} 2. {Substep 2} 3. {Substep 3} {How to verify this step succeeded} {What this step produces} {Second thing to do} 1. {Substep 1} 2. {Substep 2} {Do option A} {Do option B} {What this step produces} {Final thing to do} 1. {Substep 1} 2. {Substep 2} {Final output to return} {Always enforce requirement X} {Always validate parameter Y} {Never make assumptions about Z} {Never proceed if critical data is missing} ```yaml {Exact structure of output, preferably in YAML or JSON format} status: "success" | "failure" | "partial" result: field1: value field2: value metadata: execution_time: "X.Xs" warnings: ["warning 1", "warning 2"] ``` ```yaml {Concrete example of successful output} status: "success" result: example_field: "example value" another_field: 42 metadata: execution_time: "2.3s" warnings: [] ``` If something goes wrong, return: ```yaml status: "failure" error: code: "ERROR_CODE" message: "Human-readable error message" details: "Specific information about what went wrong" ``` - Verify all required inputs are present - Validate input formats and types - Check that any referenced files exist - Ensure prerequisites are met - Verify output meets specifications - Validate any files created or modified - Ensure no side effects occurred - Check quality standards are met <{domain}_principles> {Domain-specific principle or best practice} {Another domain-specific principle} {Another domain-specific principle} ``` ## Customization Points 1. **Specialist Domain**: Define the specific area of expertise 2. **Task Scope**: Clearly articulate what this agent does 3. **Input Parameters**: Define all required inputs with types and descriptions 4. **Process Flow**: Break down the task into clear steps 5. **Constraints**: Add domain-specific must/must_not rules 6. **Output Format**: Define exact output structure (prefer YAML/JSON) 7. **Validation**: Add domain-specific validation checks 8. **Principles**: Include domain-specific best practices ## Subagent Types ### Research Agent - **Purpose**: Gather information from external sources - **Context Level**: Level 1 (isolation) - **Inputs**: Topic, scope, source constraints - **Outputs**: Research summary with citations ### Validation Agent - **Purpose**: Validate outputs against standards - **Context Level**: Level 2 (standards + rules) - **Inputs**: Content to validate, validation criteria - **Outputs**: Validation score with prioritized feedback ### Processing Agent - **Purpose**: Transform or process data - **Context Level**: Level 1 (task only) - **Inputs**: Data to process, transformation rules - **Outputs**: Processed data ### Generation Agent - **Purpose**: Create content or artifacts - **Context Level**: Level 2 (templates + standards) - **Inputs**: Generation parameters, requirements - **Outputs**: Generated content ### Integration Agent - **Purpose**: Handle external system integrations - **Context Level**: Level 1 (task only) - **Inputs**: Integration parameters, data to send - **Outputs**: Integration result ## Validation Criteria Generated subagents must: - Define clear, explicit input parameters - Include step-by-step process flow - Specify exact output format (preferably YAML/JSON) - Include pre and post execution validation - Have clear constraints (must/must_not) - Be stateless (no conversation history) - Score 8+/10 on XML optimization criteria ## Best Practices 1. **Single Responsibility**: Each subagent should do ONE thing extremely well 2. **Stateless**: Don't maintain state or assume context from previous interactions 3. **Complete Instructions**: Every call must include ALL information needed 4. **Explicit Output**: Define exact output format with examples 5. **Validation**: Validate inputs before processing and outputs before returning 6. **Error Handling**: Handle errors gracefully with clear messages