一键导入
quality-gate
Run parallel quality reviews (React, SOLID, Security, Simplification, Slop) on branch changes and auto-fix issues
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run parallel quality reviews (React, SOLID, Security, Simplification, Slop) on branch changes and auto-fix issues
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | quality-gate |
| description | Run parallel quality reviews (React, SOLID, Security, Simplification, Slop) on branch changes and auto-fix issues |
| argument-hint | [base-branch] |
!IMPORTANT: Follow this process exactly. Do not skip steps.
Arguments: $0 (optional) — base branch to diff against. If omitted, auto-detect.
This skill invokes four external skills plus one Claude Code built-in. Before doing anything else, verify each is installed at ~/.claude/skills/<name>/SKILL.md (or as a built-in). simplify is a Claude Code built-in command and does not require installation.
Check each path in a single shell call:
for s in vercel-react-best-practices applying-solid-principles security-review code-slop; do
[ -f ~/.claude/skills/$s/SKILL.md ] && echo "OK $s" || echo "MISS $s"
done
If any report MISS, stop and tell the user which skills are missing with the exact install command for each. Do not proceed until the user confirms they are installed.
| Skill | Install command |
|---|---|
vercel-react-best-practices | npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-react-best-practices -g |
applying-solid-principles | npx skills add https://github.com/BenjaminG/ai-skills --skill applying-solid-principles -g |
security-review | npx skills add https://github.com/getsentry/skills --skill security-review -g |
code-slop | npx skills add https://github.com/BenjaminG/ai-skills --skill code-slop -g |
simplify | Built-in to Claude Code — no install needed |
If the project does not use React/Next.js, vercel-react-best-practices is optional (Task 1 in Step 2 is skipped anyway).
Soft dependencies for Step 3.5 (Context Check). The context-fetcher degrades gracefully when these are missing — log which one is unavailable in the bundle and continue, do not abort the skill:
| Tool | Used for | Probe |
|---|---|---|
linear-cli skill | Linear issue + comments | [ -f ~/.claude/skills/linear-cli/SKILL.md ] |
devsql CLI | Past Claude Code sessions | command -v devsql |
gh CLI | Open PR body + comments | command -v gh && gh auth status |
Detect the base branch:
git rev-parse --verify main >/dev/null 2>&1 && echo "main" || (git rev-parse --verify master >/dev/null 2>&1 && echo "master" || echo "develop")
Then get the full diff and changed file list:
git diff <base>...HEAD --name-only
git diff <base>...HEAD
Store the diff output — you will pass it to review agents.
Also detect the project stack:
# Check if React/Next.js project
cat package.json 2>/dev/null | jq -r '.dependencies // {} | keys[]' | grep -E '^(react|next)$'
TeamCreate team_name: "quality-gate" description: "Parallel quality review of branch changes"
Create one TaskCreate per review dimension. Skip Task 1 if the project does not use React/Next.js.
Each task description MUST include:
/tmp/quality-gate-findings-<reviewer-name>.md using the Write tool (e.g. /tmp/quality-gate-findings-solid-reviewer.md)SendMessage with type: "message" and recipient: "lead" (the lead will read findings from the file, no need to include full findings in the message)TaskUpdate with status: "completed" after sending findings| Task | subject | activeForm | Skill command & instructions |
|---|---|---|---|
| 1 | Review React/Next.js best practices | Reviewing React best practices | /vercel-react-best-practices Review ONLY the changed code in the diff against the rules. Categorize each finding as FIX or NITPICK |
| 2 | Review SOLID principles | Reviewing SOLID principles | /applying-solid-principles Review ONLY the changed code in the diff against SOLID principles and clean code practices. Categorize each finding as FIX or NITPICK |
| 3 | Review security | Reviewing security | /security-review Review ONLY the changed code in the diff against the security checklist. Categorize each finding as FIX or NITPICK |
| 4 | Review simplification opportunities | Reviewing simplification | /simplify Review ONLY the changed code in the diff for simplification opportunities (clarity, consistency, maintainability). Categorize each finding as FIX or NITPICK. Do NOT modify any files — report only. |
| 5 | Review code slop | Reviewing code slop | /code-slop but override: Do NOT modify any files. Instead, identify all slop issues and report them in FIX/NITPICK format below. |
| 6 | Fetch historical context | Fetching historical context | See Task 6 spec below. Gathers Linear issue, PR body/comments, and past Claude Code sessions that touched the changed files. Output is consumed in Step 3.5 (Context Check). |
context-fetcherGoal: assemble a context bundle so Step 3.5 can detect FIX suggestions that contradict prior decisions.
The task description MUST instruct the teammate to:
<prefix>/<TEAM>-<NUM>-<slug>, <TEAM>-<NUM>-<slug>, feature/<TEAM>-<NUM>. If a match is found, fetch the issue and all its comments via the linear-cli skill (/linear-cli). If no ID is detected, record Linear: not found.gh pr view --json number,title,body,comments,reviews. If a PR exists, capture body, review comments, and conversation comments. If none, record PR: none.devsql. For each changed file, run a query similar to:
SELECT t.session_id, datetime(t.timestamp/1000, 'unixepoch') AS ts, t.text
FROM transcripts t
WHERE t.project LIKE '%<basename of cwd>%'
AND (t.tool_use LIKE '%<file path>%' OR t.text LIKE '%<file basename>%')
ORDER BY t.timestamp DESC
LIMIT 20;
Cap total at ~80 rows across all files. If devsql is unavailable, record Past sessions: devsql unavailable and continue — do not fail the task./tmp/quality-gate-context-bundle.md with this structure:
## Linear
<issue id, title, status, body, comments — or "not found">
## PR
<number, title, body, review comments, conversation comments — or "none">
## Past Claude Code sessions (per file)
### <file/path.ts>
- <ts> session <id…>: <one-line excerpt of the prompt or tool_use that touched this file>
- …
Quote verbatim where possible — Step 3.5 needs textual citations.lead via SendMessage and mark the task completed via TaskUpdate.Spawn all teammates in a single response using the Task tool with team_name: "quality-gate" and each teammate's name:
| name | Assigned task |
|---|---|
react-reviewer | Task 1 (skip if not React) |
solid-reviewer | Task 2 |
security-reviewer | Task 3 |
simplify-reviewer | Task 4 |
slop-cleaner | Task 5 |
context-fetcher | Task 6 |
Each teammate's prompt must instruct them to:
TaskList and claim their assigned task via TaskUpdate with status: "in_progress" and owner: "<their-name>"Skill tool with the review instructions/tmp/quality-gate-findings-<their-name>.md using the Write tool (e.g. /tmp/quality-gate-findings-solid-reviewer.md)SendMessage with type: "message", recipient: "lead", and summary: "<reviewer-name> done — findings written to /tmp/quality-gate-findings-<their-name>.md"TaskUpdate with status: "completed"After spawning, assign each task to its teammate via TaskUpdate with owner: "<teammate-name>".
FIX (will be auto-applied):
NITPICK (user decides):
## FIX
- `file/path.ts:42` — [RULE-ID] Description of the issue. Suggested fix: <concrete suggestion>
- `file/path.ts:85` — [RULE-ID] Description. Suggested fix: <suggestion>
## NITPICK
- `file/path.ts:15` — [RULE-ID] Description. Suggestion: <suggestion>
## NO ISSUES
(use this section if nothing found in a category)
If no issues at all, return: No issues found.
Monitor TaskList until all review tasks reach completed status. Once all tasks are completed, read findings from each reviewer's output file using the Read tool:
/tmp/quality-gate-findings-solid-reviewer.md/tmp/quality-gate-findings-security-reviewer.md/tmp/quality-gate-findings-simplify-reviewer.md/tmp/quality-gate-findings-slop-cleaner.md/tmp/quality-gate-findings-react-reviewer.md (if spawned)/tmp/quality-gate-context-bundle.md (from context-fetcher — consumed in Step 3.5)Do NOT rely on SendMessage content for findings — those are "done" pings only. The files are the source of truth.
Send SendMessage with type: "shutdown_request" to each teammate. After all teammates confirm shutdown, call TeamDelete. Do not delete temp files yet — Step 3.5 reads /tmp/quality-gate-context-bundle.md. Cleanup happens at the end of Step 3.5.
file:lineOnce the final FIX list is settled (after Step 3d if needed), display the summary:
### Quality Gate Results
**Fixes to auto-apply:** N items
- [React] file:line — description (x items)
- [SOLID] file:line — description (x items)
- [Security] file:line — description (x items)
- [Simplify] file:line — description (x items)
- [Slop Cleaner] file:line — description (x items)
**Conflicts arbitrated:** N items ← include only if Step 3d ran
**Nitpicks for review:** N items
Skip this step entirely if Step 3c found zero conflicts.
Spawn a single standalone arbitrator via the Agent tool (NOT part of the team):
general-purposeArbitrate FIX conflictsfile:line with the competing FIX items from different reviewers, including the reviewer name and their suggested fixfile:line, winner: <reviewer-name>, chosen_fix: <verbatim fix>, reason: <one sentence>. Optionally, if two fixes are compatible and can be merged, return merged instead with the combined editMerge the arbitrator's winning fixes back into the FIX list (replacing the conflict groups). Non-conflicted FIX items pass through unchanged. Record the count for the summary line **Conflicts arbitrated:** N.
Goal: catch FIX items that would undo a deliberate decision documented in Linear, the PR, or past Claude Code sessions. Runs after consolidation/arbitration, before auto-apply.
Skip this step only if the FIX list is empty AND there are zero nitpicks worth checking (in practice: skip iff the consolidated FIX list is empty).
Spawn a single standalone context-checker via the Agent tool (NOT part of the team):
general-purposeCheck FIX list against historical contextfile:line, reviewer, rule id, description, suggested fix/tmp/quality-gate-context-bundle.mdUNCERTAIN the same as CONFLICT. Only OK allows the FIX to be auto-applied. Confidence threshold for OK is ≥ 80%.file:line, verdict: OK | CONFLICT | UNCERTAIN, source: <linear|pr|session|none>, citation: "<verbatim excerpt from bundle, ≤ 240 chars>" (omit if OK), reason: <one sentence>Process the verdicts:
HISTORICAL_CONFLICTS with their citation and source. They will be displayed at the head of the nitpick section in Step 5 — they are NOT auto-applied.Update the Step 3c summary block accordingly:
### Quality Gate Results
**Fixes to auto-apply:** N items
- [React] file:line — description (x items)
- [SOLID] file:line — description (x items)
- ...
**Conflicts arbitrated:** N items ← include only if Step 3d ran
**Historical conflicts (rerouted to nitpicks):** N items ← include only if Step 3.5 found any
**Nitpicks for review:** N items
After the checker returns, clean up temp files:
rm -f /tmp/quality-gate-findings-*.md /tmp/quality-gate-context-bundle.md
Apply all FIX items to the codebase:
If there are nitpicks OR historical conflicts, display them and use AskUserQuestion. Render the historical-conflicts section FIRST (header position) so it is impossible to miss:
### Nitpicks for your review
#### ⚠️ Conflicts with past decisions (rerouted from FIX)
These FIX items were demoted because the historical context suggests the code was written this way on purpose. Review the citation before applying.
- `file:line` — [reviewer/RULE-ID] description
- Suggested fix: <suggestion>
- Source: <linear|pr|session> — <reason>
- Citation: "<verbatim excerpt>"
#### React/Next.js
- `file:line` — description — suggestion
#### SOLID
- `file:line` — description — suggestion
#### Security
- `file:line` — description — suggestion
#### Simplification
- `file:line` — description — suggestion
#### Slop Cleaner
- `file:line` — description — suggestion
Omit the ⚠️ Conflicts with past decisions block if Step 3.5 found none. Omit any reviewer subsection that has no items.
Ask: "Which nitpicks should I apply?" with options:
Apply whichever nitpicks the user selected.
Run this step only if any changes were applied in Step 4 or Step 6. Skip it if no fixes and no nitpicks were applied.
Spawn a single standalone validator via the Agent tool (NOT part of the team):
general-purposeValidate post-fix diffgit diff <base>...HEAD (the full branch diff, including the applied fixes and nitpicks)APPROVED on the first line, nothing else requiredISSUES_FOUND: on the first line, followed by a bulleted list of - file:line — problem descriptionIf the validator returns APPROVED: proceed to Step 8.
If the validator returns ISSUES_FOUND: display the issue list and git diff --stat, then use AskUserQuestion with:
git restore . to discard all applied fixes and nitpicks, then abort the skill and report which validator issues were flaggedIf any changes were applied (fixes or nitpicks) and validation passed or the user chose to proceed:
git add .
git commit -m "refactor: apply quality gate fixes"
If a remote branch exists and the branch was already pushed:
git push
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 environment variable in settingscontext-fetcher) + up to 3 sequential standalone specialists (conflict-arbitrator conditional, context-checker whenever the FIX list is non-empty, post-fix-validator whenever changes were applied)conflict-arbitrator, context-checker, post-fix-validator) are spawned via the Agent tool and are NOT part of the quality-gate team — no TeamCreate/TeamDelete coupling, no shared TaskListUNCERTAIN is treated as CONFLICT, both reroute to the historical-conflicts nitpick section. Never auto-apply a non-OK verdict.transcripts/history)TeamCreate at Step 2a, TeamDelete at Step 3bfile:line) route to Step 3d; conflicts with prior intent route to Step 3.5Harness-portable quality gate for branch changes — spawns parallel reviewer subagents (Bug, SOLID, Security, Simplify+Slop, optionally React/a11y/i18n/migration) with tier-scaled adversarial verify, CLAUDE.md/ADR enforcement, and a stable PASS / PASS WITH NOTES / FAIL verdict. Read-only. Runs on any harness with a subagent primitive (Claude Code, Codex) — no Workflow tool, no agent teams.
This skill should be used when reviewing someone else's pull request and you want to turn gate / gate-wf findings into posted GitHub comments — each comment drafted through humanizer and posted as a standalone inline comment at its file:line, after one confirmation. Triggers on "post these as review comments", "comment the gate findings on the PR", "draft and post my review", "leave review comments", after a gate / gate-wf run on a PR you're reviewing.
Babysit your open PRs on a loop. Each tick scans your PRs for new reviews, bot comments, and CI, triages via /pr-feedback, batches clear nits through /pr-respond, and PushNotifications on APPROVE or a merge-ready PR. Triggers on "babysit my PRs", "surveille mes PRs", "watch my open PRs".
This skill should be used when the user wants to triage a pull request's review feedback and CI status — retrieving inline review comments, review summaries, conversation comments, and failing status checks, then classifying each item as P1 / P2 / Nit and proposing an ordered action plan. Triggers on "review PR feedback", "check PR comments", "what's blocking my PR", "classify review comments", "PR CI failures", "triage PR", or a bare PR number/URL.
Execute a qa-plan interactively. The plan can live locally (qa-plan-X.md) or remotely on Linear (sub-issue created by /qa-plan --linear). Walks through each scenario with the user, logs status + findings + notes to a fresh timestamped qa-results-<ts>.md per run (multiple coexist in the task folder). When the source is Linear, mirrors findings and the final summary as comments on the sub-issue. Each run re-verifies every scenario and surfaces prior runs' open findings so you confirm whether known bugs are fixed. Verification stays browser-only (admin UI + email sandbox); no terminal/DB/GraphQL is used to confirm a pass. A dev runner may read the source to root-cause a failure and cite file:line in the finding. This skill should be used to run a manual QA pass against a plan produced by /qa-plan, whether the runner is the dev (dogfooding before handoff) or the PM/QA tester.
This skill should be used when the user wants to find AI-generated code slop — unnecessary comments, defensive checks, `any` casts, and style inconsistencies — in a branch's changes. Produces suggestions only; does not apply edits.