Feature Refactor Proposal
This skill provides a structured methodology for analyzing an existing codebase against new feature requirements, identifying technical debt and risks, and producing a clear refactoring and implementation proposal before writing code.
When to Use
Use this skill when:
- Adding a complex new feature to an existing codebase
- Extending existing components or state management that could cause architectural regression
- Assessing feature feasibility and breaking changes before implementation
- Preparing an architecture proposal or technical design review for a feature request
Workflow Decision Tree
User provides New Feature Requirements / Issue
│
├── 1. Parse Requirements & Define Boundaries
│ └─ Identify UI, state, API, and backend scope
│
├── 2. Map Codebase Impact
│ └─ Locate affected components, hooks, services, types
│
├── 3. Evaluate Risks & Trade-offs
│ └─ Consult [risk_checklist.md](references/risk_checklist.md)
│
├── 4. Draft Refactoring & Implementation Plan
│ └─ Use [proposal_template.md](references/proposal_template.md)
│
└── 5. Present Proposal & Verification Steps
└─ Provide phased steps and validation commands
Detailed Steps
Step 1: Requirement Breakdown & Scope Mapping
- Extract core requirements and non-goals from the user prompt or issue document.
- Categorize requirements by impact layer:
- UI Layer: Pages, components, modals, styles
- State Layer: React state, context, custom hooks, global stores
- Service / API Layer: Frontend API client, backend commands, Tauri IPC
- Data Layer: Types, schemas, entities, database tables
Step 2: Codebase Exploration & Dependency Tracing
- Search for relevant existing files using
workspace__grepFiles and workspace__globFiles.
- Inspect target files with
workspace__readFile to understand:
- Current responsibilities and size of components
- Existing data flow and state propagation
- Shared dependencies and props interface
- Map component dependencies to anticipate ripple effects when modifying signatures or state.
Step 3: Risk Assessment & Architecture Trade-offs
- Load and evaluate against references/risk_checklist.md:
- Type Safety: Prop changes, boundary validation, schema changes
- State Complexity: State duplication vs context extension vs hook extraction
- UI/UX Resilience: Virtualized lists, scroll pinning, loading/error states
- Backward Compatibility: Impact on other features using the same components
- Compare architectural choices (e.g., Option A: Direct Extension vs Option B: Modular Refactoring).
Step 4: Generate Proposal Report
- Use the structure provided in references/proposal_template.md.
- Document:
- Affected files and modification scope
- Recommended refactoring approach with trade-off justification
- Phased execution steps (Preparation/Refactor -> Feature Implementation -> Verification)
- Specific verification criteria (
pnpm refactor:validate, tests, manual checks)
References
- proposal_template.md: Standard template for feature refactoring proposals.
- risk_checklist.md: Architectural and quality risk review checklist.
1---2name: feature-refactor-proposal3description: Analyze codebase against new feature requirements, map affected modules and dependencies, identify architectural risks, and propose a structured refactoring and implementation plan before writing code. Use when starting a new feature, planning refactoring, analyzing codebase impact, or reviewing feature feasibility.4---56# Feature Refactor Proposal78This skill provides a structured methodology for analyzing an existing codebase against new feature requirements, identifying technical debt and risks, and producing a clear refactoring and implementation proposal before writing code.910## When to Use1112Use this skill when:1314- Adding a complex new feature to an existing codebase15- Extending existing components or state management that could cause architectural regression16- Assessing feature feasibility and breaking changes before implementation17- Preparing an architecture proposal or technical design review for a feature request1819## Workflow Decision Tree2021```22User provides New Feature Requirements / Issue23 │24 ├── 1. Parse Requirements & Define Boundaries25 │ └─ Identify UI, state, API, and backend scope26 │27 ├── 2. Map Codebase Impact28 │ └─ Locate affected components, hooks, services, types29 │30 ├── 3. Evaluate Risks & Trade-offs31 │ └─ Consult [risk_checklist.md](references/risk_checklist.md)32 │33 ├── 4. Draft Refactoring & Implementation Plan34 │ └─ Use [proposal_template.md](references/proposal_template.md)35 │36 └── 5. Present Proposal & Verification Steps37 └─ Provide phased steps and validation commands38```3940---4142## Detailed Steps4344### Step 1: Requirement Breakdown & Scope Mapping45461. Extract core requirements and non-goals from the user prompt or issue document.472. Categorize requirements by impact layer:48 - **UI Layer**: Pages, components, modals, styles49 - **State Layer**: React state, context, custom hooks, global stores50 - **Service / API Layer**: Frontend API client, backend commands, Tauri IPC51 - **Data Layer**: Types, schemas, entities, database tables5253### Step 2: Codebase Exploration & Dependency Tracing54551. Search for relevant existing files using `workspace__grepFiles` and `workspace__globFiles`.562. Inspect target files with `workspace__readFile` to understand:57 - Current responsibilities and size of components58 - Existing data flow and state propagation59 - Shared dependencies and props interface603. Map component dependencies to anticipate ripple effects when modifying signatures or state.6162### Step 3: Risk Assessment & Architecture Trade-offs63641. Load and evaluate against [references/risk_checklist.md](references/risk_checklist.md):65 - **Type Safety**: Prop changes, boundary validation, schema changes66 - **State Complexity**: State duplication vs context extension vs hook extraction67 - **UI/UX Resilience**: Virtualized lists, scroll pinning, loading/error states68 - **Backward Compatibility**: Impact on other features using the same components692. Compare architectural choices (e.g., Option A: Direct Extension vs Option B: Modular Refactoring).7071### Step 4: Generate Proposal Report72731. Use the structure provided in [references/proposal_template.md](references/proposal_template.md).742. Document:75 - Affected files and modification scope76 - Recommended refactoring approach with trade-off justification77 - Phased execution steps (Preparation/Refactor -> Feature Implementation -> Verification)78 - Specific verification criteria (`pnpm refactor:validate`, tests, manual checks)7980---8182## References8384- **[proposal_template.md](references/proposal_template.md)**: Standard template for feature refactoring proposals.85- **[risk_checklist.md](references/risk_checklist.md)**: Architectural and quality risk review checklist.