# Code Generation Prompt Templates
# Implement "Act, Learn, Reuse" workflow

version: "1.0"
last_updated: "2025-12-22"

# Prompt Chain Patterns
chains:
  snowball:
    description: "Iteratively enrich code through layering"
    stages:
      - intent_extraction: "Extract the core intent from: {task}"
      - structure_design: "Design structure for: {intent}"
      - implementation: "Implement based on: {structure}"
      - refinement: "Refine and optimize: {implementation}"

  self_correct:
    description: "Generate, validate, auto-correct"
    stages:
      - generate: "Generate code for: {task}"
      - validate: "Identify issues in: {code}"
      - correct: "Fix issues: {issues} in code: {code}"
    max_iterations: 3

  plan_execute:
    description: "Separate planning from implementation"
    stages:
      - plan: "Create detailed plan for: {task}. Include: steps, dependencies, edge cases"
      - execute: "Implement according to plan: {plan}"

# Reusable Prompts
prompts:
  python_function:
    template: |
      Create a Python function that {description}.

      Requirements:
      - Follow PEP 8 style
      - Include type hints
      - Handle edge cases: {edge_cases}
      - Return type: {return_type}
    success_rate: 0.0
    uses: 0

  refactor:
    template: |
      Refactor the following code to {goal}:

      ```{language}
      {code}
      ```

      Preserve behavior. Improve: {aspects}
    success_rate: 0.0
    uses: 0

  debug:
    template: |
      Debug this code. Error: {error}

      ```{language}
      {code}
      ```

      Identify root cause and fix.
    success_rate: 0.0
    uses: 0

# Learned Patterns (populated through experience)
learned_patterns:
  # Format: pattern_id: {description, example, success_count}

# Failure Modes (anti-patterns to avoid)
failure_modes:
  # Format: mode_id: {description, example, avoid_strategy}
