# Template Usage Examples Concrete examples demonstrating how to use the pluggable template system for various scenarios. ## Table of Contents 1. [Web-Enhanced Visualization Campaign](#web-enhanced-visualization-campaign) 2. [Code Generation Series](#code-generation-series) 3. [Quality Analysis Workflow](#quality-analysis-workflow) 4. [Validation Pipeline](#validation-pipeline) 5. [Custom Template Creation](#custom-template-creation) 6. [Infinite Mode Learning](#infinite-mode-learning) 7. [Mixed Template Workflow](#mixed-template-workflow) --- ## Web-Enhanced Visualization Campaign **Scenario:** Generate 10 D3.js visualizations, each learning from different web resources. ### Step 1: Create Specification `specs/d3_viz_spec.md`: ```markdown # D3.js Visualization Specification ## File Naming Pattern: `viz_d3_{{theme}}_{{number}}.html` Example: viz_d3_force_001.html ## Requirements - Complete standalone HTML file - Uses D3.js library - Interactive elements (hover, click, or drag) - Demonstrates techniques from web source - Attribution in header comment ## Quality Standards - No errors in console - Professional appearance - Well-commented code - Unique from other iterations ``` ### Step 2: Create Parameter File `params/d3_campaign.json`: ```json { "PROJECT_NAME": "D3.js Learning Campaign", "PROJECT_DESCRIPTION": "Progressive D3 learning from official documentation", "MIN_TECHNIQUES": 2, "URL_STRATEGY": { "foundation": [ "https://d3js.org/getting-started", "https://d3js.org/what-is-d3" ], "intermediate": [ "https://d3js.org/d3-selection", "https://d3js.org/d3-scale", "https://d3js.org/d3-axis" ], "advanced": [ "https://d3js.org/d3-force", "https://d3js.org/d3-hierarchy", "https://d3js.org/d3-geo" ], "expert": [ "https://observablehq.com/@d3/gallery", "https://observablehq.com/@d3/learn-d3" ] } } ``` ### Step 3: Run Command ```bash /infinite-templated web-research-generator specs/d3_viz_spec.md d3_output 10 params/d3_campaign.json ``` ### What Happens 1. **Orchestrator loads:** - Template: `web-research-generator.md` - Spec: `specs/d3_viz_spec.md` - Params: `params/d3_campaign.json` 2. **For iterations 1-10:** - Assigns URL from strategy (foundation → intermediate → advanced) - Creates parameter mapping: ```json { "WEB_URL": "https://d3js.org/d3-selection", "LEARNING_FOCUS": "D3 selection and data binding", "FILE_NAME": "viz_d3_selection_003.html", "ITERATION_NUMBER": 3, "MIN_TECHNIQUES": 2 } ``` - Substitutes into template - Deploys agent with instantiated task 3. **Each agent:** - Fetches assigned URL - Extracts 2+ techniques - Analyzes existing iterations - Generates unique visualization - Documents learning in file header 4. **Result:** - 10 HTML files in `d3_output/` - Each demonstrates different D3 techniques - Progressive sophistication from basic → advanced --- ## Code Generation Series **Scenario:** Generate 20 themed UI components without web research. ### Step 1: Create Specification `specs/ui_component_spec.md`: ```markdown # Themed UI Component Specification ## File Naming Pattern: `{{theme}}_component_{{number}}.html` Example: cosmic_component_007.html ## Structure - Complete HTML file - Embedded CSS and JavaScript - Unique theme applied throughout - Interactive elements - Professional appearance ## Themes to Explore - Nature (ocean, forest, desert, mountains) - Technology (cyberpunk, retro-tech, holographic) - Abstract (geometric, fluid, particle-based) - Cultural (various aesthetics and styles) ## Quality Standards - Fully functional standalone - Creative interpretation of theme - Professional code quality - No errors ``` ### Step 2: Run Command ```bash /infinite-templated code-generator specs/ui_component_spec.md components 20 ``` No parameter file needed - template generates themes creatively. ### What Happens 1. **Orchestrator:** - Loads `code-generator.md` template - Reads spec - Plans 20 unique themes 2. **For each iteration:** - Generates unique theme (e.g., "bioluminescent ocean") - Creates parameter set: ```json { "THEME": "bioluminescent ocean depths", "UNIQUE_FEATURES": "Glow effects, wave animations, depth parallax", "FILE_NAME": "bioluminescent_component_012.html", "ITERATION_NUMBER": 12 } ``` - Instantiates template - Deploys agent 3. **Each agent:** - Analyzes existing components - Plans unique approach - Generates component with theme - Ensures no duplicates 4. **Result:** - 20 unique components in `components/` - Diverse themes and approaches - All meet spec requirements --- ## Quality Analysis Workflow **Scenario:** Analyze quality of 20 generated components. ### Step 1: Create Analysis Criteria `specs/quality_criteria.md`: ```markdown # Component Quality Criteria ## Metrics to Collect 1. Lines of code 2. Number of interactive elements 3. CSS complexity (number of rules) 4. JavaScript functions count 5. Documentation completeness (% of code with comments) ## Quality Dimensions 1. **Functionality** - Does it work without errors? 2. **Uniqueness** - How different from other iterations? 3. **Code Quality** - Clean, readable, well-structured? 4. **Documentation** - Adequate comments and explanations? 5. **Visual Polish** - Professional appearance? ## Scoring Each dimension rated 1-5: - 5: Excellent - 4: Good - 3: Acceptable - 2: Needs improvement - 1: Poor ## Report Format - Executive summary - Per-file scores table - Top 3 best components - Top 3 areas for improvement - Recommendations ``` ### Step 2: Create Parameter File `params/analysis_params.json`: ```json { "PROJECT_NAME": "UI Component Quality Analysis", "PROJECT_DESCRIPTION": "Assess quality of generated components", "METRICS": "LOC, interactive elements, CSS complexity, JS functions, documentation %", "TARGET_DESCRIPTION": "20 themed UI components" } ``` ### Step 3: Run Command ```bash /infinite-templated analyzer specs/quality_criteria.md reports/quality_analysis.md 1 params/analysis_params.json ``` Note: Count is 1 because we're running one analysis job (not iterating). ### What Happens 1. **Orchestrator:** - Loads `analyzer.md` template - Reads quality criteria - Prepares parameters: ```json { "TARGET_PATTERN": "components/*.html", "CRITERIA_FILE": "specs/quality_criteria.md", "OUTPUT_FILE": "reports/quality_analysis.md", "METRICS": "LOC, interactive elements, ..." } ``` 2. **Analyzer agent:** - Finds all components - Analyzes each against criteria - Collects metrics - Identifies patterns - Generates comprehensive report 3. **Result:** - Detailed analysis report in `reports/quality_analysis.md` - Metrics for each component - Insights and recommendations --- ## Validation Pipeline **Scenario:** Validate that all components meet specification. ### Step 1: Create Validation Rules `specs/validation_rules.md`: ```markdown # Component Validation Rules ## File Naming - Must match pattern: {{theme}}_component_{{number}}.html - Number must be zero-padded 3 digits - Theme must be descriptive ## File Structure - Must start with - Must have complete section - Must have attribution comment block - Must have