Skip to content

Commit 2db6ee3

Browse files
marcusgollclaude
andcommitted
feat(ultrathink): embed philosophy checkpoints across workflow phases
Integrates ultrathink deep thinking philosophy as lightweight checkpoints throughout the development workflow, not just during explicit /ultrathink. Phase Checkpoints: - /spec: Think Different - Assumption inventory before requirements - /plan: Obsess + Simplify - Codebase soul analysis, 3 alternatives - /tasks: Simplify Ruthlessly - Task count validation, simplification review - /implement: Craft, Don't Code - Anti-duplication ritual, abstraction check Progressive Depth: - Trivial (<5 tasks): Skip checkpoints, fast path - Standard (5-30 tasks): Lightweight inline checkpoints - Complex (30+ tasks): Full checkpoints + separate artifacts - Epic (multi-sprint): Mandatory deep planning + craftsman-decision.md New files: - .spec-flow/config/ultrathink-integration.yaml Modified commands: - /spec: Added Step 0 assumption checkpoint - /plan: Added Step 0.75 codebase soul + alternatives checkpoint - /tasks: Added Step 2.6 simplification checkpoint - /implement: Added Step 1.4.5 anti-duplication ritual - /ultrathink: Added AskUserQuestion JSON, error handling for gh CLI Updated: - ultrathink skill with workflow_integration documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8590488 commit 2db6ee3

7 files changed

Lines changed: 689 additions & 12 deletions

File tree

.claude/commands/core/ultrathink.md

Lines changed: 94 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,17 @@ If there's a way to remove complexity without losing power, find it. Elegance is
3939

4040
<context>
4141
**Guiding Principles**: @CLAUDE.md
42-
**Project Architecture**: @docs/project/system-architecture.md
43-
**Tech Stack Decisions**: @docs/project/tech-stack.md
42+
**Deep Planning Skill**: @.claude/skills/ultrathink/SKILL.md
43+
44+
**Project docs (if they exist)**:
45+
- Architecture: `docs/project/system-architecture.md`
46+
- Tech Stack: `docs/project/tech-stack.md`
47+
48+
Check file existence before referencing:
49+
```bash
50+
test -f docs/project/system-architecture.md && echo "ARCH_EXISTS"
51+
test -f docs/project/tech-stack.md && echo "TECH_EXISTS"
52+
```
4453
</context>
4554

4655
<process>
@@ -131,7 +140,7 @@ If there's a way to remove complexity without losing power, find it. Elegance is
131140

132141
13. **Offer roadmap materialization**
133142

134-
If features were extracted, ask user:
143+
If features were extracted, display summary and ask user:
135144

136145
```
137146
Your analysis identified N actionable items:
@@ -145,19 +154,70 @@ If there's a way to remove complexity without losing power, find it. Elegance is
145154
Would you like to add these to the roadmap?
146155
```
147156

148-
Use AskUserQuestion with options:
149-
- **Add All** - Create GitHub Issues for all extracted features
150-
- **Select** - Choose which features to add
151-
- **Just Save** - Save thinking but don't create issues
152-
- **Skip** - Don't save or create issues
157+
Use AskUserQuestion:
158+
159+
```json
160+
{
161+
"question": "Would you like to add these to the roadmap?",
162+
"header": "Materialize",
163+
"multiSelect": false,
164+
"options": [
165+
{"label": "Add All (Recommended)", "description": "Create GitHub Issues for all extracted features"},
166+
{"label": "Select", "description": "Choose which features to add"},
167+
{"label": "Just Save", "description": "Save thinking to file but don't create issues"},
168+
{"label": "Skip", "description": "Don't save or create issues"}
169+
]
170+
}
171+
```
172+
173+
**If "Select" chosen**, show multi-select:
174+
175+
```json
176+
{
177+
"question": "Which features should be added to the roadmap?",
178+
"header": "Select",
179+
"multiSelect": true,
180+
"options": [
181+
{"label": "[Epic] Feature Name 1", "description": "[description]"},
182+
{"label": "[Feature] Feature Name 2", "description": "[description]"}
183+
]
184+
}
185+
```
153186

154187
14. **Create GitHub Issues (if materializing)**
155188

156-
For each selected feature:
189+
**Pre-flight checks**:
190+
191+
```bash
192+
# Verify gh CLI is authenticated
193+
if ! gh auth status &>/dev/null; then
194+
echo "ERROR: GitHub CLI not authenticated"
195+
echo "Run: gh auth login"
196+
echo ""
197+
echo "Saving thinking to file instead..."
198+
# Fall back to --save behavior
199+
fi
200+
201+
# Verify we're in a git repo with a remote
202+
if ! git remote get-url origin &>/dev/null; then
203+
echo "WARNING: No git remote found"
204+
echo "Issues will be created but may not link correctly"
205+
fi
206+
207+
# Check if required labels exist, create if missing
208+
gh label list | grep -q "status:backlog" || \
209+
gh label create "status:backlog" --color "FBCA04" --description "In backlog, not started"
210+
gh label list | grep -q "type:epic" || \
211+
gh label create "type:epic" --color "7057FF" --description "Large multi-sprint work"
212+
gh label list | grep -q "type:feature" || \
213+
gh label create "type:feature" --color "0E8A16" --description "Single feature implementation"
214+
```
215+
216+
**Create issues** for each selected feature:
157217

158218
```bash
159219
# Create issue with proper labels
160-
gh issue create \
220+
ISSUE_URL=$(gh issue create \
161221
--title "[type]: [name]" \
162222
--body "$(cat <<EOF
163223
## Origin
@@ -181,10 +241,20 @@ If there's a way to remove complexity without losing power, find it. Elegance is
181241
EOF
182242
)" \
183243
--label "status:backlog" \
184-
--label "type:[epic/feature]"
244+
--label "type:[epic/feature]" 2>&1)
245+
246+
# Check for errors
247+
if [[ $? -ne 0 ]]; then
248+
echo "ERROR creating issue: $ISSUE_URL"
249+
# Continue with remaining issues
250+
else
251+
echo "Created: $ISSUE_URL"
252+
# Extract issue number for tracking
253+
ISSUE_NUM=$(echo "$ISSUE_URL" | grep -oE '[0-9]+$')
254+
fi
185255
```
186256

187-
Display created issues:
257+
**Display summary**:
188258

189259
```
190260
✅ Created roadmap items from your thinking:
@@ -195,6 +265,18 @@ If there's a way to remove complexity without losing power, find it. Elegance is
195265

196266
Next: /feature #43 to start implementing
197267
```
268+
269+
**If any issues failed**, show partial success:
270+
271+
```
272+
⚠️ Partially completed:
273+
274+
#42 Epic: Notification Service
275+
❌ Feature: Push Notification API (label missing)
276+
#44 Feature: User Preferences
277+
278+
Fix issues manually or re-run: /roadmap from-ultrathink specs/ultrathink/[slug].yaml
279+
```
198280
</process>
199281
200282
<mindset>

.claude/commands/phases/implement.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,99 @@ Group tasks for parallel execution:
392392

393393
---
394394

395+
### Step 1.4.5: Ultrathink Checkpoint — Craft, Don't Code
396+
397+
> **Philosophy**: "Would a junior developer understand this in 5 minutes?"
398+
399+
Before executing each task batch, apply the anti-duplication ritual.
400+
401+
**Display thinking prompt** (once per batch):
402+
403+
```
404+
┌─────────────────────────────────────────────────────────────┐
405+
│ 💭 ULTRATHINK CHECKPOINT: Craft, Don't Code │
406+
├─────────────────────────────────────────────────────────────┤
407+
│ Before implementing, always ask: │
408+
│ │
409+
│ • Have I searched for similar patterns? (mgrep first!) │
410+
│ • Can I extend existing code instead of creating new? │
411+
│ • Does this abstraction earn its complexity? │
412+
│ • Would a junior dev understand this in 5 minutes? │
413+
└─────────────────────────────────────────────────────────────┘
414+
```
415+
416+
**Pre-Coding Ritual** (execute before EACH new file creation):
417+
418+
```bash
419+
# Step 1: Anti-duplication search
420+
echo "=== Anti-Duplication Check ==="
421+
422+
# Use mgrep for semantic search (finds similar by meaning)
423+
TASK_DESCRIPTION="[task description from tasks.md]"
424+
mgrep "$TASK_DESCRIPTION"
425+
426+
# If mgrep unavailable, fallback to Grep
427+
Grep "similar pattern keywords" --type ts
428+
```
429+
430+
**Decision tree after search:**
431+
432+
```
433+
Search Results:
434+
435+
├─ Found similar code
436+
│ └─ Q: "Can we extend this instead of creating new?"
437+
│ ├─ Yes → Extend existing file (preferred)
438+
│ └─ No → Document why in NOTES.md, then create new
439+
440+
└─ No similar code found
441+
└─ Proceed with new implementation
442+
└─ Follow existing codebase patterns (from plan.md)
443+
```
444+
445+
**Abstraction check** (for new files):
446+
447+
```markdown
448+
## Abstraction Justification
449+
450+
| New File | Justification | Alternatives Considered |
451+
|----------|---------------|------------------------|
452+
| [path] | [why this earns its complexity] | [what was ruled out] |
453+
```
454+
455+
**Quality questions per task:**
456+
457+
Before writing code, answer mentally:
458+
1. **Reuse**: Did I search for existing patterns?
459+
2. **Simplicity**: Is this the simplest approach that works?
460+
3. **Clarity**: Would someone understand this without comments?
461+
4. **Testability**: Can this be tested in isolation?
462+
463+
**If creating an abstraction** (interface, base class, utility):
464+
465+
```json
466+
{
467+
"question": "You're about to create a new abstraction. Does it earn its complexity?",
468+
"header": "Abstraction",
469+
"multiSelect": false,
470+
"options": [
471+
{"label": "Yes, multiple consumers", "description": "This will be used by 2+ implementations"},
472+
{"label": "Yes, complex logic", "description": "Encapsulates genuinely complex behavior"},
473+
{"label": "No, premature", "description": "I should inline this for now"},
474+
{"label": "Skip check", "description": "I've already considered this"}
475+
]
476+
}
477+
```
478+
479+
**Red flags to catch:**
480+
481+
- Creating interface with only 1 implementation
482+
- Adding "for future use" code
483+
- Generic utility for a single use case
484+
- Inheritance hierarchy deeper than 2 levels
485+
486+
---
487+
395488
### Step 1.5: EXECUTE TASK BATCHES (MANDATORY)
396489

397490
**For each batch group, execute tasks using specialist agents.**

.claude/commands/phases/plan.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,123 @@ This ensures architecture decisions are grounded in existing codebase patterns a
276276

277277
---
278278

279+
### Step 0.75: Ultrathink Checkpoint — Obsess Over Details + Simplify Ruthlessly
280+
281+
> **Philosophy**: "What's the simplest architecture that could possibly work?"
282+
283+
Before designing architecture, understand the codebase soul and explore alternatives.
284+
285+
**Display thinking prompt** (for standard+ complexity):
286+
287+
```
288+
┌─────────────────────────────────────────────────────────────┐
289+
│ 💭 ULTRATHINK CHECKPOINT: Obsess + Simplify │
290+
├─────────────────────────────────────────────────────────────┤
291+
│ Before architecting, consider: │
292+
│ │
293+
│ • What patterns dominate this codebase? │
294+
│ • What existing code can we reuse? │
295+
│ • What's the SIMPLEST architecture that works? │
296+
│ • Does each new component earn its complexity? │
297+
└─────────────────────────────────────────────────────────────┘
298+
```
299+
300+
**Codebase Soul Analysis** (required for complex/epic, recommended for standard):
301+
302+
```bash
303+
# Quick soul analysis - find dominant patterns
304+
echo "=== Codebase Soul Analysis ==="
305+
306+
# Backend patterns
307+
SERVICE_COUNT=$(find . -name "*[Ss]ervice*" -type f 2>/dev/null | wc -l)
308+
REPO_COUNT=$(find . -name "*[Rr]epository*" -type f 2>/dev/null | wc -l)
309+
CONTROLLER_COUNT=$(find . -name "*[Cc]ontroller*" -type f 2>/dev/null | wc -l)
310+
311+
echo "Services: $SERVICE_COUNT | Repositories: $REPO_COUNT | Controllers: $CONTROLLER_COUNT"
312+
313+
# Frontend patterns
314+
COMPONENT_COUNT=$(find . -name "*.tsx" -path "*/components/*" 2>/dev/null | wc -l)
315+
HOOK_COUNT=$(grep -r "^export.*function use" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l)
316+
317+
echo "Components: $COMPONENT_COUNT | Hooks: $HOOK_COUNT"
318+
319+
# Determine dominant pattern
320+
if [ "$SERVICE_COUNT" -gt 5 ]; then
321+
echo "Dominant: Service Layer Pattern"
322+
fi
323+
```
324+
325+
**Document in plan.md** (inline section):
326+
327+
```markdown
328+
## Codebase Soul Summary
329+
330+
**Dominant Patterns**: [Service Layer / Repository / MVC / Hooks-based]
331+
**Philosophy**: [Thin controllers | Fat services | Composition-first]
332+
**Conventions**: [Naming, file structure, error handling observed]
333+
334+
**Reuse Opportunities**:
335+
- [Existing service/component that can be extended]
336+
- [Existing pattern to follow]
337+
338+
**Anti-Patterns to Avoid**:
339+
- [File/pattern observed that shouldn't be repeated]
340+
```
341+
342+
**Generate 3 Alternatives** (required for complex/epic):
343+
344+
```markdown
345+
## Architecture Alternatives
346+
347+
### Approach A: [Name] (Initial Thought)
348+
- New components: [list]
349+
- Pros: [list]
350+
- Cons: [list]
351+
352+
### Approach B: [Name] (Simplified)
353+
- New components: [list]
354+
- Pros: [list]
355+
- Cons: [list]
356+
357+
### Approach C: [Name] (Alternative)
358+
- New components: [list]
359+
- Pros: [list]
360+
- Cons: [list]
361+
362+
### Selected: Approach [X]
363+
**Reasoning**: [Why this is the simplest approach that works]
364+
```
365+
366+
**Complexity Budget** (required for complex/epic):
367+
368+
```markdown
369+
## Complexity Budget
370+
371+
| Component | Complexity | Justification |
372+
|-----------|------------|---------------|
373+
| [NewService] | Medium | Core logic requires dedicated service |
374+
| [NewComponent] | Low | Composition of existing primitives |
375+
| [NewAbstraction] | REJECTED | Premature - can refactor later if needed |
376+
377+
**Simplification Applied**:
378+
- Before: [X] new components, [Y] new services
379+
- After: [A] new components, [B] new services
380+
- Removed: [What was eliminated and why]
381+
```
382+
383+
**When to generate craftsman-decision.md** (full artifact):
384+
385+
```bash
386+
# Check if deep mode or complex feature
387+
if [ "$PLANNING_MODE" = "deep" ] || [ "$TASK_ESTIMATE" -ge 30 ]; then
388+
# Generate separate craftsman-decision.md
389+
CRAFTSMAN_FILE="${BASE_DIR}/${SLUG}/craftsman-decision.md"
390+
echo "Generating: $CRAFTSMAN_FILE"
391+
fi
392+
```
393+
394+
---
395+
279396
### Step 0.5: MIGRATION DETECTION (v10.5)
280397

281398
**Detect if this feature requires database schema changes:**

0 commit comments

Comments
 (0)