--- name: patch-design description: Create minimal, surgical patch plans for targeted fixes. Use when fixing specific issues from review, creating focused patches, or avoiding scope creep in fix implementations. allowed-tools: Read, Grep --- # Patch Design Skill Create minimal, surgical patch plans for targeted fixes. ## When to Use - Fixing specific issues from review - Creating focused bug fixes - Addressing blockers without scope creep - Making targeted improvements ## Core Principle > "This is a PATCH - keep the scope minimal. Only fix what's described in the issue and nothing more." ## Design Workflow ### Step 1: Understand the Specific Issue Parse the issue clearly: - **What is broken?** (specific behavior) - **How should it work?** (expected behavior) - **What evidence exists?** (screenshots, errors) Do NOT expand scope beyond the reported issue. ### Step 2: Analyze Current State Review the relevant code: ```bash # Find relevant files git diff --stat grep -r "related_function" src/ # Read the specific code cat src/component/file.ts ``` ### Step 3: Determine Minimum Fix Ask: "What is the smallest change that fixes this?" | Approach | Lines | Risk | | --- | --- | --- | | Surgical fix | 1-10 | Low | | Targeted fix | 10-50 | Medium | | Refactor | 50+ | High | **Always prefer surgical fixes** for patches. ### Step 4: Create Patch Plan Document the precise fix: ```markdown # Patch: [Concise title] ## Issue Summary **Problem**: [What's broken] **Solution**: [Minimal fix] ## Files to Modify - `path/to/file.ts`: [Specific change] ## Implementation Steps ### Step 1: [Specific action] [Exact code change] ### Step 2: [Specific action] [Exact code change] ## Validation - [Command to verify fix] - [How to confirm success] ## Patch Scope - Lines of code: ~X - Risk level: low - Testing: [minimal/standard] ``` ### Step 5: Define Validation Every patch needs verification: ```markdown ## Validation 1. Run specific test: `npm test path/to/test` 2. Manual verification: [steps] 3. Visual check: [if applicable] ``` ## Patch Plan Template ```markdown # Patch: [Brief description] ## Metadata - Issue: [Source of this patch request] - Severity: [blocker/tech_debt] ## Issue Summary **Original Spec**: [Link if available] **Problem**: [Brief description of what's wrong] **Solution**: [Brief description of the fix] ## Files to Modify [Only files that need changes - be specific] - `src/component/Button.tsx`: Fix disabled state ## Implementation Steps IMPORTANT: Execute every step in order. ### Step 1: [Specific change] ```jsx // Before