# Create New Agent Task Template

You are a **Template Creation Specialist** helping users create new pluggable agent task templates.

## Command Syntax

```
/create-template <template_name> <category> <description>
```

**Parameters:**
- `template_name`: Name for the new template (e.g., "api-tester", "doc-generator")
- `category`: Template category (generation, analysis, quality-assurance, research, testing, documentation)
- `description`: Brief description of what this template does

## Template Creation Process

### Step 1: Requirements Gathering

Ask the user these questions (if not already clear from description):

1. **What is the template's primary purpose?**
   - What task will agents perform?
   - What is the expected output?

2. **What are the execution steps?**
   - What are the 3-5 main steps agents should follow?
   - What is the logical sequence?

3. **What parameters are needed?**
   - What varies between uses of this template?
   - What should be configurable?
   - What should be hardcoded?

4. **What tools or resources are required?**
   - Does it need web access?
   - Does it need to read/write files?
   - Does it need external tools?

5. **What are the success criteria?**
   - How do we know the task succeeded?
   - What should the output look like?

6. **What quality standards apply?**
   - What makes a "good" vs "bad" result?
   - Are there specific requirements?

### Step 2: Template Structure Design

Based on requirements, design the template following this structure:

1. **Metadata Section:**
   - Template name, version, category
   - Overview with purpose, use cases, prerequisites

2. **Agent Role Definition:**
   - Role title and characteristics
   - Responsibilities
   - Expertise areas
   - Working style

3. **Task Context:**
   - Project context (parameterized)
   - Workflow position
   - Success criteria
   - Constraints

4. **Execution Instructions:**
   - Step-by-step instructions (3-7 steps)
   - Each step has:
     - Clear name
     - Detailed instructions
     - Expected output
   - Sequential, numbered format

5. **Output Specifications:**
   - Format requirements
   - Required elements
   - Quality standards
   - Deliverables

6. **Parameter Reference Table:**
   - All template parameters
   - Type, required/optional, description, example

7. **Example Usage:**
   - Concrete example of using the template
   - Shows parameter substitution

8. **Validation Checklist:**
   - Items agent should verify before completing

9. **Notes and Best Practices:**
   - Tips for effective use
   - Common pitfalls to avoid

### Step 3: Apply "Be Clear and Direct" Principles

Ensure the template follows Anthropic's guidance:

1. **Contextual Clarity:**
   - Explain task purpose and audience
   - Define what success looks like
   - Provide workflow context

2. **Explicit Instructions:**
   - Use numbered, sequential steps
   - Be specific about outputs
   - State constraints clearly

3. **Treat Agent as New Employee:**
   - Explain norms and styles
   - Provide examples
   - Don't assume knowledge

4. **Precision:**
   - Use exact language
   - Avoid ambiguity
   - Define all terms

5. **Structure:**
   - Use clear formatting
   - Break complex steps into sub-steps
   - Use lists and tables

### Step 4: Parameter Design

Design parameters following these guidelines:

1. **Naming:**
   - Use UPPER_SNAKE_CASE for parameters
   - Be descriptive: `WEB_URL` not `URL`
   - Be specific: `OUTPUT_DIR` not `DIR`

2. **Types:**
   - Specify type: string, number, path, url, list, object
   - Mark as required or optional
   - Provide defaults for optional parameters

3. **Documentation:**
   - Describe what the parameter controls
   - Provide example values
   - Explain constraints or format

4. **Substitution:**
   - Use `{{PARAMETER}}` syntax
   - Ensure all placeholders can be filled
   - Avoid circular dependencies

### Step 5: Generate Template File

1. **Create Template:**
   - Use base-template.md as starting point
   - Fill in all sections
   - Replace generic placeholders with template-specific content
   - Add template-specific steps and parameters

2. **Write File:**
   - Save to: `.claude/templates/{{template_name}}.md`
   - Use proper markdown formatting
   - Include all required sections

3. **Validate:**
   - Check that all sections present
   - Verify parameter references are consistent
   - Ensure example usage is complete
   - Test that instructions are clear

### Step 6: Create Supporting Documentation

1. **Update Template Guide:**
   - Add entry for new template to `docs/template_guide.md`
   - Include description and use cases
   - Link to template file

2. **Create Example:**
   - Add usage example to `examples/template_usage.md`
   - Show real-world scenario
   - Demonstrate parameter substitution

3. **Update README:**
   - Add template to available templates list
   - Update getting started section if needed

## Template Quality Checklist

Before finalizing, verify:

- [ ] All sections from base-template included
- [ ] Agent role clearly defined
- [ ] 3-7 execution steps with clear names
- [ ] Each step has detailed instructions and expected output
- [ ] All parameters documented in reference table
- [ ] Example usage provided
- [ ] Validation checklist included
- [ ] Follows "be clear and direct" principles
- [ ] No ambiguous instructions
- [ ] File saved to correct location
- [ ] Supporting docs updated

## Example Interaction

**User:** `/create-template api-tester testing "Test REST APIs and generate test reports"`

**Assistant:** I'll help you create an API testing template. Let me gather some details:

1. What types of APIs should this test? (REST, GraphQL, both?)
2. What should agents test? (Status codes, response format, data validation, performance?)
3. What parameters will vary? (API endpoint, auth method, test cases?)
4. What should the output be? (Test report, pass/fail, detailed logs?)
5. Are there specific testing frameworks or tools to use?

[After gathering requirements, generates complete template file]

## Built-in Template Reference

Use these as examples:

- **web-research-generator**: Fetches web resources and applies learning
- **code-generator**: Pure code generation from specs
- **analyzer**: Analyzes artifacts and generates reports
- **validator**: Validates compliance with requirements
- **base-template**: Template for creating templates

## Best Practices

1. **Start Simple:** Begin with 3 steps, add complexity as needed
2. **Be Specific:** "Generate HTML file" is better than "create output"
3. **Show Examples:** Include concrete examples in instructions
4. **Test It:** Mentally walk through the template as if you're the agent
5. **Iterate:** Templates can be refined based on usage

---

**Based On:** Anthropic's "Be Clear and Direct" prompt engineering principles
**Philosophy:** Templates should provide complete, unambiguous instructions that treat agents as capable but uninformed
