/jiachen:pr-review-tuningfrom Jiachen's MCode Stack
Tunes the MCode Review bot on GitHub or GitLab by measuring recent PRs, finding noise and misses, proposing up to three rule changes, backtesting on past PRs, and requiring human approval before changes take effect.
Ships in Jiachen's MCode Stack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The loop a team runs on its own review bot once a week: measure it on recent PRs, find noise and misses, propose at most three rule changes, backtest them on past PRs whose outcome is known, have an independent check recompute the numbers, report, and change rules only after a person approves. On GitLab a PR is a merge request.
The rules serve four goals together:
A change that improves one goal must not clearly worsen another. When it trades one for another, the proposal says so and by how much.
The working directory is .mcode-review-tuning/ in the repository the user runs this from, or a path the user names. It holds PR titles, replies and usernames: ask the user to add it to .gitignore or .git/info/exclude before the first run.
.mcode-review-tuning/
decisions.md decisions in force, dated, newest first
<week>/ the measured ISO week, for example 2026-W02
state.json where this week's run stands (references/scheduling.md)
data/ prs.jsonl and raw/ from collect.mjs; metrics.json and metrics.md
from metrics.mjs; judgments.json with your judgments
proposals/ P1.md to P3.md; candidate rule files in P<n>/; cases.jsonl
and backtest/<arm>/ from backtest.mjs
report.md the weekly report
verify.md the independent check
decisions.md records what people decided and when: the scope (host, project, target branches, time zone), the standing token budget for backtests, who approves, what stays unchanged for now, and the decision on every past proposal. Read it before anything else; it overrides the defaults in this skill. Add an entry only when a person states a decision, with its date. Never infer one.
Node 22 or later, no dependencies. Run them from this skill's directory, or with full paths.
node scripts/collect.mjs --host github|gitlab --project <owner/name or group/name> --since <iso> --until <iso> --out <dir> [--api-url <url>]
node scripts/metrics.mjs --in <dir>/prs.jsonl [--previous <old-dir>/metrics.json] --out <dir>
node scripts/backtest.mjs --host github|gitlab --project <...> --repo <local clone> --cases <cases.jsonl> --plugin <stack dir> [--profile <candidate .mcode-review.json>] [--notes <candidate .mcode-review.md>] [--lang en|zh] --budget <tokens> --out <dir>
collect.mjs reads the PRs of the window, the bot's summary state and its threads, with GET requests and GraphQL queries only, and writes <dir>/prs.jsonl (one record per PR) and the raw answers in <dir>/raw/. The token comes from GITHUB_TOKEN or GH_TOKEN on GitHub and GITLAB_TOKEN on GitLab, else from gh auth token or glab auth token. --api-url points at GitHub Enterprise or a self-managed GitLab.metrics.mjs computes the numbers that references/metrics.md defines and writes metrics.json and metrics.md. It also takes --since <iso> --until <iso>, which keep the measurement inside the week, and --sync-branches <regex> for the source branches that stay out of the time to merge.backtest.mjs replays the CI review (prepare, lens, publish as a dry run) on past PRs in isolated clones, with every write to GitHub or GitLab blocked, and stops starting new cases at the token budget. See references/backtest.md.Every run, scheduled or by hand, resumes where <week>/state.json says the week stands (references/scheduling.md).
decisions.md. Without a scope, ask the user for the host, the project, the target branches, the time zone and a standing backtest budget (or none), and record their answers. On a scheduled run, stop and report what is missing instead.references/scheduling.md has the command that prints <week> <since> <until>. Create or read <week>/state.json and follow its re-entry rules.node scripts/collect.mjs --host <host> --project <project> --since <since> --until <until> --out <week>/data.node scripts/metrics.mjs --in <week>/data/prs.jsonl --previous <last-week>/data/metrics.json --out <week>/data --since <since> --until <until>. Leave out --previous when last week has no metrics.json. Read metrics.md.data/raw/, not only the numbers, and name the pattern behind each problem: a question nobody can act on, a checklist item that misfires, risk-area globs that match too much. Judge at least 30 replied threads yourself and report how often the keyword outcome agrees with you. If you change the patterns, measure them again on a fresh sample; the sample you tuned them on cannot measure them.data/judgments.json with a confidence and one line of evidence.decisions.md says to measure only. At most three proposals, ranked, each in proposals/P<n>.md with the measured problem, the change, the expected effect on each of the four goals, the risk, how next week's data will show whether it worked, and how other review tools handle the same problem, with sources read this week. references/proposals.md has the template and says where each kind of change goes.decisions.md and skips the backtest when there is none. See references/backtest.md.references/metrics.md, recomputes at least five headline numbers with a short script of its own (at least two straight from the GitHub or GitLab API, the rest from prs.jsonl; never with collect.mjs or metrics.mjs), re-judges at least ten of your judgments, and writes verify.md with PASS or FAIL per item and every difference. Fix what fails, or take it out of the report and say so.report.md from references/report-template.md in the user's language: conclusion first, verified, inferred and unverified claims kept apart. Reply with the one-line conclusion, the proposals waiting for a decision and the path of the report.Measure only: steps 1 to 6, the independent check and the report, with the baseline numbers and up to three candidate problems ranked for next week. No proposals and no backtest. The baseline is what makes next week's changes readable.
decisions.md..mcode-review.json or .mcode-review.md, with a description written with pr-description. A change to the plugin itself (lens checklists, prompts, limits in code) goes upstream to mcode-stack, or to the team's fork: hand the person the patch, and open the issue or PR only when they ask.decisions.md, and the PR in state.json.Run it as a MiniMax Code scheduled task, a Claude Code scheduled run or plain cron. Every trigger is safe to repeat: it reads state.json, does the next step that is due, and stops. references/scheduling.md has the state file, the re-entry rules (at most two restarts per worker per week, a wait of 20 to 30 minutes after a model gateway error) and the setup for each runner.
collect.mjs only reads, and backtest.mjs blocks every write.references/metrics.md: every number metrics.mjs computes, how, and its caveats.references/proposals.md: what can change where, the proposal template, estimating effects, other tools.references/backtest.md: cases, the token budget, running and judging.references/report-template.md: the weekly report.references/scheduling.md: the week, state.json, re-entry rules, MiniMax Code, Claude Code and cron.references/backtest.md (opens in a new tab)references/metrics.md (opens in a new tab)references/proposals.md (opens in a new tab)references/report-template.md (opens in a new tab)references/scheduling.md (opens in a new tab)scripts/backtest.mjs (opens in a new tab)scripts/collect.mjs (opens in a new tab)scripts/lib/common.mjs (opens in a new tab)scripts/lib/guard.mjs (opens in a new tab)scripts/metrics.mjs (opens in a new tab)scripts/test/backtest.test.mjs (opens in a new tab)scripts/test/collect.test.mjs (opens in a new tab)scripts/test/fixtures/backtest/fake-review.mjs (opens in a new tab)scripts/test/fixtures/metrics/previous-metrics.json (opens in a new tab)scripts/test/fixtures/metrics/prs.jsonl (opens in a new tab)scripts/test/metrics.test.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-review, pr-review, review-bot, rule-tuning, backtesting
npx claudepluginhub minimax-ai/mcode-stack --plugin jiachen7 skills in this plugin
/lifting-loopsFinds loops where the user keeps acting as a manual step for agents (retrying, judging output, approving, carrying context, starting the same task by hand, doing the agent's work) and proposes how to lift the user out: delete a stale rule, change a skill / AGENTS.md / playbook, add a script or metric, add a skill or scheduled task, or advise the user. Keeps a private loop ledger and promotes Claude Code auto-memory into artifacts. With a task already in the session, reflects on that session; in an empty session, scans recent local Claude Code, MiniMax Code, omp, pi and Codex sessions, a claude.ai export and an Obsidian vault. Triggers: /lifting-loops, retro, post-task reflection, "find repeated work", 反思一下, 复盘这次会话, 总结最近的会话, 找找重复劳动, 哪些事可以不用我; the weekly scheduled run; settling a proposal ("accept P-003", 采纳 P-003, 拒绝 P-003)./making-contentContent production in three modes: rewrite, Xiaohongshu (小红书) image post, short video. Rewrite (default): turns an AI-sounding Chinese or mixed Chinese-English draft (post, newsletter, engineering blog, commentary) into the author's restrained style: few emoji, short paragraphs, hedged claims, neutral wording, English terms split by spaces. Triggers: 按我的风格改, 去 AI 味, 润色, 改改这篇, or a vague 帮我改改 when the context is a structured draft. Also for a Xiaohongshu image post from scratch (title, cover, cards, body, hooks); read references/xhs-post.md first. Also turns a document, research, notes or an article into a 60-180 s vertical video (抖音, 小红书, 视频号, B站: real sources, voice-over, captions, cover). Triggers: 做成视频, 做个短视频, 剪个 90 秒版本, 配音, 换成我的声音, or complaints of 字太密, AI 味太重, 容易走神; read references/video-pipeline.md first./pr-descriptionDraft or check a pull request description in a fixed format (background, changes, behavior changes, out of scope, verification, rollback, not done, related) for GitHub or GitLab. Use when opening a PR, when the MCode Review summary reports missing description sections, or when the user asks for a PR description./pr-quizWrite multiple-choice questions that check whether a PR's author understands their change. Use only when the MCode Review pipeline asks for an author quiz./pr-reviewReview a pull request or the current branch with the MCode Review rules (severity, evidence ladder, lens checklists, review principles) and the repository's own .mcode-review.json and .mcode-review.md. Works with GitHub pull requests and GitLab merge requests. Use when the MCode Review CI pipeline starts a review pass, or when a developer asks to review their PR or branch before asking a person to review it./pr-review-ciConnects a GitHub or GitLab repository to the MCode Review CI and keeps the setup current. Use when someone adds MCode Review to a repository on GitHub Actions or GitLab CI, upgrades or rolls back the pinned plugin commit, changes the repository's rule pack, language, models, shadow or enforce phase, author quiz or Feishu card, checks the security setup, or troubleshoots a review run that failed.Other plugins' skills for the same job