From tommymorgan
This skill should be used when executing plan tasks autonomously, implementing features using TDD, running the red-green-refactor cycle, handling code review loops, or dealing with blocked tasks. Provides the autonomous TDD execution workflow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tommymorgan:tdd-executionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Workflow for executing plan tasks autonomously using Test-Driven Development, with code review gates and root cause analysis for failures.
Workflow for executing plan tasks autonomously using Test-Driven Development, with code review gates and root cause analysis for failures.
Test-First: Write the failing test before any implementation. The test defines what "done" looks like.
Atomic Tasks: Each task = one test file = one commit. Keep changes small and reviewable.
Evidence-Based: Never guess at failures. Use root-cause-analysis before declaring anything blocked.
Continuous Progress: Update the plan file after each task. Progress survives session interruption.
┌─────────────────────────────────────────────────────────┐
│ VERIFICATION SWEEP │
│ (establish ground truth) │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ SELECT NEXT TASK │
│ (first pending task by number) │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ RED PHASE │
│ Write failing test from Gherkin │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ GREEN PHASE │
│ Implement minimum code to pass test │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ CODE REVIEW │
│ Loop until approved │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ COMMIT │
│ Conventional commit message │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ UPDATE PLAN │
│ Status: pending → complete │
└─────────────────────────┬───────────────────────────────┘
│
▼
More pending? ──yes──► SELECT NEXT TASK
│
no
│
▼
DONE
Define the expected behavior before writing any implementation. The test is the specification.
Good tests:
From Gherkin to test:
Gherkin:
Scenario: Successful registration with valid email
Given I am a new user
When I register with email "[email protected]" and password "SecurePass123"
Then my account should be created
And I should receive a confirmation message
Test:
describe('User Registration', () => {
it('should create account and return confirmation for valid registration', async () => {
// Given: new user (no setup needed)
// When: register with valid credentials
const result = await register({
email: '[email protected]',
password: 'SecurePass123'
});
// Then: account created and confirmation returned
expect(result.success).toBe(true);
expect(result.message).toContain('confirmation');
});
});
If the test passes immediately:
Write the minimum code necessary to make the test pass.
Minimum viable implementation:
Stuck after 3-5 attempts:
Ensure implementation quality before committing. Fresh perspective catches issues.
Launch code-reviewer subagent:
Task({
subagent_type: "tommymorgan:code-reviewer",
description: "Review task implementation",
prompt: `Review the implementation:
Task: <task description>
Gherkin: <related scenarios>
Check:
- Does implementation satisfy Gherkin scenarios?
- Code quality and best practices
- Security considerations
- Test quality
Files changed: <list>
Respond: APPROVED or NEEDS_CHANGES with specifics.`
})
If NEEDS_CHANGES:
If still not approved after 3 iterations:
Create atomic, reviewable commits with clear history.
<type>(<scope>): <subject>
<body>
Task: <number> - <description>
Type selection:
feat - New functionalityfix - Bug fixrefactor - Code improvementtest - Test changes onlydocs - DocumentationExample:
feat(auth): add user registration endpoint
Implement registration with email validation and password hashing.
Returns confirmation message on successful account creation.
Task: 2 - Add registration endpoint
git add -A
git commit -m "<message>"
One task = one commit. No batching.
Reflect actual completion status in the plan file.
After successful commit, update the task status:
Find:
**Status**: pending
Replace:
**Status**: complete
This ensures:
After 3-5 implementation attempts:
Task({
subagent_type: "tommymorgan:root-cause-analyzer",
prompt: `Analyze failure:
Error: <what's failing>
Attempts: <what was tried>
Use five-whys methodology.
Identify actual root cause.`
})
**Status**: blocked
**Root Cause**: <identified root cause>
After 3 review iterations:
If tests fail due to environment:
If work is interrupted:
Plan file reflects accurate state:
Next session:
Use TodoWrite for real-time progress:
TodoWrite({
todos: [
{ content: "Task 1: Create user model", status: "completed" },
{ content: "Task 2: Add registration endpoint", status: "in_progress" },
{ content: "Task 3: Add login endpoint", status: "pending" }
]
})
Update after each task completion.
When all tasks complete:
## Work Complete
**Plan**: <filename>
**Tasks**: X/X complete
**Commits**: N commits
All tasks verified and complete.
Feature ready for final review.
When blocked:
## Work Blocked
**Plan**: <filename>
**Progress**: X/Y complete
**Blocked on**: Task N
Root Cause: <explanation>
Human intervention required.
npx claudepluginhub tommymorgan/claude-plugins --plugin tommymorganImplements task specs via TDD (RED-GREEN-REFACTOR cycle), one test at a time from PLAN-*.md files. Collaborative mode pauses per step; auto mode runs autonomously.
Creates TDD implementation plans enforcing strict Red-Green-Commit/Rollback cycles per step. Auto-activates for TDD commands, references, or test-critical features.
Guides task implementation via Conductor's TDD workflow: mark plan.md progress, red-green-refactor cycle with pytest coverage checks, git commits, and verification protocols.