/plan:plan-executefrom Plan & Critique
Executes a user's iteratively refined plan step by step, with resume on failure. Runs tests before reporting completion and follows a strict working agreement.
Ships in Plan & Critique. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
On Codex, invoke skills with $skill-name (for example, $plan-create). Use that form when giving Codex
commands; other clients use /skill-name.
You are executing the user's plan that has been iteratively refined.
Fixed rules:
Read the working agreement at working-agreement.md before step 1 and follow it for the whole run. If it cannot be found, tell the user it is missing and apply the rules listed below.
These rules bind this phase and override any step below that conflicts with them:
file:line reference, or a diff. Never assert a plausible but
unverified result.Co-Authored-By or Generated-with trailer to a commit.
Commit only when the user answers yes to the per-step commit prompt. Answering yes-to-all authorises the
remaining steps of this run only, and nothing beyond it.To do this, follow these steps precisely:
Resolve plansFolder from config:
Check the active agent's config file first (.codex/plan-critique-config.json for Codex,
.claude/plan-critique-config.json for Claude Code,
.gemini/plan-critique-config.json for Agy/Gemini, or .copilot/plan-critique-config.json for Copilot CLI),
falling back to reading the other agent configs. If no config exists or plansFolder is not set or is empty:
Respond with "No plans folder configured. Run /plan-create first to set up."
Get the active session id:
COPILOT_AGENT_SESSION_ID is set): read COPILOT_AGENT_SESSION_ID via
echo $COPILOT_AGENT_SESSION_ID (macOS/Linux) or $env:COPILOT_AGENT_SESSION_ID (Windows); if empty, use the
literal value default. Store as sessionId.echo $PPID and store as sessionId.Clean up stale sessions in [plansFolder]/.sessions/ (non-blocking, never abort because of cleanup):
kill -0 [PID] 2>/dev/null and delete if the process is no longer running.default or UUIDs), delete files not modified in the last 7 days.Read the current session's plan from [plansFolder]/.sessions/[sessionId] if it exists. Store as sessionPlan.
Scan [plansFolder]/ for subdirectories (each subdirectory is a plan).
Exclude archived/ and .sessions/ folders and any files, only list plan directories.
If no plan folders exist: Respond with "No plans found. Create one with /plan-create".
Select the plan to execute:
sessionPlan exists and matches a plan folder, auto-select it. Inform the user:
"Using current session plan: [sessionPlan]"Available plans:
1. add-user-authentication
2. refactor-database-layer
3. implement-caching
Which plan would you like to execute? [1-3]
Update the session file [plansFolder]/.sessions/[sessionId] with the selected plan slug (create if needed).
Check prerequisites:
[plansFolder]/[selected-plan]/plan.md does not exist: Respond with "No plan.md found."plan.md is empty: Respond with "Plan file is empty. Run /plan-critique first."Resolve project instructions in the project root. Use AGENTS.md for Codex, GEMINI.md for Agy,
.github/copilot-instructions.md for Copilot, or CLAUDE.md for Claude Code. Fall back to AGENTS.md then
CLAUDE.md. Apply those standards during each execution step. If none exist, note this but do not block.
Read [plansFolder]/[selected-plan]/critique.md if it exists. Note the iteration number and summary.
Inform the user: "Plan was critiqued (iteration N). Last critique summary: [brief]."
Use the critique as supplementary context during execution: implementation hints, alternative approaches,
and risk warnings from the critique are relevant when executing related steps. Do not treat the critique
as authoritative since the user chose what to incorporate into plan.md.
If critique.md does not exist, warn: "This plan has not been critiqued. Run /plan-critique first,
or confirm you want to proceed without review." Wait for user confirmation before continuing.
Check git status by running git status.
Detect test infrastructure. Look for a test runner and existing tests: a test script in package.json,
pytest.ini or tox.ini, phpunit.xml, a go.mod alongside _test.go files, Cargo.toml, a tests/,
test/ or __tests__/ directory, or a Makefile target named test.
[command]. Tests-first is binding for every step of this run."Check for existing execution state. If [plansFolder]/[selected-plan]/execution-state.json exists,
read it and prompt: "Previous execution found at step [X] of [total]. Resume or restart?"
Wait for user response before proceeding.
plan-execute: prefix. If they do not match, warn the user
that the codebase may have diverged from the recorded state. Skip already-completed steps.Review supporting files in the [plansFolder]/[selected-plan]/ folder. Classify each file by type
and inferred purpose. Present to the user alongside the step list:
"Supporting files found: schema.sql (SQL migration), mockup.png (UI reference)."
Let the user confirm or clarify how each file should be used during execution.
Parse the plan into discrete, executable steps using this ordering strategy:
Example: If a plan has "Add utility function", "Create database migration", and "Update API endpoint (uses utility)", order as: 1) Add utility function, 2) Create database migration, 3) Update API endpoint
Use Glob and Grep to estimate which existing files each step is likely to affect. Prefer the affected files the plan already lists, and use Glob to confirm each of those paths exists before presenting it. Present the steps to the user for confirmation, including the dependency graph and file estimates:
I've parsed your plan into the following steps:
1. [Step description] - likely affects: src/auth.ts, src/middleware.ts
(no dependencies)
2. [Step description] - creates new file: src/utils/hash.ts
(no dependencies)
3. [Step description] - likely affects: src/routes.ts
(depends on step 1)
...
Do you want me to proceed with execution? You can reorder or adjust steps before starting.
Wait for the user to confirm or request changes to the ordering.
Execute each step sequentially:
stepStartedAt
(see execution-state-format.md).mcp__ide__getDiagnostics when available, otherwise use LSP / code intelligence diagnostics on files
modified in this step. Report only NEW errors or warnings (compare before and after to avoid flagging
pre-existing issues).file:line reference for
every claim about what the step accomplished. Do not describe a step as working on the strength of the
code looking correct.plan-execute: [plan-slug] step N - [brief description]Co-Authored-By or Generated-with trailer to the commit message.gitCommits./plan-execute.On successful completion:
git log --oneline -N."/plan-archive to archive this plan."Notes:
git revert. This is the primary safety net.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
plan-execution, step-by-step, test-driven, resume-on-failure
5 skills in this plugin
/plan-archiveArchive a completed or abandoned plan for future reference. Use when the user runs /plan-archive or asks to archive a finished plan./plan-createCreate a new plan folder with a plan.md template. Use when the user asks to start, create or open a new plan, or runs /plan-create./plan-critiqueCritique the user's plan from plan.md and write critique.md. Use when the user runs /plan-critique or asks for an adversarial review of an existing plan./plan-cycleDraft, critique and merge a plan in one loop, then stop for approval. Use when the user runs /plan-cycle or asks to run the full create-and-critique planning loop.npx claudepluginhub serbanghita/plan-critique-skills --plugin planOther plugins' skills for the same job