Implement
End-to-end feature implementation pipeline. Runs pre-flight validation, TDD cycle, scope enforcement, and quality commit as a single orchestrated flow.
Pipeline Phases
Phase 0: Pre-flight (< 30 seconds)
Before writing any code, validate the workspace is ready:
- Git status — check for uncommitted changes that might conflict
- Monorepo freshness — if shared/library packages exist, check if source is newer than compiled output. If yes, rebuild first.
- Workspace typecheck — run (or equivalent) on the target workspace
- Existing test check — if a test file exists for the target module, run it to confirm green baseline
If any check fails, report and ask the user how to proceed before writing code.
Phase 1: Understand & Plan (no code yet)
- Read the target file(s) mentioned in
- Identify the module type (route handler, repository, plugin, utility, service, component)
- Determine the mock strategy — check nearest test files for established patterns
- Plan what tests to write and what implementation to add
Present a brief summary: "I'll add X tests covering Y, then implement Z." Wait for user confirmation if the scope seems large (> 3 files).
Phase 2: Bootstrap Mock (1 test)
- Check test runner config for mock reset/restore settings
- Write ONE minimal test that imports the module and verifies mocks resolve
- Run it, confirm it passes
- If it fails, diagnose mock wiring before proceeding
Phase 3: Red — Write Failing Tests
Write test cases for:
- Happy path
- Edge cases
- Error cases
Run the test file — all new tests MUST fail. If any pass unexpectedly, the tests aren't testing new behavior.
Phase 4: Green — Minimum Implementation
Write the minimum code to make all tests pass. Do NOT:
- Add features not covered by tests
- Optimize prematurely
- Refactor existing code
Run the test file — all tests MUST pass.
Phase 5: Scope Guard
Before committing, self-audit the changes:
- Run to see all modified files
- Compare against the original task from
- Flag any files that don't relate to the task:
- Formatting-only changes → revert with
- Unrelated refactors → revert or split into separate commit
- Docstring additions to untouched code → revert
If scope creep is detected, report it and ask the user whether to keep or revert the extra changes.
Phase 6: Full Suite + Quality Gates
- Run the full test suite (e.g.,
npx vitest run --reporter=dot
)
- Run workspace typecheck ( or equivalent)
- Run linter on changed files only
If any gate fails:
- Test failure: determine if your change caused it (regression) or pre-existing
- Type error: fix it
- Lint error in your files: fix it
- Lint error in files you didn't touch: ignore, note in commit message
Phase 7: Commit
Stage only the files you changed (NEVER
). Commit with conventional format:
type(scope): description
Co-Authored-By: Claude <noreply@anthropic.com>
Abort Conditions
STOP the pipeline and ask the user if:
- Pre-flight finds the workspace in a broken state
- More than 5 files need modification (scope may be too large)
- Bootstrap mock test fails after 2 attempts
- Full suite regression is caused by your changes
Arguments
- : What to implement
- Example:
/implement add rate limiting to POST /api/search
- Example:
/implement src/routes/admin/settings.ts — add PATCH endpoint for theme
- If empty, ask the user what to implement
Integration
This skill orchestrates:
- — Phase 2-4 (mock bootstrap, red, green)
- — Phase 7 (stage + commit with gates)
Use
instead of calling these individually for full pipeline coverage.