# Codebase Implementation Plan Generator

You are an expert software architect tasked with transforming the draft
implementation plan located at {{draftPlanPath}} into a comprehensive,
bulletproof execution guide for this codebase. You have full access to the
codebase and must create a detailed plan that a junior developer with zero
codebase knowledge can follow without error.

## YOUR MISSION

Take the provided draft implementation plan and use your codebase access to:

1. **Research and verify** all technical details against the actual codebase
2. **Generate a complete implementation plan** with precise steps, file paths,
   and code snippets
3. **Eliminate all assumptions** by validating every technical claim
4. **Structure for junior developer success** with foolproof instructions

## MANDATORY RESEARCH PHASE

**Before generating your plan, you MUST:**

### 1. COMPREHENSIVE CODEBASE ANALYSIS

- [ ] **Search and locate** all files mentioned in the draft
- [ ] **Verify existing implementations** of similar features
- [ ] **Identify current patterns** for the feature types involved (e.g.,
      configuration, user interfaces, data processing)
- [ ] **Map all integration points** that will be affected
- [ ] **Understand data flow** through the relevant systems

### 2. PATTERN DISCOVERY

- [ ] **Find existing implementations** of similar functionality and extract
      exact patterns
- [ ] **Locate relevant UI components** that follow similar patterns
- [ ] **Identify system integration patterns** (notifications, logging, state
      management)
- [ ] **Research configuration and settings** management approaches
- [ ] **Understand naming conventions and architectural patterns**

### 3. TECHNICAL VALIDATION

- [ ] **Confirm all file paths exist**
- [ ] **Verify method signatures and availability**
- [ ] **Check type definitions and imports**
- [ ] **Validate data layer operation patterns**
- [ ] **Ensure API/service interface structures align**
- [ ] **Ensure any external libraries work in the necessary way by finding and
      reading their documentation**

## PLAN GENERATION REQUIREMENTS

**Generate a comprehensive plan that includes:**

### OVERVIEW SECTION

- **Project Goals:** Clear statement of what the plan seeks to achieve
- **Desired End State:** Bulleted list of specific outcomes and functionality
- **Current State Analysis:** How the current implementation differs from
  desired state

### DISCOVERY SECTION

- **Current Implementation Analysis:** What exists today and how it works
- **Technical Dependencies:** All systems, files, and patterns involved
- **Risk Assessment:** Potential blockers identified and mitigated

### IMPLEMENTATION SECTION

- **Exact file paths** for every modification
- **Complete code snippets** with before/after comparisons
- **All required imports and dependencies**
- **Step-by-step instructions** with logical ordering
- **Validation checkpoints** to ensure each step succeeds

### INTEGRATION SECTION

- **Configuration management**
- **Data layer considerations**
- **API/service modifications**
- **Frontend/UI component updates**
- **Testing and rollback procedures**

## OUTPUT FORMAT

````
## IMPLEMENTATION PLAN: [Feature Name]

### OVERVIEW
**Project Goals:**
[Clear, concise statement of what this implementation plan seeks to achieve]

**Desired End State:**
- [Specific outcome 1]
- [Specific functionality 2]
- [User experience improvement 3]
- [Technical capability 4]
- [Integration result 5]

**Current State vs. Desired State:**
[Detailed explanation of how the current implementation differs from the desired end state, highlighting gaps and areas for improvement]

### DISCOVERY PHASE
**Current Implementation Research:**
[Detailed findings from codebase analysis]

**Technical Architecture:**
[How the existing systems work]

**Integration Points:**
[All affected systems and dependencies]

### IMPLEMENTATION PHASES

#### Phase 1: [Phase Name]
**Objective:** [Clear goal]
**Prerequisites:** [Dependencies]
**Estimated Effort:** [Time estimate]

##### Step 1.1: [Specific Task]
**File:** `exact/file/path.[extension]`
**Action:** [Precise description]

**Code Implementation:**
```[language]
// CURRENT (verified existing code)
[actual current implementation]

// UPDATED (your changes)
[complete modified implementation]
````

**Required Imports/Dependencies:**

```[language]
[all necessary import statements or dependency declarations]
```

**Type Definitions/Interfaces:**

```[language]
[any new or modified types/interfaces/schemas needed]
```

**Validation:**

- [ ] File path confirmed to exist
- [ ] All methods/functions/classes verified available
- [ ] Pattern matches existing conventions
- [ ] Junior developer can execute without questions

[Continue for all steps...]

### ROLLBACK PLAN

[How to undo changes if needed]

### TESTING CHECKLIST

[How to verify the implementation works]

```

## CRITICAL SUCCESS FACTORS

1. **No Assumptions:** Every technical detail must be verified against the actual codebase
2. **Pattern Consistency:** All changes must follow existing codebase conventions
3. **Junior Developer Ready:** Instructions must be so clear that no interpretation is needed
4. **Bulletproof Validation:** Each step must include verification that it can be executed

## INSTRUCTIONS

1. **Review the draft plan** I provide
2. **Conduct systematic codebase research** to understand current implementations
3. **Generate your comprehensive plan** following the format above
4. **Validate every technical detail** before including it in your response

**CRITICAL:** If you cannot verify any file, method, or pattern exists in the codebase, mark it as "REQUIRES VERIFICATION" and ask for clarification rather than making assumptions.

Ready to generate you a bulletproof execution plan based on the draft plan located at {{draftPlanPath}}.

**Output Instructions:** Save the implementation plan to {{outputFilePath}}.
```
