Prp Implement
Execute an implementation plan with rigorous validation loops
---
description: Execute an implementation plan with rigorous validation loops
argument-hint: <path/to/plan.md>
---
# Implement Plan
**Plan**: $ARGUMENTS
---
## Your Mission
Execute the plan end-to-end with rigorous self-validation. You are autonomous.
**Core Philosophy**: Validation loops catch mistakes early. Run checks after every change. Fix issues immediately. The goal is a working implementation, not just code that exists.
**Golden Rule**: If a validation fails, fix it before moving on. Never accumulate broken state.
---
## Phase 0: DETECT - Project Environment
### 0.1 Identify Package Manager
Check for these files to determine the project's toolchain:
| File Found | Package Manager | Runner |
|------------|-----------------|--------|
| `bun.lockb` | bun | `bun` / `bun run` |
| `pnpm-lock.yaml` | pnpm | `pnpm` / `pnpm run` |
| `yarn.lock` | yarn | `yarn` / `yarn run` |
| `package-lock.json` | npm | `npm run` |
| `pyproject.toml` | uv/pip | `uv run` / `python` |
| `Cargo.toml` | cargo | `cargo` |
| `go.mod` | go | `go` |
**Store the detected runner** - use it for all subsequent commands.
### 0.2 Identify Validation Scripts
Check `package.json` (or equivalent) for available scripts:
- Type checking: `type-check`, `typecheck`, `tsc`
- Linting: `lint`, `lint:fix`
- Testing: `test`, `test:unit`, `test:integration`
- Building: `build`, `compile`
**Use the plan's "Validation Commands" section** - it should specify exact commands for this project.
---
## Phase 1: LOAD - Read the Plan
### 1.1 Load Plan File
```bash
cat $ARGUMENTS
1.2 Extract Key Sections
Locate and understand:
- Summary - What we're building
- Patterns to Mirror - Code to copy from
- Files to Change - CREATE/UPDATE list
- Step-by-Step Tasks - Implementation order
- Validation Commands - How to verify (USE THESE, not hardcoded commands)
- Acceptance Criteria - Definition of done
1.3 Validate Plan Exists
If plan not found:
Error: Plan not found at $ARGUMENTS
Create a plan first: /prp-plan "feature description"
PHASE_1_CHECKPOINT:
- Plan file loaded
- Key sections identified
- Tasks list extracted
Phase 2: PREPARE - Git State
2.1 Check Current State
git branch --show-current
git status --porcelain
git worktree list
2.2 Branch Decision
| Current State | Action |
|---|---|
| In worktree | Use it (log: "Using worktree") |
| On main, clean | Create branch: git checkout -b feature/{plan-slug} |
| On main, dirty | STOP: "Stash or commit changes first" |
| On feature branch | Use it (log: "Using existing branch") |
2.3 Sync with Remote
git fetch origin
git pull --rebase origin main 2>/dev/null || true
PHASE_2_CHECKPOINT:
- On correct branch (not main with uncommitted work)
- Working directory ready
- Up to date with remote
Phase 3: EXECUTE - Implement Tasks
For each task in the plan's Step-by-Step Tasks section:
3.1 Read Context
- Read the MIRROR file reference from the task
- Understand the pattern to follow
- Read any IMPORTS specified
3.2 Implement
- Make the change exactly as specified
- Follow the pattern from MIRROR reference
- Handle any GOTCHA warnings
3.3 Validate Immediately
After EVERY file change, run the type-check command from the plan's Validation Commands section.
Common patterns:
{runner} run type-check(JS/TS projects)mypy .(Python)cargo check(Rust)go build ./...(Go)
If types fail:
- Read the error
- Fix the issue
- Re-run type-check
- Only proceed when passing
3.4 Track Progress
Log each task as you complete it:
Task 1: CREATE src/features/x/models.ts ✅
Task 2: CREATE src/features/x/service.ts ✅
Task 3: UPDATE src/routes/index.ts ✅
Deviation Handling: If you must deviate from the plan:
- Note WHAT changed
- Note WHY it changed
- Continue with the deviation documented
PHASE_3_CHECKPOINT:
- All tasks executed in order
- Each task passed type-check
- Deviations documented
Phase 4: VALIDATE - Full Verification
4.1 Static Analysis
Run the type-check and lint commands from the plan's Validation Commands section.
Common patterns:
- JS/TS:
{runner} run type-check && {runner} run lint - Python:
ruff check . && mypy . - Rust:
cargo check && cargo clippy - Go:
go vet ./...
Must pass with zero errors.
If lint errors:
- Run the lint fix command (e.g.,
{runner} run lint:fix,ruff check --fix .) - Re-check
- Manual fix remaining issues
4.2 Unit Tests
You MUST write or update tests for new code. This is not optional.
Test requirements:
- Every new function/feature needs at least one test
- Edge cases identified in the plan need tests
- Update existing tests if behavior changed
Write tests, then run the test command from the plan.
Common patterns:
- JS/TS:
{runner} testor{runner} run test - Python:
pytestoruv run pytest - Rust:
cargo test - Go:
go test ./...
If tests fail:
- Read failure output
- Determine: bug in implementation or bug in test?
- Fix the actual issue
- Re-run tests
- Repeat until green
4.3 Build Check
Run the build command from the plan's Validation Commands section.
Common patterns:
- JS/TS:
{runner} run build - Python: N/A (interpreted) or
uv build - Rust:
cargo build --release - Go:
go build ./...
Must complete without errors.
4.4 Integration Testing (if applicable)
If the plan involves API/server changes, use the integration test commands from the plan.
Example pattern:
# Start server in background (command varies by project)
{runner} run dev &
SERVER_PID=$!
sleep 3
# Test endpoints (adjust URL/port per project co
Maintain Prp Implement?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Prp Implement on getagentictools](https://getagentictools.com/loops/ca1773130n-implement-plan?ref=badge) npx agentictools info loops/ca1773130n-implement-plan The second line is the CLI lookup for this page — handy in READMEs and docs.