Quality gate

From melodic-software/claude-code-plugins · View interactive version

Quality gate is an AI agent skill from the GitHub repository melodic-software/claude-code-plugins. Single-lens review checkpoint between 'code works' and 'code is ready': self, code, code-design, architecture, security, spec, close-out, downstream, pr, criteria, slice or restatement mode, each delegated to its reviewer. Use when asked to 'review this', for a 'self-review' or 'quality gate', a cod

How to use this skill

Skill file

Arguments. [self|code|code-design|architecture|security|spec|close-out|downstream|pr|criteria|slice…]; the full set ends slice|restatement]. spec takes [--spec <path|id>], close-out takes [--container <id>] [--dry-run], and slice takes <name>. Every mode also takes the phase-boundary inputs [--worktree <path>] [--base <sha>] [--quality-bar <prototype|internal|production>] [--report-only] ("Shared inputs").

Repository context. Gather first

<!-- BEGIN GENERATED: gather-block. Edit docs/conventions/gather-block/block.md, then run scripts/sync-gather-block.py -->

Run each command below as its own Bash call, all sent together in one message (worktree isolation).

Keep any bound in the command's own pipe (output limits).

Unless this section says otherwise, treat a failure (not a repository, git unavailable) as an unknown value and carry on. Keep these as body calls, never ## Pre-computed context lines (gather-block convention).

<!-- END GENERATED: gather-block -->

With --worktree <path>, run both as git -C <path> ... ("Shared inputs").

Purpose

Review is the quality checkpoint between "code works" and "code is ready." This skill structures that step so changes are inspected for consistency, correctness, and alignment with the project's conventions before verification or PR creation. Self-review catches errors tests miss. Inconsistencies, loose ends, convention drift, design shortcuts. Delegated reviews (code, architecture, security) bring specialized scrutiny the implementer's tunnel vision would miss.

Depth, not breadth. This skill picks one lens per invocation. For a multi-surface fan-out that runs many reviewers at once and ranks their combined findings, use this plugin's fanout skill instead.

Shared inputs

orchestrator review a phase diff in a worker's worktree. Their table, the base-SHA pre-flight and

the reviewer's brief are in context/phase-boundary.md; read it

whenever any of them is passed. **A base SHA overrides the ladder below: with --base, no

pull-request lookup, fetch or remote read runs.**

A spec container is not a branch, so that mode derives a container-scoped basis of its own, per

execution shape (context/close-out.md "Why it needs its own diff basis").

Every other mode uses the base below. When an open PR exists for the branch, its baseRefName is the base: dispatched reviewers diff git merge-base origin/<baseRefName> HEAD. Find it with /source-control:pull-request list --head <current-branch> (if enabled), invoked via the Skill tool, or the forge's own list of open PRs by head branch otherwise. One row gives the base; an empty array means no open PR. A failed read is not "no PR": the base is unresolved, so stop and report it rather than substitute another base. With no PR, git merge-base origin/HEAD HEAD (falling back to the remote's resolved default branch via git ls-remote --symref, then origin/main; when none yields a merge-base the base is unresolved, never HEAD) so committed-clean branches still show their changes; untracked files come from git ls-files --others --exclude-standard.

Step 0: Detect review mode

$ARGUMENTS, optional mode selector. When given, use it directly; otherwise infer:

| Signal | Mode | Context file |

|--------|------|-------------|

| Just finished implementing, "review my work", bare invocation with uncommitted changes | self | context/self.md |

| "review the code", "code review" | code | context/code.md |

| "code-design review", one fact copied into several files, one change cascading across files, a plan phase tagged Review: code-design | code-design | context/code-design.md |

| "architecture review", new modules, cross-cutting structure | architecture | context/architecture.md |

| "security review", auth/input handling, API endpoints | security | context/security.md |

| "does this match the spec/issue/plan", "did we build what was asked", scope-creep check, spec [--spec <path\|id>] | spec | context/spec.md |

| "close-out review", "review the container", "did the whole spec ship", a spec container whose last sub-item just closed, close-out [--container <id>] [--dry-run] | close-out | context/close-out.md |

| "what could this break", "blast radius", "what else does this touch", "who calls this", a contract/signature/serialization change | downstream | context/downstream.md |

| "review the PR", a PR exists for the branch (unchecked with --base) | pr | context/pr.md |

| "review criteria", "what should I check" | criteria | context/criteria.md |

| slice <name>, "review testing", "review concurrency" | slice | context/per-slice.md |

| "restatement review", "SSOT drift", markdown-heavy diff | restatement | context/restatement.md |

Ambiguous → present the modes and ask. Read the matching context file before proceeding.

Downstream probe setting. downstream mode reads one setting, downstream_probe (run or

report, default run). The user's option is ${user_config.downstream_probe}; a literal,

unexpanded placeholder means unset. It is a policy floor: report from the user option or from

the repository's docs/conventions/review.yaml, read from the default branch, wins. The resolution

steps and the probe are in context/downstream.md ("Resolve

downstream_probe" and Step 2); keys and level rule:

CODE0.

Step 0.5: Pre-flight gate (diff-consuming modes only)

Mode-scoped by design. criteria is a reference mode that loads criteria and runs on a clean tree,

so it is exempt, except under --base or --worktree (context/phase-boundary.md).

close-out is gated, but on its own basis, not this one: it runs the same two checks below

against the container-scoped basis it derives, plus a rollup check that the container is actually

finished (context/close-out.md "Step 4"). Every remaining mode consumes the

branch review diff, so for those: resolve the review diff base ("Shared inputs") and confirm it

yields a non-empty diff before dispatching any reviewer. With --base, the checks run against that

SHA as context/phase-boundary.md "Pre-flight with a base SHA" says.

after a fetch (do not silently substitute a different base. That reviews the wrong diff), or no

ladder ref resolves at all → report which ref failed and stop.

stop; never stage files to manufacture a diff.

Untracked-only is reviewable here, and this is a deliberate divergence from fanout. This

skill's Shared inputs hand untracked files to the dispatched reviewer directly ("Shared inputs";

the self and slice worker templates both read them), so a branch whose whole change is new

files has a real change set. Stopping on it would make a new-module or new-test review report

"nothing to review" about work that is plainly there. fanout stops on that case because its

surfaces receive only the merge-base diff, which cannot show an unstaged file. Review the untracked

files in place; still never git add them.

Either outcome dispatches zero reviewers: a lens run against an empty or wrong change set produces

noise, not a verdict. Two modes add a gate of their own on top of this one: an explicitly passed

--spec ref that does not resolve is a stop (context/spec.md "Rung 1"), and so

is an explicitly passed --container ref that does not resolve

(context/close-out.md "Step 1").

Step 1: Gather context

  1. What changed?. The repository context above + the review diff base
  2. What was the goal?, the original task, approved plan, or user intent from conversation. In every mode but spec and close-out this is background for judging the change; making the goal the thing under judgment is spec mode, which owns the spec-source discovery ladder and the fidelity finding classes. close-out is that same lens at container scale, reusing both and resolving its spec from the container instead of the branch
  3. What conventions apply?. Resolve the project's standards for the changed surfaces through the standards index per the Shared-inputs criteria-resolution binding, so every review mode grounds in the same rows plan formulation loaded

Step 2: Execute the review

Follow the selected context file. Two hard rules:

Step 3: Report findings

## Review: [mode] — [branch or task name]

### Findings

| # | Severity | Confidence | Category | Finding | File:Line | Action |
|---|----------|------------|----------|---------|-----------|--------|

### Strengths

- What is done well — review should validate, not only criticize

### Verdict

- [ ] Ready to proceed — no blocking findings
- [ ] Needs fixes — N findings require attention

Step 4: Handoff

What this skill does NOT do

Spoke paths

The context/ files write the plugin's root directory as <plugin-root>, which is

${CLAUDE_PLUGIN_ROOT}. Put that path in place of the placeholder before running a command or

writing it into a brief. Those files arrive through the Read tool as plain bytes, so a ${…} token

in them would reach the Bash tool unsubstituted, and the Bash tool's environment has no

CLAUDE_PLUGIN_ROOT to expand it from. Basis: the plugins reference,

<https://code.claude.com/docs/en/plugins/manifest-reference#where-each-variable-resolves>, verified

2026-10-07; recheck when that table adds supporting files to where a ${…} reference resolves.

Next

Related

Gotchas

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.