|
| 1 | +--- |
| 2 | +description: Collaboratively refine and plan a development issue through iterative exploration |
| 3 | +argument-hint: [issue-id] or leave blank to choose from available issues |
| 4 | +allowed-tools: Bash(tp:*), Read, Write, MultiEdit, Glob, Grep, WebFetch |
| 5 | +--- |
| 6 | + |
| 7 | +# Issue Refinement Process |
| 8 | + |
| 9 | +You are beginning an iterative refinement session for a development issue. This is a collaborative exploration where you'll work with the user to deeply understand requirements, explore options, and make implementation decisions together. |
| 10 | + |
| 11 | +## Phase 1: Context Gathering |
| 12 | + |
| 13 | +### Step 1.1: Identify the Issue |
| 14 | +$ARGUMENTS |
| 15 | + |
| 16 | +If an issue ID was provided (e.g., CLI-8), use: |
| 17 | +```bash |
| 18 | +tp show $1 |
| 19 | +``` |
| 20 | + |
| 21 | +If no issue specified, show available work: |
| 22 | +```bash |
| 23 | +tp c |
| 24 | +``` |
| 25 | + |
| 26 | +**Important:** Check the team context in the output. Use the correct team filter if needed (e.g., `teams: CLI`). |
| 27 | + |
| 28 | +### Step 1.2: Read Related Issues |
| 29 | +If there's a clear task hierarchy or related issues mentioned, read them to understand the broader context: |
| 30 | +- Look for dependencies mentioned in the ticket |
| 31 | +- Check for "blocked by" or "blocks" relationships |
| 32 | +- Review any parent epics or related work |
| 33 | + |
| 34 | +### Step 1.3: Explore Existing Code |
| 35 | +Based on the issue context, explore relevant code: |
| 36 | +- Use `Glob` to find related files |
| 37 | +- Use `Read` to understand current implementation |
| 38 | +- Look for patterns already established in the codebase |
| 39 | + |
| 40 | +## Phase 2: Initial Understanding |
| 41 | + |
| 42 | +### Step 2.1: Summarize Your Understanding |
| 43 | +Present to the user: |
| 44 | +1. **What you understand** the issue is asking for |
| 45 | +2. **What questions** you have about requirements |
| 46 | +3. **What context** you might be missing |
| 47 | + |
| 48 | +**Be honest about uncertainties.** Say things like: |
| 49 | +- "I'm not sure if this means X or Y..." |
| 50 | +- "Should we consider..." |
| 51 | +- "I notice the ticket mentions X but I don't see where that fits..." |
| 52 | + |
| 53 | +### Step 2.2: Wait for User Input |
| 54 | +**PAUSE HERE** - Let the user provide additional context, corrections, or guidance. |
| 55 | + |
| 56 | +## Phase 3: Iterative Exploration |
| 57 | + |
| 58 | +### Step 3.1: Present Options |
| 59 | +Based on user feedback, present different approaches: |
| 60 | + |
| 61 | +**Start simple and high-level:** |
| 62 | +``` |
| 63 | +"So we could approach this in a few ways: |
| 64 | +
|
| 65 | +Option A: [Simple approach] |
| 66 | +- Pros: Quick to implement, easy to understand |
| 67 | +- Cons: Limited flexibility |
| 68 | +
|
| 69 | +Option B: [More complex approach] |
| 70 | +- Pros: More powerful, extensible |
| 71 | +- Cons: Takes longer, more complexity |
| 72 | +
|
| 73 | +What resonates with you?" |
| 74 | +``` |
| 75 | + |
| 76 | +### Step 3.2: Drill Down Gradually |
| 77 | +As the user expresses preferences, go deeper: |
| 78 | +1. Start with conceptual choices |
| 79 | +2. Move to architectural decisions |
| 80 | +3. Then implementation details |
| 81 | +4. Finally, specific code patterns |
| 82 | + |
| 83 | +**Example progression:** |
| 84 | +- "Should this be interactive or command-based?" |
| 85 | +- "Would you prefer a class-based or functional approach?" |
| 86 | +- "Should we use Python's shlex for parsing or write our own?" |
| 87 | + |
| 88 | +### Step 3.3: Show Code Examples |
| 89 | +When discussing options, provide small, concrete examples: |
| 90 | +```python |
| 91 | +# "Here's what Option A might look like:" |
| 92 | +def simple_parse(input): |
| 93 | + return input.split() |
| 94 | + |
| 95 | +# "Versus Option B:" |
| 96 | +class Parser: |
| 97 | + def parse(self, input): |
| 98 | + # More sophisticated parsing |
| 99 | +``` |
| 100 | + |
| 101 | +## Phase 4: Convergence |
| 102 | + |
| 103 | +### Step 4.1: Confirm Understanding |
| 104 | +Once you've explored options together, summarize: |
| 105 | +- The approach you've agreed on |
| 106 | +- Key decisions made |
| 107 | +- Any remaining open questions |
| 108 | + |
| 109 | +### Step 4.2: Create Refinement Plan |
| 110 | +Write out a clear implementation plan with: |
| 111 | +1. **Phases** - Logical chunks of work |
| 112 | +2. **Components** - What needs to be built |
| 113 | +3. **Examples** - How it will be used |
| 114 | +4. **Acceptance Criteria** - How we'll know it's done |
| 115 | + |
| 116 | +## Phase 5: Documentation |
| 117 | + |
| 118 | +### Step 5.1: Create ADR if Needed |
| 119 | +If you made significant architectural decisions, create an ADR: |
| 120 | +```bash |
| 121 | +Write cli-patterns-docs/adrs/ADR-XXX-[decision-name].md |
| 122 | +``` |
| 123 | + |
| 124 | +Include: |
| 125 | +- Context of the decision |
| 126 | +- Options considered |
| 127 | +- Decision made and rationale |
| 128 | +- Consequences |
| 129 | + |
| 130 | +### Step 5.2: Update the Issue |
| 131 | +Add a comment to the issue (if using Linear/GitHub) summarizing: |
| 132 | +- Decisions made during refinement |
| 133 | +- Updated implementation plan |
| 134 | +- Any new acceptance criteria |
| 135 | +- Links to ADRs created |
| 136 | + |
| 137 | +### Step 5.3: Update Project Documentation |
| 138 | +If this refinement revealed important context: |
| 139 | +- Update CLAUDE.md if it affects how to work with the codebase |
| 140 | +- Add to relevant documentation |
| 141 | +- Create examples if helpful |
| 142 | + |
| 143 | +## Important Principles |
| 144 | + |
| 145 | +### Go Slow |
| 146 | +- Don't jump to implementation details |
| 147 | +- Start with understanding the problem |
| 148 | +- Build context gradually |
| 149 | + |
| 150 | +### Be Collaborative |
| 151 | +- Present options, don't prescribe solutions |
| 152 | +- Ask "What do you think?" frequently |
| 153 | +- Admit when you're unsure |
| 154 | + |
| 155 | +### Think About the System |
| 156 | +Remember: CLI Patterns is a system for building CLI systems. Consider: |
| 157 | +- How this feature enables different interaction paradigms |
| 158 | +- Whether components can be composable/reusable |
| 159 | +- How different users might combine features |
| 160 | + |
| 161 | +### Document Thinking |
| 162 | +- Capture not just what was decided, but why |
| 163 | +- Note alternatives considered |
| 164 | +- Record constraints and trade-offs |
| 165 | + |
| 166 | +## Example Session Flow |
| 167 | + |
| 168 | +``` |
| 169 | +1. "Let me look at CLI-8... [reads ticket]" |
| 170 | +2. "So this is about parsing commands. I see we currently have basic splitting. What kind of command styles do you envision supporting?" |
| 171 | +3. [User explains] |
| 172 | +4. "Interesting! So we need multiple paradigms. Let me show you some options..." |
| 173 | +5. [Explore together] |
| 174 | +6. "OK, so we're going with a composable parser system. Let me document this..." |
| 175 | +7. [Create ADR, update issue] |
| 176 | +``` |
| 177 | + |
| 178 | +## Completion Checklist |
| 179 | + |
| 180 | +Before ending the refinement session, ensure: |
| 181 | +- [ ] Issue requirements are clear |
| 182 | +- [ ] Implementation approach is agreed upon |
| 183 | +- [ ] Key decisions are documented in ADRs |
| 184 | +- [ ] Issue is updated with refinement outcomes |
| 185 | +- [ ] Any new context is added to project docs |
| 186 | +- [ ] Next steps are clear |
| 187 | + |
| 188 | +Remember: The goal is not just to refine the issue, but to build shared understanding through collaborative exploration. |
0 commit comments