Skip to content

Add /refine-plan skill for implementation plan review and refinement #157

Description

@williamthorsen

Problem

Implementation plans passed to /orchestrate-dev are often under-specified, leaving decision gaps that the coder fills with its own judgment. This causes implementation divergence from user expectations, particularly in two areas:

  1. UX behavior: When the plan says "add a settings panel" without specifying interactions, layouts, or states, the coder improvises — and its choices often don't match what was intended.
  2. Technical choices for new functionality: When there's no existing codebase pattern to follow, the coder makes autonomous decisions about patterns, data structures, and API shapes that diverge from expectations.

The cost model is clear: undoing work done wrong is far more expensive than spending tokens upfront to get the plan right. The code review cycle catches code defects, but it cannot catch the case where correct code implements the wrong thing because the plan was under-specified. The plan matched the requirements; it just didn't say enough.

Current workflow

  1. Use Claude's planning mode (with interactive Q&A) to generate a ticket and a plan
  2. Save the plan with /save-plan under a project and ticket ID
  3. Clear context and orchestrate: "Orchestrate the implementation of path/to/ticket.md. This plan is proposed: path/to/plan.md."

Between steps 2 and 3, manual review of the plan typically produces actionable findings — missing UX details, unspecified technical decisions, incorrect assumptions about the codebase. This manual review step should be automated.

Proposed solution

A /refine-plan skill that performs a single review-and-revise round on a saved implementation plan, checking for both completeness (decision gaps the coder would fill) and correctness (factual accuracy against the codebase), before the plan is passed to /orchestrate-dev.

Input

  • A saved plan file (the {timestamp}_{slug}_plan.md artifact from /save-plan)
  • A ticket or requirements source (file path or URL — GitHub issue URL, Jira URL, etc.)

Review criteria (single reviewer, comprehensive rubric)

Completeness

Focus What the reviewer checks
UX specification For UI-facing steps: are interactions, layouts, states (empty, loading, error), and user flows specified? Or will the coder have to decide?
Technical decisions For new functionality: are patterns, data structures, API shapes, and library choices specified? Or will the coder have to choose?
Behavioral specification For logic-heavy steps: are edge cases, defaults, and failure modes specified? Or will the coder have to improvise?

Correctness

Focus What the reviewer checks
Factual accuracy Do referenced files, utilities, and APIs exist and work as the plan assumes?
Structural soundness Are dependencies ordered correctly? Are steps appropriately scoped?
Requirements traceability Does every requirement have a step? Does every step trace to a requirement?

Flow

plan + ticket
  → reviewer (completeness + correctness findings)
  → split:
       findings the planner can resolve autonomously
         (correctness fixes, filling gaps from codebase context)
       gaps requiring user input
         (UX preferences, technical choices where multiple valid options exist)
  → present gaps to user as specific questions
  → user answers
  → planner revises plan (incorporating all findings + user answers)
  → save refined plan

Artifact layout

{ticket-dir}/
├── {timestamp}_{slug}_plan.md              ← original plan (preserved)
├── {timestamp}_{slug}_plan-review.md       ← review findings
├── {timestamp}_{slug}_plan-v2.md           ← refined plan

All are ticket-level artifacts using the standard {timestamp}_{slug}_{artifact-type} naming convention. No role-based naming (these aren't run artifacts).

Updated workflow

After implementation, the workflow becomes:

  1. Use Claude's planning mode to generate a ticket and a plan
  2. Save the plan with /save-plan
  3. /refine-plan path/to/plan.md <ticket-url-or-path> ← new step
  4. Clear context and orchestrate: "Orchestrate the implementation of <ticket-url-or-path> using this implementation plan: path/to/plan-v2.md."

Note the confidence upgrade in step 4: "using this implementation plan" (follow it) instead of "this plan is proposed" (validate and potentially deviate). The review step justifies this higher confidence.

Scope

  • This is a standalone skill, not a new phase in the orchestrate pipeline
  • It uses Task tool agent dispatches, not the orchestrate engine
  • It performs one review-and-revise round (no convergence loop)
  • It is invoked manually between saving the plan and orchestrating implementation

Acceptance criteria

Must have

  • A /refine-plan skill exists at packages/agents/content/skills/refine-plan/SKILL.md
  • The skill accepts a plan file path and a ticket source (file path or URL) as input
  • A reviewer agent is dispatched to analyze the plan for completeness and correctness
  • Completeness review covers UX specification gaps, unspecified technical decisions, and unspecified behavioral details
  • Correctness review covers factual accuracy (file/API existence), structural soundness (dependency ordering), and requirements traceability
  • Findings are split into those the planner can resolve autonomously and those requiring user input
  • Decision gaps requiring user input are presented to the user as specific questions
  • A planner/reviser agent is dispatched to produce the refined plan incorporating findings and user answers
  • The original plan is preserved (not overwritten)
  • The review findings are saved as {timestamp}_{slug}_plan-review.md
  • The refined plan is saved as {timestamp}_{slug}_plan-v2.md
  • All artifacts are saved at the ticket level (same directory as the original plan)

Should have

  • The reviewer verifies factual claims by reading files referenced in the plan
  • The reviewer flags steps where the coder will need to make UX decisions that aren't specified
  • The reviewer flags steps where the coder will need to choose between multiple valid technical approaches
  • The refined plan includes a brief summary of what changed from the original (for user awareness)

Nice to have

  • The skill works with orchestration plans (orchestration-plan.md) in addition to prose plans, for cases where /plan-orchestrable-steps is used instead of planning mode

Metadata

Metadata

Labels

featureAdded or improved external functionalityscope:agents

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions