method-review
Reviews data-science code changes with statistical, methods, PHI, and engineering personas and confidence-gated findings. Use when the user asks for code or PR review.
- License 许可
- MIT
- 最近更新
- 2026-11-01
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- method-review
- description
- Reviews data-science code changes with statistical, methods, PHI, and engineering personas and confidence-gated findings. Use when the user asks for code or PR review.
- argument-hint
- [mode:agent] [blank to review current branch, or provide PR link]
02 资源文件 71
- 参考文档references/amstar-2-checklist.md11.9 KB
- 参考文档references/arrive-checklist.md15.5 KB
- 参考文档references/bulk-preview.md6.3 KB
- 参考文档references/care-checklist.md9.0 KB
- 参考文档references/charms-checklist.md17.9 KB
- 参考文档references/chart-checklist.md7.0 KB
- 参考文档references/cheers-checklist.md16.2 KB
- 参考文档references/claim-checklist.md18.9 KB
- 参考文档references/consort-adaptive-checklist.md14.7 KB
- 参考文档references/consort-ai-checklist.md8.1 KB
- 参考文档references/consort-checklist.md19.1 KB
- 参考文档references/consort-cluster-checklist.md10.8 KB
- 参考文档references/consort-nof1-checklist.md13.1 KB
- 参考文档references/consort-outcomes-checklist.md8.2 KB
- 参考文档references/coreq-checklist.md15.2 KB
- 参考文档references/deal-checklist.md13.5 KB
- 参考文档references/decide-ai-checklist.md5.5 KB
- 参考文档references/diff-scope.md1.8 KB
- 参考文档references/dispatch-reviewers.md5.8 KB
- 参考文档references/evidence-access.md3.5 KB
- 参考文档references/findings-schema.json9.7 KB
- 参考文档references/gramms-checklist.md5.1 KB
- 参考文档references/guideline-registry.yaml39.5 KB
- 参考文档references/guideline-routing.md20.3 KB
- 参考文档references/intent-and-plan.md3.6 KB
- 参考文档references/merge-findings.md14.1 KB
- 参考文档references/mi-claim-checklist.md3.7 KB
- 参考文档references/pdsqi-checklist.md3.5 KB
- 参考文档references/persona-catalog.md5.4 KB
- 参考文档references/post-review.md22.0 KB
- 参考文档references/prisma-checklist.md18.1 KB
- 参考文档references/prisma-dta-checklist.md12.4 KB
- 参考文档references/prisma-ipd-checklist.md16.5 KB
- 参考文档references/prisma-nma-checklist.md14.4 KB
- 参考文档references/prisma-p-checklist.md4.0 KB
- 参考文档references/prisma-s-checklist.md6.7 KB
- 参考文档references/prisma-scr-checklist.md15.8 KB
- 参考文档references/probast-ai-checklist.md9.9 KB
- 参考文档references/quadas-3-checklist.md10.3 KB
- 参考文档references/record-checklist.md7.8 KB
- 参考文档references/record-pe-checklist.md7.3 KB
- 参考文档references/reforms-checklist.md10.8 KB
- 脚本references/resolve-base.sh4.2 KB
- 参考文档references/review-output-template.md7.3 KB
- 参考文档references/right-checklist.md11.9 KB
- 参考文档references/rob2-checklist.md16.4 KB
- 参考文档references/robins-i-checklist.md13.5 KB
- 参考文档references/scope.md13.7 KB
- 参考文档references/select-reviewers.md9.9 KB
- 参考文档references/spirit-ai-checklist.md7.9 KB
- 参考文档references/spirit-checklist.md11.4 KB
- 参考文档references/spirit-outcomes-checklist.md4.8 KB
- 参考文档references/squire-checklist.md12.4 KB
- 参考文档references/srqr-checklist.md9.0 KB
- 参考文档references/stard-ai-checklist.md12.6 KB
- 参考文档references/stard-checklist.md12.3 KB
- 参考文档references/start-rwe-checklist.md11.1 KB
- 参考文档references/strega-checklist.md7.3 KB
- 参考文档references/strobe-checklist.md14.7 KB
- 参考文档references/strobe-mr-checklist.md12.7 KB
- 参考文档references/study-metadata-schema.md7.0 KB
- 参考文档references/subagent-template-variables.md1.1 KB
- 参考文档references/subagent-template.md23.4 KB
- 参考文档references/synthesis-and-output.md8.9 KB
- 参考文档references/target-checklist.md11.1 KB
- 参考文档references/tidier-checklist.md6.3 KB
- 参考文档references/tracker-defer.md13.1 KB
- 参考文档references/tripod-ai-checklist.md23.3 KB
- 参考文档references/tripod-llm-checklist.md8.2 KB
- 参考文档references/validator-template.md4.9 KB
- 参考文档references/walkthrough.md20.3 KB
03 SKILL.md 正文
Code Review
Skill Value
- Problem it solves: Data science code review needs correctness, testing, reproducibility, SAP drift, PHI, methods, and platform checks in one pass.
- Use when: The user asks for code review, PR review, review before merge, or fixable findings on current changes.
- Output: Prioritized P0-P3 findings, applied safe fixes when allowed, residual work, and verification summary.
- Ask only if: Only in interactive mode when a routing decision materially changes whether to apply, defer, file, or ignore findings.
- Do not do: Do not invent findings without evidence, mutate in report-only mode, or merge/push without explicit workflow routing.
- Interaction: Check repo/config/chat evidence first. Ask one decision-changing question at a time; use the current harness's blocking question UI when available, otherwise present numbered choices and wait.
Mode Detection and Arguments
Strip recognized tokens from $ARGUMENTS; the remainder is the PR number, GitHub URL, or branch name.
| Token | Mode or effect |
|---|---|
| (none) | Interactive (default): review, apply safe_auto fixes, present findings, ask policy decisions on gated/manual findings (once per decision point, via the Skill Value interaction rule), optionally continue to fix/push/PR |
mode:agent |
Agent: read-only JSON handoff, also written to review.json |
mode:autofix |
Autofix: safe_auto fixes with bounded re-review rounds; run artifact with residual work |
mode:report-only |
Report-only: read-only; report and stop |
mode:headless |
Headless (skill-to-skill): single-pass safe_auto fixes, structured text output, run artifact, ends with "Review complete". mode:non-interactive is its alias; normalize before conflict checks (both together are one mode) |
depth:auto / depth:full |
Default risk-aware roster (trivial low-risk code-only diffs may use the lite roster) / force the complete roster. They conflict only with each other |
base:<sha-or-ref> |
Skip scope detection; use this diff base directly |
plan:<path> |
Load this plan for requirements verification |
Conflicting mode flags: If multiple distinct mode tokens appear, stop without dispatching agents. In mode:agent, emit {"status":"failed","reason":"conflicting mode flags"}. If mode:headless is one of them, emit Review failed (headless mode). Reason: conflicting mode flags — <mode_a> and <mode_b> cannot be combined. Otherwise emit the generic form: Review failed. Reason: conflicting mode flags — <mode_a> and <mode_b> cannot be combined.
Blinding-state awareness
Resolve the repository root before reading config:
!git rev-parse --show-toplevel 2>/dev/null || true
Read <repo-root>/.methodsmith/config.local.yaml with the native file-read tool (resolve the root at runtime if the line above is empty; in a linked worktree, fall back to the main checkout). When stack_profile.blinding_state is blinded, the diff is blinded EDA: skip method-methods-reviewer and method-multiplicity-reviewer, and emit a P0 finding "Inferential code on assignment variable during blinded EDA" if the diff runs regression, hypothesis-test, survival, or chi-square code on the assignment/treatment/arm variable.
Non-interactive mode rules
These hold from Stage 1 on in agent, autofix, report-only, and headless modes; full per-mode policy is in references/post-review.md Step 2.
- Skip all user questions. Infer scope and intent conservatively from arguments, Git metadata, the diff, and caller context; record uncertainty in the output.
- Headless requires a determinable diff scope. Otherwise emit
Review failed (headless mode). Reason: no diff scope detected. Re-invoke with a branch name, PR number, or base:<ref>.and stop without dispatching agents. - Mutation limits. Agent and report-only modes never edit, fix, file tickets, or take PR actions (report-only also writes no artifacts). Autofix and headless apply only
safe_auto -> review-fixerfixes, never file tickets, and never run alongside other mutating work on a shared checkout. No mode here commits, pushes, or creates a PR.
Quick Review Short-Circuit
Interactive only: when the user asks for a quick, fast, or light review, announce the chosen path (Quick review vs Multi-agent review), then run the harness's built-in code review on any remaining target (Claude Code: /review [target]). Without one, continue here. Programmatic modes never short-circuit or announce.
Severity Scale
- P0: critical breakage, exploitable vulnerability, data loss/corruption. Must fix before merge.
- P1: high-impact defect likely hit in normal usage, breaking contract. Should fix.
- P2: moderate downside (edge case, perf regression, maintainability trap). Fix if straightforward.
- P3: low-impact, narrow scope, minor improvement. User's discretion.
Routing (autofix_class, owner) is defined in references/merge-findings.md; only safe_auto -> review-fixer findings reach the in-skill fixer.
Protected Artifacts
Discard any finding that recommends deleting, removing, or gitignoring these pipeline artifacts: docs/brainstorms/*, docs/plans/*.md, docs/solutions/*.md, and analysis/model-strategy/* (including analysis/model-strategy/*-model-strategy.md memos and their scaffolds).
Evidence access
Reviewers citing a guideline item or methods paper read references/evidence-access.md. Look up here: reporting-guideline statements and methods references reviewers cite.
PHI Safety Boundary
These rules govern every stage, sub-agent prompt, and artifact.
PHI-safe scope preflight. Before any command prints a path name, diff body, file content, notebook output, PR title, or PR body, complete in order:
- Classify the context from already-available signals: the stack profile and CLIF signals (
__CE_CLIF__ active=truein chat context,CLIF_CLAUDE.mdat the root, or a git remote containing clif-icu, clif-consortium, or Common-Longitudinal-ICU-data-Format). Clinical, health-data, case-report, CLIF, or otherwise uncertain contexts are PHI-risk before path discovery. - Capture paths privately. For a clearly non-clinical context, write changed and untracked path names under
$REVIEW_SCOPE_DIR(references/scope.md) without echoing them. Never print a raw basename before this decision because a filename can itself contain an identifier. - Run a deterministic risk check that returns only a risk boolean, counts, and extensions. Treat data files, codebooks, notebooks, manuscripts, figures, clinical notes, imaging, patient/MRN/case-like names, and any unclassified text file in a PHI-risk repository as PHI-risk. If local classification cannot establish a clearly non-PHI scope, treat it as PHI-risk.
- Resolve the authorization marker when PHI risk is present. Sensitive-data boundary. Resolve
phi_environment.modein.methodsmith/config.local.yaml(worktree, then main checkout; legacycompliant: true=approved,compliant: false=schema-only,sensitive_data: false=no-sensitive-data; any schema-only signal wins; unreadable =schema-only).approvedorno-sensitive-data: proceed silently and never mention the boundary again.schema-only: headings, types, counts, and aggregates only; never open, print, or paste data values; run data-reading scripts asmethod-safe-run -- <command>(path in the guard's deny message); save results as aggregate tables (counts under 11 suppressed) inoutput/or aphi_environment.aggregate_dirsentry. Unset, interactive: ask once with the blocking question tool (else a numbered list) offeringApproved endpoint: full access,Not approved or unsure: schema-only, andNo sensitive data: public or synthetic; save the answer asphi_environment.modethere oncegit check-ignore -q .methodsmith/config.local.yamlpasses (else first add.methodsmith/*.local.yamlto.gitignore) so the guard hook sees it. Unset, headless: schema-only. Record exactlyPHI authorization: confirmedforapprovedorno-sensitive-data, andPHI authorization: not confirmedforschema-only.
- With confirmed authorization, reviewers have no content limits; any reviewer that reads PHI-risk content must inherit the active session model with no model override.
- Without it, do not run a broad content diff or open PHI-risk files; scope to path names, metadata, and files established as code, schemas, or reviewed aggregates, and report excluded content as a coverage gap.
When no PHI risk is present, continue normally without asking.
Safe display metadata. After preflight, set SAFE_BRANCH and other display metadata to their raw values only when each value is established as PHI-free. Otherwise use an opaque label such as [redacted-phi-risk-branch]. All prompts, reports, and persistent run artifacts use the safe values; raw metadata never leaves $REVIEW_SCOPE_DIR.
Reviewer access. Pass method-phi-leak-reviewer the marker from Stage 1. With PHI authorization: confirmed, no reviewer has content limits. Without it: General
reviewer sub-agents may inspect only the preflight-approved paths and PHI-free orchestrator context, and their prompts must prohibit broad
checkout-reading commands (git diff, git show, git blame, git log, gh pr view); method-phi-leak-reviewer gets paths, code, schemas, metadata, and reviewed aggregates; Stage 5b validators inherit these limits.
How to Run
Run the stages in order, reading each stage's references on entry.
Stage 1: Determine scope
Read references/scope.md and follow its path for the invocation (base:, PR, branch, or standalone; the last two run references/resolve-base.sh). It captures path names privately in $REVIEW_SCOPE_DIR, never printing them.
- If
mode:agent,mode:report-only, ormode:headlessis active, do not rungh pr checkoutorgit checkout <branch>on the shared checkout; unless already in an isolated checkout/worktree, emit that mode's stop message fromreferences/scope.md. - Apply the PHI-safe scope preflight before reading any captured path, title, or body; then collect
git diff -U10 $BASEonly for the permitted paths. - Fail closed: when the base cannot be resolved, stop instead of falling back to
git diff HEAD.
Stage 2: Intent and plan discovery
Read references/intent-and-plan.md: write the reviewer intent summary (one intent question only in interactive mode) and locate a plan tagged plan_source: explicit or inferred. A missing plan never blocks the review.
Stage 3: Select reviewers
Read references/select-reviewers.md (authoritative roster, standards mapping, fail-closed lite-roster gate) and references/persona-catalog.md (reviewer focus). Pass reviewers the resolved skill-local paths the roster names: references/study-metadata-schema.md, references/guideline-registry.yaml, references/guideline-routing.md, and the selected checklist files. Announce the team; do not wait for confirmation.
Stage 4: Spawn sub-agents
Read references/dispatch-reviewers.md, references/subagent-template.md (slot sources in references/subagent-template-variables.md), references/diff-scope.md, and references/findings-schema.json. Dispatch every selected reviewer in parallel with the platform's sub-agent primitive (Agent/Task in Claude Code, spawn_agent in Codex), or sequentially if parallel dispatch is unsupported. Omit the mode parameter. Reviewers are read-only; their only permitted write is their artifact under /tmp/methodsmith/method-review/<run-id>/.
Stage 5: Merge findings
Read references/merge-findings.md (Action Routing and Stage 5): validate, deduplicate, promote agreement, route conservatively, demote, then suppress findings below anchor 75 except P0 findings at anchor 50+, and partition into fixer, residual actionable, and report-only queues.
Stage 5b: Validation pass
Run one independent validator per surviving finding (budget: 15) using references/merge-findings.md (Stage 5b) and references/validator-template.md, only where this table says so:
| Mode | Runs Stage 5b? | Where |
|---|---|---|
agent |
Yes, eagerly and read-only | Before Stage 6 |
headless |
Yes, eagerly | Before Stage 6 |
autofix |
Yes, eagerly | Before Stage 6 |
interactive, walk-through routing (option A) — per-finding phase |
No -- the user is the per-finding validator | n/a |
interactive, walk-through routing (option A) — best-judgment-the-rest handoff |
No -- the fixer's outcome validates | n/a |
interactive, best-judgment routing (option B) |
No -- the fixer's outcome validates | n/a |
interactive, File-tickets routing (option C) |
Yes, on all pending findings | Before tracker dispatch |
interactive, Report-only routing (option D) |
No -- nothing is being externalized | n/a |
report-only |
No -- read-only mode externalizes nothing | n/a |
Stage 6: Synthesize and present
Read references/synthesis-and-output.md and references/review-output-template.md, apply their quality gates, and render: pipe-delimited severity tables (interactive, autofix, report-only), the structured text envelope (headless), or only the JSON contract below (mode:agent). No time estimates.
JSON output format (mode:agent only)
Emit one raw JSON object as the entire response, without a markdown fence or trailing prose. Write the identical payload to /tmp/methodsmith/method-review/<run-id>/review.json.
Minimum shape:
{
"status": "complete",
"verdict": "Ready to merge | Ready with fixes | Not ready",
"scope": {"base": "<merge-base sha, pr:NNN marker, or base ref>", "branch": "<SAFE_BRANCH>",
"head_sha": "<git rev-parse HEAD>", "pr_url": null, "files_changed": 0},
"intent": "<summary>",
"intent_confidence": "explicit | inferred | uncertain",
"reviewers": [], "findings": [], "actionable_findings": [], "pre_existing_findings": [],
"requirements_completeness": null, "learnings": [], "deployment_notes": [],
"residual_risks": [], "testing_gaps": [], "coverage": {},
"artifact_path": "/tmp/methodsmith/method-review/<run-id>/",
"run_id": "<run-id>"
}
Each findings object carries stable #, title, severity, file, line, confidence, autofix_class, owner, requires_verification, pre_existing, suggested_fix, why_it_matters, evidence, and reviewers. actionable_findings is the gated_auto or manual subset owned by downstream-resolver. Agent mode never includes applied fixes because it never mutates. On failure return {"status":"failed","reason":"<one sentence>"}; use degraded when all reviewers fail and skipped when a review skip rule fires.
After Review
- Interactive, autofix, and headless modes: read
references/post-review.mdand follow Steps 1-5. Interactive routing also reads, when each path is taken,references/tracker-defer.md(tracker pre-detection, option C, and Defer),references/walkthrough.md(option A and the unified completion report), andreferences/bulk-preview.md(option C preview). - Agent mode: perform no fixes, tickets, commits, pushes, PRs, or checkout switches. Write
review.jsonplus the Step 4 run artifact fromreferences/post-review.md(synthesized findings andmetadata.jsonwithSAFE_BRANCH), then emit nothing after the single JSON object. - Report-only mode: stop after Stage 6. Do not write run artifacts.
Never commit, push, or create a PR outside interactive mode's Step 5, and only after fixes were applied in this run.
04 同仓库更多 Skills
skill-one
Sample skill
disabled-skill
A skill with model invocation disabled
claude-only-skill
A skill restricted to Claude Code only
default-skill
暂无简介
custom-skill
暂无简介
method-write
Drafts, revises, and audits evidence-bound manuscripts, sections, abstracts, and reviewer responses with claim provenance. Use when scientific prose must be written or revised (entry point).