Skip to content

Commit 9cc8853

Browse files
AlexVOiceoverclaude
andcommitted
feat: enhance plan.md command with numbered tasks and implementation status check
- Add implementation status check stage to avoid duplicate work - Structure tasks with numbered main tasks and subtasks for better organization - Update plan-iterator.sh to handle new numbered task format - Improve task referencing and progress tracking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 05effcc commit 9cc8853

File tree

2 files changed

+44
-20
lines changed

2 files changed

+44
-20
lines changed

.claude/commands/plan.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,29 @@ Create a new plan from a Jira task: fetch details, transition to In Progress, cr
1111
- If it fails or times out, tell the user: "Jira connection failed. Please run `/mcp`, select `atlassian`, and choose `4. Reconnect`, then run `/plan $ARGUMENTS` again."
1212
- Extract: summary, description, issue type
1313

14-
2. **Transition to In Progress**:
14+
2. **Check implementation status**:
15+
- Analyze the codebase to determine if this feature/fix has already been implemented
16+
- Search for relevant files, functions, components that relate to the ticket
17+
- If fully implemented: comment on Jira and suggest moving to "Done"
18+
- If partially implemented: note what's done and focus plan on remaining work
19+
- If not implemented: proceed with full planning
20+
21+
3. **Transition to In Progress**:
1522
- Use `mcp__atlassian__getTransitionsForJiraIssue` to get available transitions
1623
- Use `mcp__atlassian__transitionJiraIssue` to move to "In Progress" (skip if already in progress)
1724

18-
3. **Create the feature branch**:
25+
4. **Create the feature branch**:
1926
- Generate branch name: `feature/{ticket-id-lowercase}-{slugified-summary}`
2027
- Example: `AP-23 Add Bulk Event Creation``feature/ap-23-add-bulk-event-creation`
2128
- Run: `git checkout main && git pull && git checkout -b {branch-name}`
2229

23-
4. **Write the plan**:
30+
5. **Write the plan**:
2431
- Create/overwrite `docs/plan.md`
25-
- Break down the Jira task into small, actionable checkbox tasks
32+
- Break down the Jira task into numbered, actionable checkbox tasks
33+
- Structure as main tasks with subtasks for better control
2634
- Each task should be one focused change
2735

28-
5. **Activate the loop**:
36+
6. **Activate the loop**:
2937
- Create the marker file: `touch .claude/loop`
3038
- This tells the plan-iterator hook to auto-continue through tasks
3139

@@ -38,10 +46,19 @@ Create a new plan from a Jira task: fetch details, transition to In Progress, cr
3846
3947
## Tasks
4048

41-
- [ ] First small task
42-
- [ ] Second small task
43-
- [ ] Add tests for X
44-
- [ ] Handle edge case Y
49+
1. [ ] **Setup and Infrastructure**
50+
- [ ] 1.1 First preparatory step
51+
- [ ] 1.2 Second preparatory step
52+
53+
2. [ ] **Core Implementation**
54+
- [ ] 2.1 Main feature component
55+
- [ ] 2.2 Supporting functionality
56+
- [ ] 2.3 Integration points
57+
58+
3. [ ] **Testing and Validation**
59+
- [ ] 3.1 Add unit tests for X
60+
- [ ] 3.2 Add integration tests for Y
61+
- [ ] 3.3 Handle edge case Z
4562

4663
## Notes
4764

@@ -51,6 +68,7 @@ Create a new plan from a Jira task: fetch details, transition to In Progress, cr
5168
## Rules
5269

5370
- **Checkbox format**: Must use `- [ ]` exactly (the plan-iterator hook reads this)
71+
- **Numbered structure**: Use numbered main tasks (1, 2, 3) with numbered subtasks (1.1, 1.2, etc)
5472
- **Small tasks**: Each task = one focused change, completable in one session
5573
- **Logical order**: Order by dependency
5674
- **Include tests**: Add test tasks where appropriate
@@ -71,13 +89,19 @@ Output `docs/plan.md`:
7189
7290
## Tasks
7391

74-
- [ ] Add avatar field to user schema
75-
- [ ] Create file upload API endpoint
76-
- [ ] Add image validation (size, format)
77-
- [ ] Store avatars in cloud storage
78-
- [ ] Display avatar in profile page
79-
- [ ] Add fallback for users without avatar
80-
- [ ] Write tests for upload endpoint
92+
1. [ ] **Database and API Setup**
93+
- [ ] 1.1 Add avatar field to user schema
94+
- [ ] 1.2 Create file upload API endpoint
95+
- [ ] 1.3 Add image validation (size, format)
96+
97+
2. [ ] **Storage and Display**
98+
- [ ] 2.1 Store avatars in cloud storage
99+
- [ ] 2.2 Display avatar in profile page
100+
- [ ] 2.3 Add fallback for users without avatar
101+
102+
3. [ ] **Testing and Validation**
103+
- [ ] 3.1 Write tests for upload endpoint
104+
- [ ] 3.2 Test image validation edge cases
81105

82106
## Notes
83107

.claude/hooks/plan-iterator.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [[ ! -f "$PLAN_FILE" ]]; then
2323
fi
2424

2525
# Count remaining tasks (unchecked boxes)
26-
REMAINING=$(grep -c '^\s*- \[ \]' "$PLAN_FILE" 2>/dev/null | head -1 || echo "0")
26+
REMAINING=$(grep -c '^\s*\([0-9]\+\.\s*\)\?\s*- \[ \]' "$PLAN_FILE" 2>/dev/null | head -1 || echo "0")
2727
REMAINING=${REMAINING:-0}
2828

2929
# All tasks complete - cleanup and exit
@@ -33,7 +33,7 @@ if [[ "$REMAINING" -eq 0 ]]; then
3333
fi
3434

3535
# Count completed tasks
36-
COMPLETED=$(grep -c '^\s*- \[x\]' "$PLAN_FILE" 2>/dev/null | head -1 || echo "0")
36+
COMPLETED=$(grep -c '^\s*\([0-9]\+\.\s*\)\?\s*- \[x\]' "$PLAN_FILE" 2>/dev/null | head -1 || echo "0")
3737
COMPLETED=${COMPLETED:-0}
3838

3939
# Stage all changes FIRST
@@ -42,13 +42,13 @@ git add -A >/dev/null 2>&1 || true
4242
# Then commit if there are staged changes
4343
if ! git diff --cached --quiet 2>/dev/null; then
4444
if [[ "$COMPLETED" -gt 0 ]]; then
45-
LAST_DONE=$(grep -E '^\s*- \[x\]' "$PLAN_FILE" | tail -1 | sed 's/.*\[x\] //')
45+
LAST_DONE=$(grep -E '^\s*\([0-9]\+\.\s*\)?\s*- \[x\]' "$PLAN_FILE" | tail -1 | sed 's/.*\[x\] //')
4646
git commit -m "feat: $LAST_DONE" >/dev/null 2>&1 || true
4747
fi
4848
fi
4949

5050
# Find next task
51-
NEXT_TASK=$(grep -m1 '^\s*- \[ \]' "$PLAN_FILE" | sed 's/.*\[ \] //' | sed 's/"/\\"/g')
51+
NEXT_TASK=$(grep -m1 '^\s*\([0-9]\+\.\s*\)\?\s*- \[ \]' "$PLAN_FILE" | sed 's/.*\[ \] //' | sed 's/"/\\"/g')
5252

5353
# Build the reason message for Claude
5454
read -r -d '' REASON << MSGEOF

0 commit comments

Comments
 (0)