Skip to content

Commit 9f10182

Browse files
stephendolanclaude
andcommitted
refactor(claude): simplify refine-implementation to commit-spawn-review workflow
Replace the evaluate-then-refine two-phase process with a streamlined approach: commit baseline, spawn blind refiner, review changes via diff, then amend. This eliminates the evaluation step where implementers try to objectively assess their own code - an inherently biased activity. The new workflow enforces that refiners receive minimal context for fresh perspective, with the coordinator handling acceptance/rejection based on preserved constraints. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 63b18ab commit 9f10182

File tree

3 files changed

+29
-40
lines changed

3 files changed

+29
-40
lines changed

claude/CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ Plan-refiner has final authority on approach and can suggest radical simplificat
196196
### 2. Implementation
197197
198198
1. Implement according to approved plan
199-
2. At checkpoints (feature complete, bug fixed, before feedback, at milestones), launch `code-refiner` to remove over-engineering, eliminate comments via better naming, simplify logic, remove just-in-case code
200-
3. Proceed to commit only after code is refined
199+
2. At checkpoints, run `/refine-implementation` to spawn `code-refiner` for fresh review
200+
3. Proceed to commit only after refinement is complete
201201
202202
### 3. Committing
203203

claude/agents/committer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ You are a git commit specialist. Your job is to create high-quality commits with
3030

3131
4. **Stage and commit**:
3232
- Stage relevant files if not already staged
33-
- Create the commit
33+
- Create the commit (or amend if instructed)
3434
- Report success with the final message
3535

3636
## Message Format
Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,42 @@
1-
Evaluate implementation changes and decide whether refinement is warranted.
1+
Spawn `code-refiner` to review recent changes for simplification opportunities.
22

3-
## Two-Phase Process
3+
## Workflow
44

5-
1. **Evaluate**: Review the diff yourself and assess whether refinement would add value
6-
2. **Refine**: Spawn `code-refiner` only when evaluation reveals genuine issues
5+
1. **Commit current work** - Create a WIP baseline to compare against
6+
2. **Spawn code-refiner** - Launch with minimal context for fresh perspective
7+
3. **Review changes** - Accept or reject refiner's suggestions
8+
4. **Commit properly** - Amend the WIP with a real commit message via `committer`
79

8-
Small, focused changes rarely benefit from refinement. Evaluate first, then decide.
10+
## Step 1: Commit Baseline
911

10-
## Evaluation
12+
```bash
13+
git add -A && git commit -m "wip: checkpoint before refinement"
14+
```
1115

12-
Run `git diff` (or `git diff main...HEAD` for clean trees) and assess:
16+
Before spawning, note for yourself: What constraints matter? What complexity is intentional? Keep this ready for Step 3.
1317

14-
| Factor | Consider |
15-
|--------|----------|
16-
| Size | Under 30 lines? Likely skip. Over 50 lines? Likely refine. |
17-
| Complexity | Multiple abstraction layers for simple operations? |
18-
| Clarity | Would another developer understand this immediately? |
19-
| Idioms | Does it follow language conventions? |
18+
## Step 2: Spawn Refiner
2019

21-
### Skip Refinement
20+
Launch `code-refiner` with this prompt:
2221

23-
- Changes under 30 lines with straightforward logic
24-
- Code follows existing patterns in the codebase
25-
- Uses idiomatic language constructs
26-
- No multi-step conditionals that could be simplified
22+
> Review the recent changes and apply refinement principles. Look for over-engineering, unnecessary abstraction, and opportunities for simplification.
2723
28-
### Run Refinement
24+
## Step 3: Review and Resolve
2925

30-
- Changes over 50 lines
31-
- Multi-level nesting or indirection for simple operations
32-
- Comments explaining WHAT instead of self-documenting code
33-
- Language idiom violations (e.g., verbose loops instead of map/filter)
26+
Check what changed:
3427

35-
## Spawning Refiners
28+
```bash
29+
git diff HEAD~1
30+
```
3631

37-
When spawning `code-refiner`, include context so it preserves intentional decisions:
32+
Then choose:
3833

39-
- Problem being solved: What requirement drove this change?
40-
- Why this approach: What constraints led to this implementation?
41-
- What to preserve: Non-obvious decisions that should not be simplified away
34+
- **Accept**: Keep refiner's improvements
35+
- **Reject**: Revert to baseline (`git reset HEAD~1`) and provide constraints to refiner for second pass
36+
- **Partial**: Revert specific files (`git checkout HEAD~1 -- path/to/file`), keep others
4237

43-
## Output
38+
## Step 4: Commit
4439

45-
State your decision before taking action:
40+
Launch the `committer` agent to amend the WIP checkpoint into a proper commit. The message should describe what the code does, not how it was developed.
4641

47-
When skipping:
48-
> No refinement needed. [Rationale: e.g., "15-line change, idiomatic code, follows existing patterns."]
49-
50-
When refining:
51-
> Running refinement. [Rationale: e.g., "60 lines with nested conditionals that could be flattened."]
52-
53-
After refinement completes, summarize what changed.
42+
**Important**: Do not skip refinement because changes seem "too simple." You cannot objectively assess code you just wrote. Always spawn the refiner.

0 commit comments

Comments
 (0)