From project-finisher
This skill should be used when running the project-finisher workflow. Use when the user invokes /finish or when continuing a project-finisher session. Orchestrates the iterative brainstorm/plan/execute/review cycle for autonomous project completion.
How this skill is triggered — by the user, by Claude, or both
Slash command
/project-finisher:orchestrateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The orchestrator is the central brain of project-finisher. It drives the iterative brainstorm/plan/execute/review loop, manages milestone progression, coordinates with the memory skill to persist state across sessions, and uses git for version control, rollback, and auditability.
The orchestrator is the central brain of project-finisher. It drives the iterative brainstorm/plan/execute/review loop, manages milestone progression, coordinates with the memory skill to persist state across sessions, and uses git for version control, rollback, and auditability.
When the orchestrator is invoked, execute the following steps in order:
--goal). This is the immutable source of truth for the project.~/.claude/project-finisher-data/workflow_preferences.md if it exists. This file contains learned user behavior patterns (pacing, depth, workflow ordering, tool preferences, edit size, error recovery, interaction patterns) that adapt how the orchestrator operates. Apply the adaptations described in the evolve skill's "Apply Procedure" throughout this session. If the file does not exist, use default behavior (no adaptations).git rev-parse --git-dir).
git init. Create a .gitignore with at minimum: .claude/, .DS_Store, __pycache__/, *.pyc, node_modules/, .env. Make an initial commit with the existing project files (or an empty initial commit if the project is new).main, master) for later use. Ensure the working tree is clean — if there are uncommitted changes, warn the user and suggest committing or stashing before proceeding.project_memory/ directory at the project root.
project_memory/ exists (resume): Read progress.md to determine the current milestone and its phase. Read current_context.md for active working state. Enter the appropriate phase for the current milestone.project_memory/ does not exist (initialize): Create the project_memory/ directory. Initialize progress.md, current_context.md, and lessons.md using the templates from the memory skill. Extract the goal summary from the goal file into progress.md. Propose the first 1-3 milestones based on the goal. Set the first milestone as current and enter the Brainstorm phase.progress.md, read the current milestone name and phase (brainstorm, plan, execute, or review).Each milestone progresses through four phases in order. After the Review phase completes, the loop either advances to the next milestone (starting at Brainstorm) or terminates if the project goal is satisfied.
Purpose: Validate feasibility and refine the approach for the current milestone through multiple rounds of /scientific-brainstorming. Each round surfaces problems; the next round addresses them. Do NOT implement anything.
Context to load: goal file + progress.md + lessons.md
Git actions at phase start:
pf/milestone-N already exists (session resume):
git checkout pf/milestone-N) and continue where you left off.git checkout -b pf/milestone-N <default-branch>).git merge <default-branch>. If merge conflicts occur, output <pf-signal>BLOCKED:Merge conflict with user changes on default branch — manual resolution needed</pf-signal> and stop.Procedure:
Summarize the current milestone's objective in the context of the overall goal.
Conduct multiple rounds of /scientific-brainstorming, where each round builds on the pushback from the previous one:
Round 1 — Feasibility and approach:
/scientific-brainstorming with: the milestone objective, relevant lessons from lessons.md, and the current project state.Round 2 — Address Round 1 pushback:
/scientific-brainstorming again, this time focused on resolving those specific issues.Round 3+ — Continue until convergence (if needed):
After convergence, update the current milestone and roadmap:
progress.md.current_context.md under "Key Decisions". Include which round produced each decision.Advance to Phase 2 (Plan).
Convergence check: A round has converged when /scientific-brainstorming responds with no new concerns, endorses the approach, and the only remaining items are implementation details (not feasibility questions).
Rules:
project_memory/ updates (brainstorm decisions)./scientific-brainstorming presents multiple candidate approaches or options to choose from, do NOT stop to ask the user. Instead, evaluate the options using this priority:
[AUTO] in current_context.md and continue to the next brainstorming round with the chosen approach.Purpose: Produce a concrete, ordered implementation plan that can be executed without further clarification.
Context to load: goal file + progress.md + current_context.md
Procedure:
current_context.md, create a step-by-step implementation plan covering:
docs/plans/) and in current_context.md under a ## Milestone Rubric section. Use the format defined in the Quality Scoring section.docs/plans/YYYY-MM-DD-milestone-name.md (create the docs/plans/ directory if it does not exist). Use the current date and a slug of the milestone name.current_context.md:
plan.Rules:
current_context.md should be able to execute it.Purpose: Implement the plan. Write code, create files, run tests, make commits. Act as an engineer — minimize discussion, maximize output.
Context to load: current_context.md (contains the plan reference and all decisions)
Procedure:
pf/milestone-N branch. If not, check it out.current_context.md "Plan Reference > Steps" in order.current_context.md.pf: step 3 — add authentication middleware). These incremental commits provide a safety net during execution. If something breaks, you can roll back to the last good commit within the milestone.current_context.md under "Blockers".workflow_preferences.md:
Rules:
pf: for traceability.current_context.md.workflow_preferences.md:
Purpose: Evaluate the milestone against its acceptance criteria. Capture lessons. Update docs. Squash-merge and archive the milestone branch. Decide what comes next.
Context to load: progress.md + current_context.md + lessons.md
Procedure:
Run tests: Execute the project's test suite (or the tests defined in the plan). Record pass/fail results.
Score and improve the milestone (inner review-fix loop with external scorer):
Round 1 — Score each dimension using the external Codex reviewer:
a. Run bash ${CLAUDE_PLUGIN_ROOT}/scripts/codex-review.sh <project-dir> --round 1.
b. Read project_memory/review.json. If it contains an "error" key, fall back to self-scoring using the Quality Scoring procedure (load rubric, score each dimension, compute weighted average).
c. Convert the JSON scores into a score card and write to current_context.md under ## Score Cards (append as Round 1).
If weighted average ≥ threshold: proceed to step 3 (acceptance criteria check).
If weighted average < threshold, enter the fix loop:
d. Structural failure check: If ANY dimension scores below STRUCTURAL_FAILURE_THRESHOLD (4), the problem is fundamental. Break out of the review phase and re-enter Phase 2 (Plan) to re-plan the milestone. Log the failing dimension and score in current_context.md.
e. Identify fix targets: Select dimensions scoring below 7, prioritized by weight × (7 - score) descending. Cap at MAX_FIXES_PER_ROUND (3) fixes per round.
f. Implement targeted fixes: For each fix target, make the minimum change needed to improve that dimension. Commit each fix with pf: review-fix round N — <description>.
g. Re-score (Round N+1): Run bash ${CLAUDE_PLUGIN_ROOT}/scripts/codex-review.sh <project-dir> --round N+1. If Codex fails, fall back to self-scoring. Write a new score card with the Delta column showing change from previous round.
h. Check exit conditions:
STAGNATION_THRESHOLD (0.5) → stagnation detected. Log "score plateau at X.X" in lessons.md. If score ≥ threshold - 1.0, accept with caveats and proceed to step 3. Otherwise, re-enter Phase 3 (Execute) to address larger gaps.MAX_REVIEW_ROUNDS (3) → max rounds reached. If score ≥ threshold - 1.0, accept with caveats and proceed to step 3. Otherwise, note gaps and re-enter Phase 3 (Execute).i. If no exit condition triggered, repeat from (e) for the next round.
Important: Inner loop rounds are sub-iterations within a single review phase entry. They do NOT count against continuous mode phase iteration budgets. Fallback: If Codex scoring fails on every attempt in a round, the orchestrator falls back to self-scoring for that round using the Quality Scoring procedure. This ensures the loop never stalls due to an external tool failure.
Check acceptance criteria: For each criterion in the current milestone's acceptance criteria (from progress.md), verify whether it is met. Check the box if met; note why if not.
Check for regressions: Verify that work from previous milestones still functions correctly.
Update lessons.md: Append a new section for this milestone with:
Update progress.md:
Doc-check and update (only if acceptance criteria are all met):
git diff --name-only <default-branch>...HEAD).| Doc | Update when... |
|---|---|
| README.md | New user-facing feature, changed usage, new commands |
| CLAUDE.md | Changed project structure, new conventions, new workflows |
| plugin.json | Version bump if milestone adds features |
| SKILL.md files | Skill behavior changed |
pf: docs — update for milestone N.Squash-merge to default branch (only if acceptance criteria are all met):
git checkout <default-branch>.git merge --squash pf/milestone-N.references/phase-prompts.md for exact format):
current_context.md, verbatim, preserving [AUTO] tagsgit diff --statlessons.mdproject_memory/ files on the default branch to reflect the current state (overwrite, not merge — these are state files, history is in git).Update CHANGELOG.md:
CHANGELOG.md exists at the project root, prepend the new milestone entry.pf: changelog — milestone N.Archive milestone branch: Rename the milestone branch: git branch -m pf/milestone-N archive/pf/milestone-N. Archived branches preserve the full incremental commit history.
Evolve workflow preferences: Run the evolve skill's "Observe & Extract" procedure. Reflect on this session's pacing, depth, workflow ordering, tool usage patterns, edit size patterns, error recovery behavior, and interaction patterns. Update ~/.claude/project-finisher-data/workflow_preferences.md with any new observations. This step ensures the orchestrator continuously adapts to the user's working style.
Decide next action:
current_context.md, and enter Phase 1 (Brainstorm) for the new milestone.<pf-signal>GOAL_COMPLETE</pf-signal>. Stop the loop.progress.md under "Upcoming Milestones". Set the first new milestone as current, reset current_context.md, and enter Phase 1 (Brainstorm).Rules:
Every milestone must satisfy all of the following constraints:
| Rule | Requirement |
|---|---|
| Session-completable | The milestone must be completable within a single session (one brainstorm/plan/execute/review cycle). |
| Acceptance criteria | Must have 2-5 concrete, verifiable acceptance criteria. |
| File count | Should touch fewer than 15 files. If more are needed, split the milestone. |
| Independent value | The milestone must deliver independently valuable work. After completion, the project should be in a better state than before, even if no further milestones are completed. |
| Clear boundary | It must be obvious when the milestone is done. Avoid criteria like "improve performance" — use "reduce page load time to under 2 seconds" instead. |
If a milestone violates these rules during Brainstorm, re-scope it before advancing to Plan.
See references/milestone-examples.md for concrete examples of well-scoped and poorly-scoped milestones.
The quality scoring system evaluates milestones on multiple dimensions with numeric scores (1-10), providing richer feedback than binary pass/fail. Scores are weighted by user-defined priorities and compared against a threshold to determine milestone completion.
The goal file may contain a ## Quality Priorities section that defines dimension weights and threshold:
## Quality Priorities
| Dimension | Weight |
|-----------|--------|
| acceptance_criteria | 4 |
| correctness | 3 |
| test_coverage | 2 |
| code_quality | 2 |
| documentation | 1 |
| performance | 0 |
threshold: 7.0
Weights range from 0 (skip) to 4 (critical). If no Quality Priorities section exists, see the /finish command for initialization behavior.
| Dimension | Description | Required? |
|---|---|---|
acceptance_criteria | Are the milestone's acceptance criteria met with evidence? | Yes (weight ≥ 3) |
correctness | Does the implementation work correctly? No regressions from prior milestones? | Yes (weight ≥ 1) |
test_coverage | Are there sufficient tests? Are error/edge cases covered? | Yes (weight ≥ 0) |
code_quality | Does the code follow existing patterns? Is it clean and maintainable? | Yes (weight ≥ 0) |
documentation | Are docs updated for user-facing changes? | Optional (weight 0 to skip) |
performance | Does the implementation meet performance requirements? | Optional (weight 0 to skip) |
When scoring a milestone (called from Phase 4: Review):
current_context.md (generated during Phase 2: Plan).tests/test_auth.py)"git diff main...HEAD shows no changes to prior milestone files)"Σ(weight × score) / Σ(weight).Score cards are written to current_context.md under ## Score Cards:
### Round N (YYYY-MM-DD)
| Dimension | Weight | Score | Evidence | Delta |
|-----------|--------|-------|----------|-------|
| acceptance_criteria | 4 | 8 | 3/3 criteria verified ✓ | — |
| correctness | 3 | 7 | All tests pass, no regressions | — |
| test_coverage | 2 | 5 | Missing error path tests for X | — |
| code_quality | 2 | 8 | Follows existing patterns | — |
**Weighted average**: 6.8 / 10 (threshold: 7.0)
The Delta column shows change from previous round (— for Round 1, +N or -N for subsequent rounds). All rounds are kept for trajectory visibility.
When no Quality Priorities section exists and auto mode must infer:
| Dimension | Default Weight |
|---|---|
| acceptance_criteria | 4 |
| correctness | 3 |
| test_coverage | 2 |
| code_quality | 2 |
| documentation | 1 |
| performance | 0 |
In auto mode, adjust defaults based on keywords found in the goal file:
| Keywords in goal file | Adjustment |
|---|---|
| "robust", "production", "reliable", "critical" | correctness → 4, test_coverage → 3 |
| "prototype", "MVP", "proof of concept", "experiment" | test_coverage → 1, code_quality → 1 |
| "documentation", "user-facing", "API" | documentation → 2 or 3 |
| "performance", "latency", "throughput", "scale" | performance → 2 or 3 |
| "refactor", "clean", "maintainable" | code_quality → 3 |
Apply at most one adjustment per dimension. If multiple keywords match, use the highest weight.
| Constant | Default | Description |
|---|---|---|
MAX_REVIEW_ROUNDS | 3 | Maximum scoring rounds per milestone review |
STAGNATION_THRESHOLD | 0.5 | Minimum weighted average improvement between rounds to continue |
STRUCTURAL_FAILURE_THRESHOLD | 4 | Any dimension scoring below this triggers re-plan instead of fix |
MAX_FIXES_PER_ROUND | 3 | Maximum fix targets per round (prevents thrashing) |
As the project advances through milestones, the nature of the work changes. Use this table to guide milestone selection:
| Project Stage | Typical Milestone Focus | Examples |
|---|---|---|
| Early (0-20% of goal) | Setup, scaffolding, architecture decisions, core data models | Initialize project structure, set up build system, define database schema, create core abstractions |
| Middle (20-80% of goal) | Feature implementation, integrations, business logic | Implement user authentication, build API endpoints, create UI components, add data validation |
| Later (80-100% of goal) | Polish, optimization, edge cases, documentation, testing gaps | Add error handling for edge cases, optimize slow queries, write missing tests, improve logging, create user documentation |
Guidelines:
The orchestrator should operate autonomously, but must stop and ask the user in these situations — unless auto mode is active (see "Auto Mode Behavior" below):
When stopping (in normal mode), provide:
When auto mode is active (passed from the /finish --auto command), the orchestrator resolves decision points autonomously instead of stopping:
| Situation | Auto Mode Action |
|---|---|
| Ambiguous goal | Choose the interpretation most consistent with the goal file's explicit requirements. Prefer the narrower scope. Document the interpretation in current_context.md. |
| Equally viable approaches | Apply the decision logic: (1) pick the option with lower risk/complexity, (2) follow the /scientific-brainstorming recommendation if one exists, (3) if truly equal, pick the simplest/most conventional approach. Document the choice and reasoning. |
| External resources needed | Still stop and ask — auto mode cannot provision credentials or external services. |
| Significant divergence | Re-align toward the goal by choosing the correction that requires the least rework. Document what diverged and how it was corrected. |
| Repeated failure | Re-scope the milestone to a smaller, more achievable version. Split off the harder parts as a separate future milestone. If the milestone has failed 3 times, skip it and move on, logging the failure in lessons.md. |
Logging requirement: Every auto-decided choice must be logged in current_context.md under "Key Decisions" with the prefix [AUTO] so the user can review all autonomous decisions after the session. Example:
[AUTO] Chose approach A (file-based caching) over approach B (Redis) — simpler, no external dependency, sufficient for the current scale. Brainstorming Round 1 recommended this approach.
When operating in continuous mode (.claude/pf-loop.state.json exists), the orchestrator must output exit signals at specific points so the Stop hook knows when to end the loop.
Signals are XML tags in the assistant's output: <pf-signal>SIGNAL</pf-signal>
| Signal | When to Output | Effect |
|---|---|---|
<pf-signal>GOAL_COMPLETE</pf-signal> | All milestones are completed and the project goal is fully satisfied. Output this in the Review phase after confirming goal satisfaction. | Loop ends cleanly. State file removed. |
<pf-signal>BLOCKED:reason</pf-signal> | The workflow cannot continue autonomously. Examples: external credentials needed, repeated failure (3+ times on same milestone), ambiguous goal that auto mode cannot resolve. | Loop ends. User sees the reason. |
progress.md and continue with the next milestone naturally..claude/pf-loop.state.json), signals are ignored. It is safe to always include them.Project-finisher uses git for rollback, auditability, and milestone isolation. This section summarizes the git workflow.
<default-branch> ─── squash merge ─── squash merge ─── ...
\ ↑ ↑
pf/milestone-1 ────┘ pf/milestone-2 ┘
(archived after) (archived after)
pf/milestone-N.archive/pf/milestone-N for future reference.| Phase | Commit behavior |
|---|---|
| Brainstorm | Commit project_memory/ updates after convergence |
| Plan | Commit plan file + project_memory/ updates |
| Execute | Incremental commits after each logical step (prefixed with pf:) |
| Review | Commit doc updates, then squash-merge everything to default branch |
BLOCKED and let the user resolve.git revert <squash-merge-commit> on the default branch.archive/pf/milestone-N to see step-by-step commits.git revert HEAD on the milestone branch.project_memory/ files are rewritten (not merged) on each milestone completion. They represent current state. Historical state is preserved in the archived milestone branches and in the squash-merge commit messages.
See references/phase-prompts.md for internal prompt templates used when entering each phase.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub yuanhao96/project-finisher --plugin project-finisher