wiggum
π―Skillfrom zbruhnke/claude-code-starter
wiggum skill from zbruhnke/claude-code-starter
Installation
npx skills add https://github.com/zbruhnke/claude-code-starter --skill wiggumSkill Details
Start an autonomous implementation loop from a spec or PRD. Enters plan mode for user approval, enforces command gates (test/lint/typecheck/build), validates dependencies, commits incrementally, and maintains documentation and changelog. Production-ready quality gates.
Overview
# Wiggum Loop - Autonomous Implementation
You are initiating a Wiggum Loop - an autonomous implementation cycle (inspired by the Ralph Wiggum technique) that plans first, then iterates until the spec is fully complete with all quality gates passed.
Your motto: "Iteration beats perfection. Keep going until it's truly done."
Core Philosophy
- Plan before implementing: Enter plan mode first, get user approval before writing code.
- Iterate until complete: Each cycle builds on the previous. Read your own git commits, see what changed, fix what's broken.
- Quality over speed: Better to take 10 iterations and ship solid code than 2 iterations of broken code.
- No stubs, ever: If you write
// TODOor stub out a function, you're not done. Implement it fully. - Document as you go: Documentation and changelog entries are part of the work, not afterthoughts.
- Commit incrementally: Each completed chunk gets its own atomic commit with a meaningful message.
- Trace every path: Follow every code path to ensure completeness. Don't assume - verify.
Input Handling
You MUST receive a clear specification. If not provided:
- Ask: "What would you like me to build? Please provide a spec, PRD, or detailed requirements."
- Clarify: "I need clear success criteria to know when I'm done."
Never start without understanding what 'done' looks like.
Quick Start
Step 0: Enforcement Is Automatic
When /wiggum is invoked, a Claude Code hook automatically creates .wiggum-session:
- This happens mechanically via
.claude/hooks/wiggum-session-start.sh - Claude cannot skip this - Claude Code runs the hook before the skill executes
- No manual step required
Install the pre-commit hook (one-time setup):
```bash
cp .claude/hooks/wiggum-precommit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
```
The .wiggum-session file activates mechanical enforcement:
- Git will block commits if CHANGELOG is empty
- Git will block commits if tests fail
- Git will block commits if lint fails
- Only active during wiggum sessions (file exists)
- Remove file at end to deactivate
Record the starting commit for validation later:
```bash
git rev-parse HEAD
```
Save this hash for wiggum-validate.sh --since at the end.
Step 1: Get the Spec
If the user provided a spec/PRD, proceed to planning. If not:
```
I'll start a Wiggum Loop for autonomous implementation.
Please provide:
- Spec/PRD: What should I build? (paste or describe)
- Success criteria: How will we know it's done?
- Constraints: Any limits on scope or approach?
```
Step 2: Enter Plan Mode
Before writing any code, enter plan mode:
- Use the EnterPlanMode tool
- Explore the codebase
- Design the implementation approach
- Present the plan via ExitPlanMode
- Wait for user approval
The Wiggum Loop Process
```
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β /wiggum "
β β
β 0. PLAN β Enter plan mode, get user approval β
β 1. PARSE β Extract requirements from spec β
β 2. CHUNK β Break into implementable pieces β
β 3. BUILD β Implement iteratively β
β 4. DECIDE β Document ADRs for significant choices β
β 5. TEST β test-writer ensures coverage β
β 6. REVIEW β code-reviewer checks quality β
β 7. SIMPLIFY β code-simplifier refines clarity β
β 8. DOCUMENT β documentation-writer updates docs β
β 9. COMMIT β Atomic commit for the chunk β
β 10. REPEAT β Loop until ALL gates pass β
β 11. CHANGELOG β Update CHANGELOG.md β
β 12. VERIFY β Final verification pass β
β 13. VALIDATE β Run wiggum-validate.sh (MANDATORY) β
β 14. COMPLETE β Only when validation passes β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
Mandatory Validation (ENFORCED)
Before you can say "COMPLETE", you MUST run the validation script:
```bash
.claude/scripts/wiggum-validate.sh
```
This script checks reality:
- β Git commits were actually made
- β CHANGELOG.md has [Unreleased] entries
- β TEST command passes
- β LINT command passes
- β BUILD command passes
The script output must be included in your completion report.
If the script shows VALIDATION FAILED:
- You are NOT done
- Fix the failures
- Run the script again
- Repeat until
VALIDATION PASSED
You cannot claim COMPLETE without showing the validation script output.
This is not optional. This is not a suggestion. This is enforcement.
Stop Conditions (Prevent Runaway)
These limits prevent infinite loops and wasted effort:
| Condition | Limit | Action |
|-----------|-------|--------|
| Failed attempts on same gate | 3 | STOP. Summarize failures, propose fix plan, ask user |
| Iterations per chunk | 5 | STOP. Re-plan the chunk, it's too big or unclear |
Complex specs with many chunks will naturally have many total iterations - that's fine. The per-chunk and per-gate limits catch actual problems.
When you hit a stop condition:
```markdown
Loop Stopped - [Reason]
What Failed
[Gate/check that kept failing]
Attempts Made
- [What you tried]
- [What you tried]
- [What you tried]
Likely Root Causes
- [Cause 1]
- [Cause 2]
Proposed Fix Plan
[How to resolve this]
Waiting for user guidance before continuing.
```
Phase 0: Plan First (Command Discovery)
This is mandatory. Before writing any code:
- Enter plan mode using the EnterPlanMode tool
- Explore the codebase to understand existing patterns
- Parse CLAUDE.md for commands - look for TEST, LINT, TYPECHECK, BUILD, FORMAT
- STOP if commands missing - you cannot proceed without knowing how to verify
- Identify likely dependencies - flag any new packages for review
- Discuss smoke testing - needed for runtime behavior changes?
- Design the approach based on the spec
- Keep chunks small - target 200-300 LOC per chunk, 5 files max
- Present the plan to the user via ExitPlanMode
- Wait for approval before proceeding
Command Discovery (Required)
Parse CLAUDE.md and extract commands. If ANY are missing, ask once:
```markdown
Commands Discovered
| Gate | Command | Status |
|------|---------|--------|
| TEST | npm test | β Found |
| LINT | npm run lint | β Found |
| TYPECHECK | tsc --noEmit | β Found |
| BUILD | npm run build | β Found |
| FORMAT | prettier --write | β Found |
Ready to proceed.
```
If commands are missing:
```
I found these commands in CLAUDE.md:
- TEST: npm test
- LINT: (not found)
- BUILD: (not found)
I cannot proceed without knowing how to verify the code.
Please provide the missing commands, or confirm N/A if not applicable.
```
Never skip this. Never guess commands.
```markdown
Wiggum Loop - Planning
Spec Summary
[Key requirements extracted]
Implementation Approach
[How you'll build it]
Chunks
- [Chunk 1] - [what it does]
- [Chunk 2] - [what it does]
Potential Decisions (ADRs)
[Choices that may need documenting]
Entering plan mode for user approval...
```
Phase 1: Parse the Spec
Extract and confirm:
```markdown
Requirements Extracted
Must Have (Blocking)
- [ ] Requirement 1
- [ ] Requirement 2
Should Have (Important)
- [ ] Requirement 3
Nice to Have (Optional)
- [ ] Requirement 4
Success Criteria
- [ ] Criterion 1
- [ ] Criterion 2
Out of Scope
- Item explicitly not included
```
Confirm with user before proceeding.
Phase 2: Plan the Implementation
Break down into chunks:
```markdown
Implementation Plan
Chunk 1: [Name]
- Files to create/modify
- Dependencies on other chunks
- Potential ADRs needed
Chunk 2: [Name]
...
```
Phase 3: Build (The Loop)
For each chunk, iterate:
```
WHILE chunk not complete:
1. IMPLEMENT
- Write the code
- Follow project conventions (CLAUDE.md)
2. CHECK CHUNK SIZE
- If growing large (300+ lines, 5+ files): STOP
- Split into smaller chunks if needed
- Re-plan if scope expanded
3. IF STUCK (2+ failed attempts):
- Use Task tool β researcher agent
- "Help me find how to [specific problem]"
4. IF ADDING DEPENDENCY β HARD STOP:
- You MUST complete the dependency gate before proceeding
- Present to user for approval
- Do NOT continue until approved or alternative found
```markdown
## Dependency Gate: [package-name]
| Check | Status | Notes |
|-------|--------|-------|
| Why needed? | [answer] | [what problem it solves] |
| Alternatives? | [answer] | [why not X, Y, Z] |
| License | [MIT/Apache/etc] | [compatible: yes/no] |
| Maintained? | [yes/no] | [last commit, open issues] |
| Security | [clean/issues] | [CVEs, advisories] |
| Version pinned? | [yes/no] | [exact or range] |
| Blast radius | [runtime/build/dev] | [who is affected] |
Recommendation: [APPROVE / REJECT / NEEDS DISCUSSION]
```
If any check fails β find alternative or get explicit user approval
5. IF SIGNIFICANT DECISION:
- Use Task tool β adr-writer agent
- Document the decision and alternatives
6. WRITE TESTS
- Use Task tool β test-writer agent
- "Write comprehensive tests for [code]"
7. RUN COMMAND GATES
- TEST: Run test command - must pass
- LINT: Run lint command - must pass
- TYPECHECK: Run typecheck (if applicable) - must pass
8. CODE REVIEW
- Use Task tool β code-reviewer agent
- "Review [code] for quality AND security checklist"
- Fix ALL blockers before continuing
9. SIMPLIFY
- Use Task tool β code-simplifier agent
- "Simplify [code] for clarity"
- Apply improvements
10. DOCUMENT
- Use Task tool β documentation-writer agent
- "Document [feature] - update relevant docs"
- Focus on public APIs and non-obvious behavior
11. COMMIT
- git add [chunk files]
- git commit -m "
- Atomic commit with meaningful message
12. VERIFY CHUNK
- All command gates pass?
- No blockers from review?
- Code is simplified?
- Docs are updated?
β If NO to any: loop back to step 1
β If YES to all: mark chunk complete
```
Invoking Specialized Agents
Use the Task tool to invoke agents:
```javascript
// When planning (REQUIRED first step)
EnterPlanMode()
// When stuck researching
Task(researcher, "I'm implementing [X] and need to find [Y]")
// When making significant decisions
Task(adr-writer, "Document decision to use [X] for [problem].
Context: [why needed]. Alternatives: [options]. Consequences: [tradeoffs]")
// For test coverage
Task(test-writer, "Write comprehensive tests for [files]")
// For code review
Task(code-reviewer, "Review [files] for quality and security")
// For simplification
Task(code-simplifier, "Simplify [files] for clarity")
// For documentation
Task(documentation-writer, "Document [feature] - update inline docs, README if needed")
// For changelog (use skill)
Skill(changelog-writer, "Add entries for: [list of changes]")
```
Incremental Git Commits
After each chunk passes quality gates:
```bash
# Stage chunk files
git add src/feature.ts src/feature.test.ts
# Commit with descriptive message
git commit -m "feat(feature): add user authentication
- Add login/logout functionality
- Create session management
- Add password reset endpoint
Co-Authored-By: Claude
```
Commit types:
feat: New featurefix: Bug fixdocs: Documentationrefactor: Code refactoringtest: Adding testschore: Maintenance
Phase 4: Update Changelog
Before final verification, update CHANGELOG.md:
```markdown
[Unreleased]
Added
- User authentication with login/logout
- Password reset via email
- Session management
Changed
- Updated API error responses for consistency
```
Phase 5: Final Verification
Before declaring complete, run ALL quality gates one final time:
```markdown
Final Verification Checklist
Plan
- [ ] User approved the implementation plan
- [ ] No significant deviations (or re-approved)
Spec Completeness
- [ ] Every Must Have requirement implemented
- [ ] Every Should Have requirement implemented
- [ ] All success criteria met
Code Completeness
- [ ] NO
// TODOcomments remain - [ ] NO stub functions
- [ ] NO placeholder implementations
- [ ] Every code path traced and verified
Command Gates (ALL must pass with proof)
Run each command and record the output:
| Gate | Command | Result | Output |
|------|---------|--------|--------|
| TEST | [from CLAUDE.md] | β
/β | [actual output] |
| LINT | [from CLAUDE.md] | β
/β | [actual output] |
| TYPECHECK | [from CLAUDE.md] | β
/β or N/A | [actual output] |
| BUILD | [from CLAUDE.md] | β
/β | [actual output] |
| FORMAT | [from CLAUDE.md] | β
/β or N/A | [actual output] |
Any β = not done. Fix and re-run.
Dependency Hygiene
- [ ] All new dependencies have completed checklist
- [ ] Licenses verified compatible
- [ ] Lockfile updated
Test Coverage (test-writer agent)
- [ ] Comprehensive tests written
- [ ] All tests passing
- [ ] Edge cases covered
- [ ] Error conditions tested
Code Quality (code-reviewer agent)
- [ ] No BLOCKERS
- [ ] All WARNINGS addressed
- [ ] Security checklist completed
- [ ] Best practices followed
Code Clarity (code-simplifier agent)
- [ ] Code simplified where possible
- [ ] Follows project conventions
- [ ] Readable and maintainable
Documentation (documentation-writer agent)
- [ ] Public APIs documented
- [ ] README updated if needed
- [ ] Configuration documented
- [ ] Non-obvious behavior explained
Production Hygiene
- [ ] No debug prints (console.log, print, etc.)
- [ ] Structured logging in place
- [ ] Breaking changes documented with migration path
- [ ] Smoke test passes (if defined)
Changelog
- [ ] All changes documented
- [ ] Correct categories used
- [ ] User-focused descriptions
Git History
- [ ] All changes committed
- [ ] Commits are atomic
- [ ] Messages are meaningful
ADRs (if applicable)
- [ ] Significant decisions documented
- [ ] Context and consequences explained
Agent Review (Supplementary - after gates pass)
Agents provide qualitative review AFTER mechanical gates pass:
| Agent | Question | Answer |
|-------|----------|--------|
| test-writer | Edge cases covered? | [yes/no + details] |
| code-reviewer | Security checklist complete? | [yes/no + details] |
| code-simplifier | Unnecessary complexity? | [yes/no + details] |
Agent review cannot substitute for mechanical gates.
If gates fail, fix them first. Then get agent review.
```
Anti-Patterns (NEVER DO THESE)
```
β NEVER skip plan mode
Start implementing without approval β NOT ALLOWED
β NEVER leave TODOs
// TODO: implement later β NOT ALLOWED
β NEVER stub functions
function fetch() { return null; } β NOT ALLOWED
β NEVER skip quality gates
"Tests can wait" β NOT ALLOWED
"Docs aren't needed" β NOT ALLOWED
β NEVER skip command gates
"Tests are slow, I'll run them later" β NOT ALLOWED
"Lint errors are just warnings" β NOT ALLOWED
"It compiles, that's good enough" β NOT ALLOWED
β NEVER add dependencies carelessly
Adding packages without checking license β NOT ALLOWED
Using unmaintained packages β NOT ALLOWED
Not pinning versions β NOT ALLOWED
β NEVER let chunks explode
500+ lines in one chunk β NOT ALLOWED
"I'll just add one more thing..." β NOT ALLOWED
Mixing refactoring with features β NOT ALLOWED
β NEVER stop early
"Good enough" β NOT ALLOWED
β NEVER ignore agent feedback
"That warning isn't important" β FIX IT
β NEVER make giant commits
One commit with everything β NOT ALLOWED
"WIP" commits β NOT ALLOWED
β NEVER claim completion without mechanical proof
"agent approved" without running commands β NOT ALLOWED
Missing Command Gates table β NOT ALLOWED
Skipping BUILD because "it probably works" β NOT ALLOWED
β NEVER ignore stop conditions
Iteration 6 on same chunk β STOP AND RE-PLAN
Same gate failing 4th time β STOP AND ASK USER
"Just one more try" β NO, STOP AND ASK
β NEVER skip the validation script
Claiming complete without running wiggum-validate.sh β NOT ALLOWED
"The validation script isn't necessary" β YES IT IS, RUN IT
Saying COMPLETE when validation shows FAILED β ABSOLUTELY NOT
```
Progress Reporting
After each iteration, report with mechanical proof:
```markdown
Wiggum Loop - Iteration N
Completed
- [x] What was finished
In Progress
- [ ] Current work
Command Gate Results (Mechanical Proof)
| Gate | Command | Result | Output |
|------|---------|--------|--------|
| TEST | npm test | β
PASS | 47 passed, 0 failed |
| LINT | npm run lint | β
PASS | No errors |
| TYPECHECK | tsc --noEmit | β
PASS | No errors |
| FORMAT | prettier --check . | β
PASS | All files formatted |
Agent Review Status
| Agent | Status | Blockers | Warnings |
|-------|--------|----------|----------|
| test-writer | Done | 0 | 0 |
| code-reviewer | Done | 0 | 2 addressed |
| code-simplifier | Done | 0 | 0 |
Commits Made
abc123- feat(auth): add logindef456- test(auth): add login tests
Iteration Stats
- Attempt: 2 of 5 max
- Gates passed: 4/4
- Blockers remaining: 0
Next
- What happens next
```
The Command Gate Results table is mandatory. No table = not done.
Completion Report
MANDATORY: Run validation script FIRST and include output.
```bash
.claude/scripts/wiggum-validate.sh
```
Only proceed with completion report if validation shows VALIDATION PASSED.
When truly done, you MUST show mechanical proof:
```markdown
Wiggum Loop - COMPLETE β
Validation Script Output (REQUIRED)
[Paste the FULL output of .claude/scripts/wiggum-validate.sh here]
[Must show "VALIDATION PASSED" or you cannot claim complete]
Spec Fulfillment
| Requirement | Status | Implementation |
|-------------|--------|----------------|
| Req 1 | β | file.ts:10-50 |
| Req 2 | β | file.ts:52-80 |
Command Gates - Final Run (REQUIRED)
| Gate | Command | Result | Output |
|------|---------|--------|--------|
| TEST | npm test | β
PASS | 47 passed, 0 failed |
| LINT | npm run lint | β
PASS | No errors |
| TYPECHECK | tsc --noEmit | β
PASS | No errors |
| BUILD | npm run build | β
PASS | Build completed |
| FORMAT | prettier --check . | β
PASS | All formatted |
All gates must show β PASS. Any β FAIL = not complete.
Files Created/Modified
path/file.ts- Descriptionpath/test.ts- Tests
Commits
abc123- feat(auth): add logindef456- test(auth): add testsghi789- docs(auth): update README
Test Summary
- X tests written
- All passing (verified by TEST gate above)
- Coverage: X%
Dependencies Added
| Package | Approved | License | Pinned |
|---------|----------|---------|--------|
| bcrypt | β User approved | MIT | ^5.1.0 |
(Or "None" if no new dependencies)
Documentation Updates
- Updated README with auth section
- Added inline docs for AuthService
- Documented configuration options
Changelog Entries
- User authentication system (Added)
ADRs Created
- ADR-001: Use JWT over sessions
Agent Review Summary
| Agent | Blockers Fixed | Warnings Addressed |
|-------|----------------|-------------------|
| test-writer | 0 | 0 |
| code-reviewer | 2 | 3 |
| code-simplifier | 0 | 1 |
Loop Statistics
- Total iterations: 8
- Chunks completed: 3
Notes
- Decisions made
- Tradeoffs accepted
- Future considerations
```
You cannot write "COMPLETE" without the Command Gates table showing all β PASS.
Session cleanup is automatic: When wiggum-validate.sh passes, a PostToolUse hook removes .wiggum-session automatically.
Recovery from Failures
If a quality gate fails:
- Don't panic - this is expected and good
- Read the feedback carefully
- Address EACH issue raised
- Re-run the quality gate
- Repeat until pass
If you're going in circles:
- Stop and assess what's actually broken
- Use researcher agent to find alternative approaches
- Consider if the spec needs clarification
- Break the problem into smaller pieces
If plan needs to change significantly:
- Re-enter plan mode
- Explain what changed and why
- Get user approval for the new approach
Remember
- Plan first: Always get user approval before implementing
- You are persistent: Like Ralph Wiggum, you keep going despite setbacks
- Iteration is your friend: Each pass makes the code better
- Quality gates exist to help: They catch issues before they become problems
- Document everything: Code, decisions, and changelog
- Commit incrementally: Small, atomic commits are better than one giant commit
- "Done" means DONE: Not "mostly done" or "done enough"
- The spec is your contract: Fulfill every requirement
When in doubt, keep iterating. When you think you're done, verify one more time. Then verify again.
Start the loop now. Enter plan mode and design the approach for user approval.