---
description: Customize workflow templates based on project-specific patterns
argument-hint: <template-name or "all">
---

# /eg:customize-templates

You are tasked with analyzing the project codebase and customizing generic templates to match project-specific patterns and requirements.

Input: `$ARGUMENTS`

## Step 1: Parse Template Target

Parse the argument to determine which template(s) to customize:
- If empty or "all": customize all templates
- Otherwise: customize specific template (e.g., "spec", "solution", "plan")

## Step 2: Identify Templates to Customize

List available templates:
```
!ls -la .claude/templates/*.template.md
```

Based on the argument, determine which templates to process.

## Step 3: Analyze Project and Customize

Use the Task tool to analyze and customize:

```
Task(
  description="Analyze project and customize templates",
  prompt=`
    Analyze the project and customize the {template-target} template(s).
    
    1. Read ALL CLAUDE*.md files throughout the project to understand:
       - Documented conventions and requirements
       - Project-specific patterns
       - Architectural decisions
       - Special considerations
    
    2. Examine the codebase to detect:
       - Frameworks and libraries used
       - Common import patterns
       - Authentication methods
       - Error handling approaches
       - Testing patterns
       - File organization
    
    3. For each template in .claude/templates/:
       - Keep the core structure intact
       - Add project-specific sections
       - Include relevant patterns discovered
       - Add examples from actual codebase
    
    Project-specific sections to consider adding:
    - Multi-tenancy considerations
    - Authentication/authorization patterns
    - Validation schema requirements
    - Framework-specific sections
    - Database/ORM patterns
    - API conventions
    - Testing requirements
    - Deployment considerations
    
    Update the templates to be immediately useful for THIS project while maintaining their general structure.
    
    Create a summary of what was customized and why.
  `,
  subagent_type="artificer"
)
```

## Step 4: Report Results

After customization completes:

```
!echo "Template Customization Complete
Date: $(date)
Target: $ARGUMENTS

Key Customizations:
- Review updated templates in .claude/templates/
- Templates now include project-specific patterns
- Ready for use in eg workflows

Next Steps:
- Test customized templates with workflows
- Further customize as needed
" 
```

## Examples

```
/eg:customize-templates
# Customizes all templates

/eg:customize-templates all  
# Explicitly customizes all templates

/eg:customize-templates spec
# Customizes only spec.template.md

/eg:customize-templates solution
# Customizes only solution.template.md
```

## Notes

The artificer agent will:
- Preserve template structure
- Add project-specific enhancements
- Include real examples from code
- Make templates immediately useful
- Avoid overwriting core functionality

This ensures templates guide users to follow project conventions automatically.