Agent skill
implement-plan
Execute an approved implementation plan following TDD methodology. Works through phases with Red-Green-Refactor cycles, verifying completion at each step.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/implement-plan-charly-vibes-wai-2
SKILL.md
Implement Plan
Implement an approved plan following Test-Driven Development methodology.
Getting Started
When given a plan path:
- Read the plan completely (no limit/offset)
- Check for existing checkmarks (✓ or [x]) indicating completed work
- Read related specs/documentation referenced in the plan
- Create a todo list to track progress through phases
- Start implementing from the first unchecked phase
If no plan path provided, ask the user which plan to implement or list available plans.
Implementation Philosophy
Follow the Red, Green, Refactor cycle:
- Red: Write a failing test for the desired behavior
- Green: Write minimal code to make the test pass
- Refactor: Clean up code while keeping tests green
Never skip the Red phase - watching tests fail confirms they actually test something.
Workflow
For Each Phase:
Step 1: Read Phase Requirements
- Read the phase section completely
- Understand files to change and what changes are needed
- Note the success criteria (automated and manual)
- Check for any dependencies or prerequisites
Step 2: Write Tests First (TDD - RED)
- Write test(s) that describe the desired behavior
- Make tests as specific as possible
- Run the tests - confirm they fail (and fail for the right reason)
- If test doesn't fail, the test is wrong or code already works
// Example: Write failing test first
describe('validateToken', () => {
it('should accept valid JWT tokens', async () => {
const token = 'valid.jwt.token'
const result = await validateToken(token)
expect(result.valid).toBe(true)
})
})
// Run test: npm test
// ❌ FAILED: validateToken is not defined
// Good - fails for the right reason
Step 3: Implement Minimal Code (GREEN)
- Write just enough code to make the test pass
- Don't add features not tested yet
- Resist the urge to "make it perfect" now
- Run tests - confirm they pass
// Minimal implementation to pass test
export async function validateToken(token: string) {
const decoded = jwt.verify(token, SECRET)
return { valid: true, userId: decoded.sub }
}
// Run test: npm test
// ✓ PASSED
Step 4: Refactor (if needed)
- Clean up the code while tests stay green
- Extract functions, improve names, remove duplication
- Run tests after each refactor - keep them green
- Stop when code is clean enough
// Refactored with better error handling
export async function validateToken(token: string): Promise<TokenResult> {
try {
const decoded = jwt.verify(token, getSecret()) as JWTPayload
return {
valid: true,
userId: decoded.sub
}
} catch (error) {
return {
valid: false,
userId: null,
error: error.message
}
}
}
// Run test: npm test
// ✓ Still passing after refactor
Step 5: Run Success Criteria Checks
Automated verification:
# Run all tests (not just the new ones)
npm test
# Type checking (if applicable)
npm run type-check # or tsc --noEmit
# Linting (if applicable)
npm run lint
# Build (if applicable)
npm run build
Manual verification:
- Follow manual verification steps from the plan
- Actually perform the verification, don't skip it
- Note any issues or unexpected behaviors
Step 6: Mark Phase Complete
- Check off completed items in the plan file
- Update the plan with any learnings or deviations
- Commit the changes for this phase (if appropriate)
Step 7: Inform User
Phase [N] Complete - Ready for Verification
Automated verification:
- [x] All tests pass (15 tests, 3 new)
- [x] Type checking passes
- [x] Build succeeds
Manual verification needed:
- [ ] [Manual step 1 from plan]
- [ ] [Manual step 2 from plan]
Changes made:
- src/auth/validate.ts:25-45 - Added validateToken function
- tests/auth/validate.test.ts:12-28 - Added 3 tests for token validation
Let me know when verified so I can proceed to Phase [N+1].
Wait for user confirmation before proceeding to next phase.
Moving Between Phases
- Complete one phase before starting the next
- Don't work on multiple phases in parallel
- Each phase should leave the codebase in a working state
- If a phase is blocked, inform the user immediately
When Things Don't Match Reality
If the plan doesn't match what you find:
Issue in Phase [N]:
Expected (from plan): [What the plan says]
Found (in codebase): [Actual situation]
Why this matters: [Impact explanation]
Options:
1. Adapt implementation to current reality
2. Update the plan to reflect new understanding
3. Ask user for guidance
How should I proceed?
Important: Don't blindly follow an outdated or incorrect plan. Reality wins.
Resuming Work
If the plan has checkmarks indicating completed work:
- Trust completed work - assume it's done correctly
- Start from first unchecked item - don't redo completed work
- Verify previous work ONLY if:
- Something seems obviously broken
- Tests are failing
- Current phase depends on previous phase and seems incompatible
- Continue with Red-Green-Refactor cycle from current phase
Key Reminders
- Tests first, always - Write test before implementation (TDD)
- Watch it fail - Confirm test fails before implementing
- Minimal code - Write just enough to pass the test
- Keep tests green - All tests should pass after each change
- Refactor safely - Only refactor when tests are green
- One phase at a time - Complete and verify before moving on
- Mark progress - Check off items as you complete them
- Verify thoroughly - Actually run the verification steps
Handling Common Situations
Tests are already passing (someone implemented it):
Phase [N]: The tests I was about to write already pass. It appears this work was already completed.
Verification:
- [x] Tests exist and pass
- [x] Implementation matches plan requirements
Marking phase complete and moving to next phase.
Can't make tests pass:
Phase [N]: Issue encountered
I wrote tests for [feature] but after [X] attempts, can't make them pass due to [specific reason].
Options:
1. Revise the approach (suggest alternative)
2. Update the plan (if requirements changed)
3. Need more research/context
How should we proceed?
Found a better approach mid-implementation:
Phase [N]: Alternative approach discovered
While implementing [feature], I discovered [better pattern/approach].
Current plan: [Approach from plan]
Alternative: [New approach]
Tradeoffs: [Pros/cons]
Should I:
1. Continue with plan as written
2. Update plan and use new approach
3. Discuss further
External dependency is broken/unavailable:
Phase [N]: Blocked by external dependency
Cannot proceed because [dependency] is [unavailable/broken/different than expected].
Impact: [What this blocks]
Workaround options: [If any]
Need guidance on how to proceed.
Working with Issue Trackers
If using an issue tracker (GitHub Issues, Jira, etc.):
Before starting:
# Note the issue ID in commits
# Reference the plan in issue comments
After completing a phase:
# Update issue with progress
# Link commits to issue
# Add "Completed Phase N" comment
After completing all phases:
# Close or mark issue as ready for review
# Link to relevant commits/PRs
Integration with Other Workflows
After implementation:
- Use
prompt-workflow-deliberate-commits.mdto commit changes thoughtfully - Use
prompt-task-describe-pr.mdto create comprehensive PR descriptions - Use
prompt-task-iterative-code-review.mdto self-review before committing
If need to pause:
- Use
prompt-workflow-create-handoff.mdto document progress - Mark current phase status in todo list
- Note what's complete vs in-progress
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?