Use when iteratively improving a draft until it meets a review target
From second-claude-codenpx claudepluginhub unclejobs-ai/second-claude-code --plugin second-claude-codeThis skill uses the workspace's default tool permissions.
gotchas.mdDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
A fix without a review is not a fix.
Run review-fix cycles until a draft meets a target score or verdict, with resumable state on disk.
--dod is provided, parse the semicolon-separated string into a numbered criteria list and store in state as dod_criteria./second-claude-code:review — this MUST dispatch actual subagents per the review skill spec. Do NOT simulate review inline or merge reviewer perspectives into one pass. When --dod is active, inject the following block into each reviewer's context alongside any --promise text:
## DoD Checklist — evaluate each criterion independently
1. [criterion text]
2. [criterion text]
...
For EACH criterion, append a line: `DoD-N: PASS` or `DoD-N: FAIL — <reason>`
After reviewers return, extract DoD-N: PASS/FAIL lines and compute per-criterion consensus (majority across reviewers). Store results in state dod_results.--dod is active, prioritize FAIL DoD criteria first (up to 3 total including general feedback). If all DoD criteria already pass, fall back to the standard top-3 general feedback./second-claude-code:review (with DoD checklist re-injected) and keep the new baseline only if the verdict improves; otherwise revert. If mmbridge was used in the original review, run mmbridge resume before dispatching the full re-review to get the external reviewer's preliminary assessment of fixes (see MMBridge Refinement Enhancement below). Revert strategy:
git diff --name-only <file>. If the file shows uncommitted user changes that are NOT from this refine iteration (i.e., changes that predate baseline_hash), warn the user and abort the revert unless they explicitly confirm. Never silently overwrite uncommitted work.../ traversal or resolving outside the working directory.git checkout -- <file>.${CLAUDE_PLUGIN_DATA}): restore from baseline_content in refine-active.json.--max is reached, or the verdict plateaus (same verdict for 2 consecutive iterations with no severity reduction). When --dod is active, the target is only considered met when all DoD criteria pass AND the score/verdict target is satisfied./second-claude-code:review with --preset quick (a parameter passed to /scc:review, not a refine option) one final time (with DoD checklist if active). Only exit on APPROVED or MINOR FIXES and all DoD criteria PASS. If it returns MUST FIX or NEEDS IMPROVEMENT, or any DoD criterion is FAIL, continue refining.| Flag | Values | Default |
|---|---|---|
--max | 1-10 | 3 |
--target | score (e.g., 4.5) or verdict (e.g., APPROVED) | APPROVED |
--promise | text injected into each reviewer's context as a constraint | none |
--dod | semicolon-separated success criteria checklist (e.g. "no factual errors; every section has examples") | none |
--file | path to the draft to iterate on | required |
--review | path to initial review report (skips first review cycle) | none |
When called from a pipeline with input_from, the first file is the draft (--file) and the second (if present) is the initial review report (--review).
Data directory:
${CLAUDE_PLUGIN_DATA}is set by the plugin system. If unavailable, fall back to.data/relative to the plugin root. Before writing state files, verify the directory exists withmkdir -p.
Save active state to ${CLAUDE_PLUGIN_DATA}/state/refine-active.json with:
{"goal":"...","file":"...","current_iteration":2,"max":3,"verdicts":["NEEDS IMPROVEMENT","APPROVED"],"scores":[],"baseline_hash":"...","baseline_content":null,"is_git_tracked":true,"feedback_log":[],"dod_criteria":["no factual errors","every section has examples"],"dod_results":[[true,false],[true,true]]}
dod_criteria: array of criterion strings parsed from --dod. Empty array when --dod is not used.
dod_results: array of arrays — one boolean array per iteration, positionally matching dod_criteria. true = PASS (majority of reviewers agreed), false = FAIL.
baseline_content: stores the full file content when is_git_tracked is false (non-git files cannot be reverted via git checkout)
is_git_tracked: set at step 1 by running git ls-files --error-unmatch <file>. Determines the revert strategy.
When mmbridge is detected (see references/mmbridge-integration.md) and the previous review cycle used --external, the refine skill can leverage mmbridge's session continuity for smarter iterations.
When a review finding is ambiguous or the editor needs more context before fixing:
mmbridge followup --tool kimi --prompt "<specific question about a finding>" --latest --json > /tmp/mmbridge-followup-${RUN_ID}.json
--latest: reuses the most recent review session for this projectAfter the editor applies fixes (Step 3), before dispatching a full internal re-review (Step 4):
mmbridge resume --action followup -y --json > /tmp/mmbridge-resume-${RUN_ID}.json
/scc:review cycle[external: mmbridge]) lacks actionable detail--external, or if mmbridge is not installedFollowup and resume reuse existing mmbridge sessions — they are cheaper than dispatching a full new review.
Return the final draft plus an iteration log showing verdict progression and major changes. When --dod is active, append DoD status per iteration:
Round 0 (baseline): 2.0/5 ||||.............. MUST FIX
DoD: [x] no factual errors [ ] every section has examples
Round 1 (post-edit): 3.8/5 |||||||||||||||... MINOR FIXES (+1.8)
DoD: [x] no factual errors [x] every section has examples ✓ ALL PASS
git checkout -- <file> for git-tracked files, or restore from baseline_content for non-git files. Never rely on memory alone. Always check git diff --name-only <file> before reverting — abort with a warning if uncommitted user changes are detected outside this refine pass's own edits.../ or resolves outside the project root./second-claude-code:review./second-claude-code:review --preset quick check.reviewer: { skill: /second-claude-code:review, constraint: "return score plus ranked feedback" }
editor: { model: opus, tools: [Read, Edit], constraint: "apply only the top 3 feedback items" }