Implement a validated specification with review-fix loops
Executes validated specifications through review-fix loops. Use when implementing complex specs that require systematic task breakdown, testing, and quality verification.
/plugin marketplace add betamatt/claude-plugins/plugin install spec@betamatt-claude-plugins<path-to-spec-file>Implement the specification at: $ARGUMENTS
Check if STM is available by running stm list. If the command fails, STM is not installed.
Check Task Management:
stm init first, then /spec:decompose to create tasksVerify Specification:
Read the specification to understand:
Using STM (if available):
stm list --status pending -f json
Using TodoWrite (fallback):
Create tasks for each component in the specification
For each task, follow this cycle:
Implement the component directly, applying domain-specific best practices:
stm show [task-id] to get full task detailsWrite comprehensive tests for the implemented component:
Important: Always run code review to verify both quality AND completeness. Task cannot be marked done without passing both. The review-fix loop runs a maximum of 3 times before escalating to the user.
iteration = 0
review_passed = false
while iteration < 3 and not review_passed:
# Run code review
Review implementation for BOTH:
1. COMPLETENESS - Are all requirements from the task fully implemented?
2. QUALITY - Code quality, security, error handling, test coverage
Categorize issues as: CRITICAL, IMPORTANT, or MINOR.
# Parse review output
Extract issues by severity:
- CRITICAL: Security vulnerabilities, crashes, data loss
- IMPORTANT: Performance issues, missing error handling
- MINOR: Style, docs (log but don't block)
if no CRITICAL and no IMPORTANT issues:
review_passed = true
break
# Fix issues
For each CRITICAL issue:
Fix immediately - these block completion
For each IMPORTANT issue:
Fix before marking task done
# Re-run tests after fixes
Run test suite to verify fixes don't break anything
iteration++
# Handle max iterations reached
if iteration >= 3 and not review_passed:
ESCALATE - Do NOT mark task done
Report to user:
- Which issues remain unresolved
- What was attempted
- Request manual intervention
Auto-update protocol - Always update STM status after review loop:
On success (review passed):
stm update [task-id] --status done --notes "Implemented, tested, reviewed - passed"
On escalation (max iterations reached):
stm update [task-id] --status blocked --notes "Review loop failed after 3 iterations - [remaining issues]"
Then notify the user of the escalation with details about remaining issues.
Create atomic commit following project conventions:
git add [files]
git commit -m "[follow project's commit convention]"
Monitor implementation progress:
Using STM:
stm list --pretty # View all tasks
stm list --status pending # Pending tasks
stm list --status in-progress # Active tasks
stm list --status done # Completed tasks
Using TodoWrite:
Track tasks in the session with status indicators.
Implementation is complete when:
If problems are encountered: