agentleFS
howar31howar31/magi-workflow/skills/review-plan/SKILL.md

review-plan

Skill3 starsChanged 7 months agoMITView on GitHub

Run a multi-CLI MAGI review of a sprint's PLAN.md / SPEC.md. **Optional step** — can be skipped to save tokens if you trust the plan; human review of the doc is a valid alternative. Spawns reviewers in parallel via the orchestrator, then applies semantic dedup + weighted voting per references/MAGI_VOTING.md. Default reviewers and voting mode come from ~/.config/magi-workflow/config.json. Override with --reviewers and --magi.

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use implement-plan, review-security and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jesgarramSkill

    implement-plan

    Convert a plan document into Claude Code tasks with dependencies. Pure parser that reads plans from context/plans/ and creates executable task workflows.

    Also in 4 projects that use this

  • PydanticSkill

    review-security

    Security review of the current branch against its merge base — sandbox escapes, memory errors, panics and resource-limit bypasses. Use when reviewing changes for security risk, or before merging anything touching the heap/ module, path_security.rs, the wire protocol or the pool.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    review-pr

    Review a pull request for functional issues, coding guideline adherence, and best practices. Use this when asked to review, inspect, or provide feedback on a pull request (Azure DevOps or GitHub). Proposes comments for user approval before posting.

    Also in 5 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 4 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. 0 are common, 4 are distinctive, and 14 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run a lightweight preflight.

    line 20
  2. Very specific:

    Read references/MAGI_VOTING.md (in the plugin root) for the consensus rules.

    line 23
  3. Very specific:

    Write a prompt file at <sprint_dir>/.xreview-prompt.md (use .gitignore if needed) containing:

    line 51
  4. Very specific:

    If a required: true reviewer failed → tell the user the cause and abort (e.g., claude failed → check claude login).

    line 148
  5. Distinctive:

    If only optional reviewers failed → continue (degraded MAGI is allowed).

    line 150
  6. Very specific:

    Read every successful reviewer's final.txt.

    line 166
  7. Very specific:

    Write to <sprint_dir>/MAGI_PLAN_REVIEW.md in output_language:

    line 176
  8. Very specific:

    Check whether a previous MAGI_PLAN_REVIEW.md exists for this sprint (the current run overwrites it, but its presence before overwrite …

    line 236
  9. Distinctive:

    When the verdict is REQUEST-CHANGES, classify whether the issues are:

    line 252
  10. Very specific:

    If verdict = APPROVE → suggest /magi:tasks (if TASKS.md doesn't exist) or /magi:go (if it does).

    line 270
  11. Very specific:

    If verdict = APPROVE-WITH-NITS → list nits, ask whether to address before /magi:tasks or defer.

    line 272
  12. Distinctive:

    If verdict = REQUEST-CHANGES → apply §7.5 severity triage:

    line 274
  13. Very specific:

    If only (b)-type issues remain → recommend: "Record these as Implementation notes and proceed to /magi:tasks."

    line 275
  14. Very specific:

    If any (a)-type issues remain → recommend: "Revise PLAN/SPEC to address the architectural concerns, then re-run /magi:review-plan."

    line 277
  15. Very specific:

    If round >= 3 and only (b)-type remain → strongly recommend proceeding: "已超過兩輪 review,剩餘皆為實作細節,建議直接進入 /magi:tasks。"

    line 279
  16. Distinctive:

    Do not auto-trigger anything.

    line 292
  17. Very specific:

    Always read references/MAGI_VOTING.md before classifying.

    line 296
  18. Very specific:

    If MAGI mode is unanimous and degraded, abort and surface clearly — do not silently produce a verdict on degraded data.

    line 301

“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/magi:review-plan — MAGI plan review

You are the coordinator. Have N CLIs review the user's PLAN/SPEC in parallel, then consolidate their findings using MAGI weighted voting.

0. Preflight

PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-}"
[[ -z "$PLUGIN_ROOT" ]] && PLUGIN_ROOT="$(cd "$(dirname "$BASH_SOURCE[0]")/../.." 2>/dev/null && pwd)"
USER_CONFIG="$HOME/.config/magi-workflow/config.json"

Run a lightweight preflight; if $USER_CONFIG missing or empty xreview.reviewers, tell the user to run /magi:setup.

Read references/MAGI_VOTING.md (in the plugin root) for the consensus rules. You will follow Steps 1–8 of that document.

0.5. State preflight (auto-refuse if not allowed)

STATE_JSON=$(bash "$PLUGIN_ROOT/scripts/shared/detect-state.sh")
blocked=$(jq -r '.disallowed_skills["review-plan"] // empty' <<<"$STATE_JSON")
if [[ -n "$blocked" ]]; then
  reason=$(jq -r '.disallowed_skills["review-plan"].reason' <<<"$STATE_JSON")
  suggest=$(jq -r '.disallowed_skills["review-plan"].suggest' <<<"$STATE_JSON")
  echo "Cannot run /magi:review-plan: $reason"
  echo "Suggested: $suggest"
  exit 1
fi

--force skips preflight. Note this skill is optional — the user can always skip it entirely by going straight to /magi:tasks.

1. Locate the document

Find the sprint folder (same logic as /magi:tasks). Read its PLAN.md or SPEC.md. If neither exists, abort and tell the user to run /magi:plan first.

2. Build the reviewer prompt

Write a prompt file at <sprint_dir>/.xreview-prompt.md (use .gitignore if needed) containing:

You are reviewing a software engineering plan. Apply skepticism and
domain expertise. Your output must be structured for downstream
consensus aggregation.

[Project context]
- TECHSTACK: see magi/TECHSTACK.md (read it)
- Conventions: see CLAUDE.md / AGENTS.md (read if available)

[Document under review]
<full content of PLAN.md or SPEC.md, with file path header>

[Your task]
Identify issues. For each issue, output a section in this format:

  ## Issue: <one-line subject>
  Severity: Critical | Important | Note
  Where: <file:line or section>
  Description: <2–6 sentences>
  Suggested fix: <1–3 sentences>

Then end with:

  ## Verdict
  <one of: APPROVE | APPROVE-WITH-NITS | REQUEST-CHANGES>
  <one paragraph rationale>

Do not produce any other output sections. Do not edit files.

[Special focus — Spec deltas section]
If the document under review contains a `## Spec deltas` section
declaring modifications to project-level living documents (root SPEC.md,
root CLAUDE.md, magi/PRD.md, magi/TECHSTACK.md), evaluate it critically:

- Are the declared modifications justified by the design described above?
- Are there obvious omissions — impacts the design implies but no delta
  lists (e.g., the plan adds a CLI flag but does not declare a delta to
  the SPEC.md flag table)?
- Does any declared modification break a contract documented elsewhere
  in the targeted file (e.g., contradicting an existing ADR)?

Surface delta-related concerns as standard `## Issue:` blocks and prefix
the subject with `[deltas]` so downstream consensus aggregation can
group them. If the deltas look correct, do not invent issues — silence
is a valid signal.

If `## Spec deltas` is missing entirely from a PLAN.md or SPEC.md, raise
one Important `[deltas]` issue saying so. (TICKET.md and HOTFIX.md never
contain this section — do not raise the issue against those.)

[Feasibility assessment]
Examine the plan for assumptions about development effort, complexity, or
tool/framework ergonomics that have not been validated by prototype or
prior experience. Examples:
- "vanilla TS state management is sufficient" — has this been prototyped?
- "migration will take ~2 hours" — based on what evidence?
- "no external dependencies needed" — are there hidden complexities?

For each such assumption, output:

  ## Spike candidate: <one-line assumption>
  Risk: <what could go wrong if this assumption is false>
  Validation: <how to validate — small prototype, benchmark, or PoC>

If no feasibility assumptions need validation, write:
  ## Spike candidates
  (none identified)

3. Argument parsing

  • --reviewers <cli:model>[,<cli:model>...] — override the reviewer list for this run. Empty list falls back to config.
  • --magi <mode> — override magi.mode for this run (majority / supermajority / unanimous / threshold:<N>).
  • --workdir <path> — reuse an existing orchestrator workdir (skip the fan-out, just re-run consensus). Useful for iterating on the consensus prompt.

4. Invoke the orchestrator

WORKDIR=$(mktemp -d -t magi-review.XXXXXX)
MAGI_REVIEW_WORKDIR="$WORKDIR" \
  "$PLUGIN_ROOT/skills/review-plan/scripts/orchestrator.sh" \
  "$prompt_file" \
  $reviewer_args   # optional <cli:model> ... from --reviewers

The orchestrator emits an event stream on stdout. Stream it to the user as status updates. Capture the WORKDIR path from the first event.

If policy_pass=false:

  • If a required: true reviewer failed → tell the user the cause and abort (e.g., claude failed → check claude login).
  • If only optional reviewers failed → continue (degraded MAGI is allowed).

5. Run consensus aggregation

"$PLUGIN_ROOT/scripts/shared/magi-consensus.sh" "$WORKDIR" \
  ${magi_override:+--mode "$magi_override"}

This produces <workdir>/magi-report.md and <workdir>/magi-report.json. This is mechanical aggregation, not the final vote.

6. Apply MAGI rules (this is your real job)

Open magi-report.json. Follow references/MAGI_VOTING.md:

  1. Read every successful reviewer's final.txt.
  2. Extract issues per reviewer.
  3. Semantically dedup across reviewers (be conservative).
  4. Compute vote_sum per merged issue.
  5. Apply the configured (or overridden) rule against ok_weight.
  6. Classify: 🔴 Critical / 🟡 Important (adopted) vs 🟢 Note (minority).
  7. Surface degraded-mode warnings prominently.

7. Write the consolidated report

Write to <sprint_dir>/MAGI_PLAN_REVIEW.md in output_language:

# 🧠 MAGI Plan Review — <Feature Name>

**Sprint:** magi/<num>-<slug>/ • **Document:** PLAN.md | SPEC.md

## Dashboard

┌─────────────────────────────────────────────────┐ │ VERDICT: <APPROVE | APPROVE-WITH-NITS | ...> │ ├─────────────────────────────────────────────────┤ │ Mode: <mode> Threshold: <value> │ │ OK weight: <ok> / <total> Degraded: <y/n> │ ├─────────────────────────────────────────────────┤ │ <✅|❌> claude <✅|❌> gemini <✅|❌> codex │ ├─────────────────────────────────────────────────┤ │ 🔴 Critical: <N> 🟡 Important: <N> │ │ 🟢 Minority: <N> 🔬 Spikes: <N> │ └─────────────────────────────────────────────────┘


Generate this box dynamically using the actual values. Adjust column
widths to fit the content.

## Verdict
<APPROVE | APPROVE-WITH-NITS | REQUEST-CHANGES>
Reasoning ...

## 🔴 Critical (adopted)
- [vote: 4/4 — claude(2) + gemini(1) + codex(1)] <issue subject>
  - Where: <file:line>
  - Suggested fix: ...
  - Reviewer details: ...

## 🟡 Important (adopted)
...

## 🟢 Minority
- [vote: 1/4 — codex(1) only] <issue>
  - Reviewer text: ...

## 🔬 Spike candidates
- [flagged by: <reviewers>] <assumption>
  Risk: ...
  Validation: ...

## ⚠️ Degraded mode (if applicable)
<short explanation of what was missing>

Then summarise to the user in chat: include a condensed version of the Dashboard box (verdict + issue counts on 2-3 lines), followed by the top 3 adopted issues.

7.5. Re-review guidance (round awareness + severity triage)

Round tracking

Check whether a previous MAGI_PLAN_REVIEW.md exists for this sprint (the current run overwrites it, but its presence before overwrite signals a prior round). Also check WORKS.md or git history for earlier review references. If this is a repeated review on the same document version, track the round number.

General guidance:

  • Round 1: normal review. All issue severities warrant attention.
  • Round 2: focus on whether round-1 Critical/Important issues were addressed. New issues are fine to raise.
  • Round 3+: tell the user explicitly: "This is round 3+. Repeated review rounds have diminishing returns. Consider proceeding to /magi:tasks unless there are unresolved Critical issues."

Severity-based re-review recommendation

When the verdict is REQUEST-CHANGES, classify whether the issues are:

(a) Architectural / structural — fundamentally changes the design shape, API contracts, data model, or dependency choices. These warrant PLAN/SPEC revision followed by re-review.

(b) Implementation-detail level — naming, error handling strategy, test approach, logging format. These should be recorded in the PLAN as ## Implementation notes (append section) for the developer to follow during /magi:go, but do NOT require a full re-review cycle.

Apply this classification in §8 hand-off below.

8. Hand-off

Tell the user (in output_language). When presenting multiple actionable choices, use the AskUserQuestion tool so the options appear interactively:

  • If verdict = APPROVE → suggest /magi:tasks (if TASKS.md doesn't exist) or /magi:go (if it does).
  • If verdict = APPROVE-WITH-NITS → list nits, ask whether to address before /magi:tasks or defer.
  • If verdict = REQUEST-CHANGES → apply §7.5 severity triage:
    • If only (b)-type issues remain → recommend: "Record these as Implementation notes and proceed to /magi:tasks."
    • If any (a)-type issues remain → recommend: "Revise PLAN/SPEC to address the architectural concerns, then re-run /magi:review-plan."
    • If round >= 3 and only (b)-type remain → strongly recommend proceeding: "已超過兩輪 review,剩餘皆為實作細節,建議直接進入 /magi:tasks。"

Example output:

✅ Verdict: APPROVE-WITH-NITS

下一步:
  /magi:tasks         (拆 milestones + 任務清單)

Do not auto-trigger anything.

Conventions

  • Always read references/MAGI_VOTING.md before classifying.
  • Be conservative in semantic dedup: when two issues are unclear, keep them separate.
  • Show minority issues — they are not noise; they are signal that one reviewer noticed something others missed.
  • If MAGI mode is unanimous and degraded, abort and surface clearly — do not silently produce a verdict on degraded data.
  • The workdir contains raw transcripts; offer them to the user if they want to inspect a specific reviewer's reasoning.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.