This guide provides detailed instructions for executing implementation plans created via /shep-kit:plan.
Prerequisites: Completed plan.md and tasks.md in specs/NNN-feature-name/
Implementation follows a strict discipline:
┌─────────────────────────────────────────────┐
│ For Each Phase in tasks.md: │
│ │
│ 1. Work through RED-GREEN-REFACTOR │
│ 2. UPDATE tasks.md checkboxes FREQUENTLY │
│ 3. Commit phase completion │
│ 4. Push to remote │
│ 5. Watch CI (gh run watch --exit-status) │
│ 6. IF CI fails: Fix-Commit-Push-Watch │
│ 7. ONLY proceed when CI passes │
└─────────────────────────────────────────────┘
# Example: Domain entity tests
pnpm test:watch # Start watch mode
# Write test first (it will fail - that's expected!)
# tests/unit/domain/entities/feature.test.ts
CRITICAL: As soon as you write a test:
pnpm test to confirm it failsgit add tests/unit/domain/entities/feature.test.ts specs/NNN-feature-name/tasks.md
git commit -m "test(domain): add failing test for Feature entity (RED phase)"
# Write minimal code to pass the test
# src/domain/entities/feature.ts
CRITICAL: As soon as the test passes:
pnpm test to confirm it passesgit add src/domain/entities/feature.ts specs/NNN-feature-name/tasks.md
git commit -m "feat(domain): implement Feature entity (GREEN phase)"
# Improve code structure, extract helpers, etc.
# Keep tests running (pnpm test:watch)
CRITICAL: After refactoring:
pnpm test still passesgit add src/domain/entities/feature.ts specs/NNN-feature-name/tasks.md
git commit -m "refactor(domain): improve Feature entity structure (REFACTOR phase)"
MANDATORY: Every phase completion MUST follow this workflow.
# If you haven't committed recently, do a final phase commit
git add .
git commit -m "feat(scope): complete phase N - <brief description>"
git push
# Get the run ID and watch
gh run watch --exit-status
CRITICAL: You MUST wait for CI to complete. Don’t move to the next phase!
Move to the next phase. Update tasks.md:
### Phase 2: Domain Layer (TDD Cycle 1) ✅
**RED (Write Failing Tests First):**
- [x] Write unit test: feature.test.ts
...
Enter Fix Loop - Do NOT proceed to next phase:
# Step 1: Get failure logs
gh run view <run-id> --log-failed
# Step 2: Analyze the error
# Read the logs, understand what failed
# Step 3: Fix the issue
# Make necessary code changes
# Step 4: Commit the fix
git add .
git commit -m "fix(scope): resolve CI failure - <what you fixed>"
# Step 5: Push
git push
# Step 6: Watch CI again
gh run watch --exit-status
# Step 7: Repeat Steps 1-6 until CI passes
DO NOT SKIP THE FIX LOOP. A failing phase blocks all subsequent work.
WRONG ❌:
- Work on 5 tasks
- Complete all 5 tasks
- Update tasks.md with all 5 checkboxes at once
RIGHT ✅:
- Complete task 1
- Immediately check it off in tasks.md
- Commit code + tasks.md together
- Complete task 2
- Immediately check it off in tasks.md
- Commit code + tasks.md together
...
# Commit 1: RED phase
git add tests/unit/feature.test.ts specs/NNN-feature-name/tasks.md
git commit -m "test(domain): add Feature entity test (RED)"
# Commit 2: GREEN phase
git add src/domain/entities/feature.ts specs/NNN-feature-name/tasks.md
git commit -m "feat(domain): implement Feature entity (GREEN)"
# Commit 3: REFACTOR phase
git add src/domain/entities/feature.ts specs/NNN-feature-name/tasks.md
git commit -m "refactor(domain): extract helper methods (REFACTOR)"
Notice how every commit includes tasks.md with updated checkboxes!
Some phases don’t require tests (TypeSpec models, build config, etc.).
Still follow the update discipline:
git add <files> specs/NNN-feature-name/tasks.md
git commit -m "feat(tsp): add Feature domain model"
❌ Working for hours, then updating tasks.md at the end
✅ Update tasks.md after each item completion
❌ Push and immediately start next phase
✅ Push, watch CI, fix-loop if needed, only then proceed
❌ Write entity, then write tests
✅ Write tests FIRST (RED), then implement (GREEN)
❌ “CI is flaky, I’ll fix it later”
✅ Fix immediately in a loop until green
| Command | Purpose |
|---|---|
pnpm test:watch |
TDD mode - auto-run tests |
pnpm test |
Run all tests |
git add <files> specs/*/tasks.md |
Stage code + task updates |
git push |
Push to trigger CI |
gh run watch --exit-status |
Watch CI, exit 1 if fails |
gh run view <id> --log-failed |
Get CI failure logs |
gh run list --limit 5 |
List recent CI runs |
RED (write test, see it fail)
↓
GREEN (write code, make it pass)
↓
REFACTOR (improve while keeping tests green)
↓
UPDATE tasks.md + COMMIT
↓
PUSH + WATCH CI
↓
FIX-LOOP if needed
↓
NEXT PHASE
For integration and E2E test phases, the same discipline applies:
After all phases are done:
pnpm validate # lint + format + typecheck + tsp
pnpm test # all tests pass
/shep-kit:commit-pr for final PR creation with CI validationRemember: Implementation discipline prevents bugs, makes reviews easier, and keeps the project maintainable. Follow the rules, update frequently, watch CI always.