Execute and coordinate work on PLAN files with phased breakdown. Tracks progress via JSON state, coordinates worker sub-agents in worker mode, and manages commits. Use when user references a PLAN file or asks to continue/execute a plan.
Executes existing PLAN files with progress tracking via JSON state. Automatically launches worker sub-agents when mode is "worker", or executes steps directly in "direct" mode. Triggers when user references a PLAN file or asks to continue/execute a plan.
/plugin marketplace add bfreis/claude-mart/plugin install plan-exec@claude-martThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/plan-toolThis skill executes and coordinates work on existing PLAN files. It handles progress tracking, worker coordination (in worker mode), commit management, and phase advancement.
Use this skill when:
@PLAN-auth.md)Do NOT use this skill when:
plan-generator skill instead)These rules MUST be followed at all times:
The execution mode is defined in the JSON state block (execution.mode). You MUST follow it:
mode is "worker": You are a COORDINATOR. Do NOT execute steps directly. Launch plan-worker sub-agents to do the work. NEVER perform implementation work yourself in worker mode.mode is "direct": Execute steps directly in the main session.On resume: Re-read the JSON state and respect the mode. Do not switch modes.
State updates MUST happen in real-time, not batched:
scripts/plan-tool start <file> <step-id>scripts/plan-tool complete <file> <step-id> --summary "..."This ensures that if execution is interrupted, the plan can resume from the correct point.
PLAN files contain a JSON state block at the end wrapped in HTML comment markers:
<!--PLAN-STATE
{
"schema_version": "1.0",
"execution": {
"mode": "direct", // or "worker"
"auto_continue": false, // auto-advance to next phase when current completes
"commit_after_phase": false,
"include_plan_in_commit": true
},
"current_phase": 0, // -1 means all complete
"phases": [
{
"id": 0,
"name": "Setup",
"steps": [
{ "id": "0.1", "status": "pending" },
{ "id": "0.2", "status": "completed", "summary": "..." }
]
}
]
}
PLAN-STATE-->
pending - Not startedin_progress - Currently being worked on (only ONE at a time)completed - Finished successfullyblocked - Cannot proceed (includes blocker field with reason)When a PLAN file does not have a JSON state block, initialize it before starting execution:
scripts/plan-tool init <file> [--mode direct|worker] [--auto-continue] [--commit] [--no-plan-in-commit]
The init command parses the markdown headings to discover phases and steps, then generates the JSON state block at the end of the file.
Options:
--mode direct|worker: Execution mode (default: direct)--auto-continue: Enable auto-advancement between phases--commit: Enable commits after each phase--no-plan-in-commit: Exclude PLAN file from commitsExample:
scripts/plan-tool init PLAN-auth.md --mode worker --auto-continue --commit --no-plan-in-commit
When starting execution:
<!--PLAN-STATE marker)scripts/plan-tool init with options based on the execution preferences in the Instructions sectiondirect or worker)current_phase)pending, in_progress, completed, or blockedblocked steps that need resolutionUse the scripts/plan-tool script (relative to this skill directory) to manage JSON state updates.
Before beginning work on a step:
scripts/plan-tool start <file> <step-id>
Example:
scripts/plan-tool start PLAN-auth.md 1.2
Note: Only ONE step can be in_progress at a time. Starting a new step automatically resets any previously in-progress step to pending.
After successfully finishing a step:
scripts/plan-tool complete <file> <step-id> [--summary "..."]
Example:
scripts/plan-tool complete PLAN-auth.md 1.2 --summary "Added JWT validation middleware with RS256 support"
Auto-advancement: If all steps in the current phase are completed and auto_continue is enabled, the phase automatically advances.
When a step cannot proceed due to an issue:
scripts/plan-tool block <file> <step-id> --reason "..."
Example:
scripts/plan-tool block PLAN-auth.md 1.3 --reason "Redis not configured - refresh tokens need persistent storage"
To clear a blocked status after resolving the issue:
scripts/plan-tool unblock <file> <step-id>
To manually advance to the next phase:
scripts/plan-tool next-phase <file> [--force]
Use --force to advance even if some steps are incomplete or blocked (not recommended).
In direct mode, execute steps directly in the main Claude Code session.
pending step in the current phasescripts/plan-tool start### Step 1.2: Implement user validation
Original step description...
- **Completed:** Added email regex validation and password strength check
- **Decision:** Used zxcvbn library for password scoring
scripts/plan-tool complete with a brief summaryOnly stop when:
auto_continue is disabled (ask user if they want to continue)If auto_continue is enabled: Do NOT stop between phases. Immediately proceed to the next phase.
After completing steps, add detailed notes to the Notes & Decisions section:
## Notes & Decisions
### Phase 1: Core Implementation (Completed)
- Implemented JWT generation using RS256 algorithm
- Chose 15-minute expiry for access tokens based on security best practices
- Added refresh token rotation to prevent token reuse
In worker mode, delegate step execution to plan-worker sub-agents. The main session acts as a coordinator.
Parse the JSON state block to find steps with "status": "pending" in the current phase. Determine batch size by considering:
Gather the information the worker needs:
BEFORE launching the worker, mark all assigned steps as in-progress:
scripts/plan-tool start <file> <step-id>
Run this for EACH step being assigned to the worker.
Then launch the plan-worker sub-agent with this prompt structure:
**Project:** [Project name from plan]
**Goal:** [Brief goal from Project Overview section]
**Your Assignment:**
Execute the following steps from Phase N:
- Step N.X: [full description]
- Step N.Y: [full description]
- Step N.Z: [full description]
**Context Files to Read:**
- [path/to/file1] - [why it's relevant]
- [path/to/file2] - [why it's relevant]
**Success Criteria:**
- [Specific criterion derived from steps]
- [Another criterion]
**Constraints:**
- [Any project-specific constraints]
- [Technology requirements]
When done, provide your structured summary.
When the worker returns its summary:
For COMPLETED steps:
scripts/plan-tool complete <file> <step-id> --summary "Summary from worker"
Add inline notes under the step heading:
### Step N.X: [description]
Original step description...
- **Completed:** [1-2 sentence summary of what was done]
- **Decision:** [any notable decision, if applicable]
For BLOCKED steps:
scripts/plan-tool block <file> <step-id> --reason "Blocker description from worker"
Add blocker details under the step heading:
### Step N.X: [description]
Original step description...
- **Blocked:** [description of the blocker]
Then report to user and ask how to proceed.
Update Notes & Decisions section with worker findings for the appropriate phase.
commit_after_phase is enabledauto_continue is enabled: Immediately proceed to the next phaseauto_continue is disabled: Ask user if they want to continueIf commit_after_phase is enabled:
include_plan_in_commit setting:
true: Include the PLAN file in the commitfalse: Keep PLAN file unstagedExample commit message:
feat(auth): Phase 1 - Implement JWT token generation
- Added generateToken() function with RS256 signing
- Created token validation middleware
- Implemented refresh token rotation
After a phase completes:
If auto_continue is enabled:
If auto_continue is disabled:
When current_phase becomes -1:
When a step is blocked:
scripts/plan-tool block to mark it in the JSON stateWhen a worker completes some but not all assigned steps:
scripts/plan-tool complete for each finished steppending if work can continueblocked if there's an issueIf the JSON state becomes corrupted:
scripts/plan-tool init to rebuild state if user confirms