merge-request:fix
Monitor an open pull/merge request (by id) and, as feedback arrives, gather every actionable item — human + bot/AI review comments and MR-attributable CI failures — deduplicated against a durable ledger so nothing is handled twice. Polls on an adaptive scheduled-wakeup cadence until the PR/MR closes. First runs /detect-source-control and hard-stops when the forge is unsupported. Use as "watch the PR", "monitor the MR for feedback", "fix review feedback on <id>", or the continuation of /merge-request:create.
- License 许可
- Apache-2.0
- 最近更新
- 2026-07-23
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- merge-request:fix
- description
- Monitor an open pull/merge request (by id) and, as feedback arrives, gather every actionable item — human + bot/AI review comments and MR-attributable CI failures — deduplicated against a durable ledger so nothing is handled twice. Polls on an adaptive scheduled-wakeup cadence until the PR/MR closes. First runs /detect-source-control and hard-stops when the forge is unsupported. Use as "watch the PR", "monitor the MR for feedback", "fix review feedback on <id>", or the continuation of /merge-request:create.
- argument-hint
- <ID> — the PR/MR number to monitor (required)
02 资源文件 4
- 脚本scripts/gather-feedback.sh25.9 KB
- 脚本scripts/reply-resolve.sh8.0 KB
- 脚本tests/gather-feedback_test.sh13.3 KB
- 脚本tests/reply-resolve_test.sh6.8 KB
03 SKILL.md 正文
merge-request:fix
Watch an open PR/MR and keep the review loop moving: on an adaptive interval, gather freshly-arrived feedback (human comments, bot/AI-reviewer comments, and CI failures), deduplicate it against a durable ledger, classify CI failures by attribution, and hand the unseen, actionable items to the triage-and-apply half (fn-10.2). Keep polling via scheduled wakeups until the PR/MR is closed.
This is an assistant-executed skill: you (the assistant) follow the steps
below. The deterministic forge work — fetching comments/threads/CI, computing
stable dedupe keys, diffing against the ## Handled ledger, and writing ledger
records — lives in scripts/gather-feedback.sh. The poll loop itself is your
continuation driven by the harness ScheduleWakeup tool; a script cannot
schedule its own next wake.
Scope note: the monitoring core (fn-10.1) is the
<ID>gate, the wakeup loop, intent reload, feedback gathering + dedupe, CI attribution, and the reported/non-actionable CI write-back (Steps 0–4, 6, 7). The decide-and-apply loop (fn-10.2) — implement criteria, the spec guardrail, test-before-push,Fixed+resolve, and## Declined— is Step 5 below.
Step 0 — require the <ID> argument
/merge-request:fix needs the PR/MR id to monitor. If none was provided,
do nothing beyond a clear message and stop:
/merge-request:fixneeds a PR/MR id to monitor, e.g./merge-request:fix 128. Nothing to do without one. (Run/merge-request:createfirst to open one.)
Never guess an id or pick "the latest" PR/MR — absence of an id means there is nothing for this skill to do.
Step 1 — detect the forge and hard-stop if unsupported
Invoke the shared /detect-source-control skill and capture its stdout block
and exit code. Apply the fn-8 hard-stop contract (see ../../README.md),
exactly as /merge-request:create does:
- Non-zero exit → operational failure (not a git repo,
gitmissing). Stop and report; nothing was changed. - Exit
0andsupported=false→ a successful detection of an unsupported forge. Stop, naming the detectedforge/host. - Exit
0andsupported=true→ proceed. Rememberforge(githuborgitlab) — you pass it togather-feedback.sh.
Never key the unsupported stop off a non-zero exit; forge=unsupported is a
normal exit-0 result.
Step 2 — reload the intent / spec context
Read the shared artifact .data/merge/<ID>.md (written by /merge-request:create).
Its ## Intent block is the author's pre-MR intent, and it survives a resumed
session — load it so your later judgement is anchored to what the change was
for.
- If
## Intentis present (and not the[TODO] Intent not providedplaceholder), use it as the primary intent. - If it is absent or a placeholder, fall back to the change scope: the
flow-next epic when one is discoverable, plus the PR/MR title/body and the
branch diff (
## Change scopeis already stashed in the file). Just make sure you have the best-available intent loaded before acting.
(The full cumulative spec guardrail — Intent + PR/MR body + linked .flow
specs + branch diff, asking on conflict — is assembled in Step 5a before you
decide anything.)
Step 3 — gather feedback and dedupe against the ledger
Run the gather helper for the resolved forge and id:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" gather \
--forge <github|gitlab> --id <ID>
It fetches, for the PR/MR:
- plain issue comments (
kind=comment, non-resolvable), - review threads (
kind=thread;source_idis the resolvable thread id — GitLab discussion id / GitHub review-thread node id — that fn-10.2 resolves), - failing CI jobs (
kind=ci-job),
each carrying a stable id and a dedupe key (content_hash for
thread/comment, fingerprint for ci-job), then diffs them against the
## Handled ledger and prints only the unseen-or-changed items as JSONL,
followed by a machine-readable trailer:
MR_STATE=open|closed|merged|unknown
MR_UPDATED=<iso8601|unknown>
MR_CADENCE=active|idle
MR_POLL_SECONDS=<int>
MR_FETCHED_COUNT=<int>
MR_ACTIONABLE_COUNT=<int>
Parse the JSONL lines (each begins with {) as your actionable feedback set, and
the MR_* trailer for the loop. Dedupe is the script's job — never re-fetch or
re-diff by hand. Its guarantees:
- CI failures dedupe on the logical
fingerprint({forge, job name, commit SHA, normalized error signature}) — not the job/pipeline id, which changes on every rerun. A rerun of the same failure is "seen"; a new commit re-surfaces it. - thread/comment dedupe on
source_id+content_hash— the same id with a changed hash (an edited comment or a new reply) counts as changed and comes back for reconsideration. - A standing
pending-userledger record therefore suppresses re-asking that item until its source changes (Step 6).
Step 4 — classify CI failures by attribution (and record the ones you don't act on)
For each kind=ci-job item, decide MR-attributable vs non-actionable before
anything downstream touches it:
- MR-attributable (pass downstream to fn-10.2): the failing test/file is
within — or exercises — the changed files, or the same job passes on the target
branch baseline. Use the item's
job_name/signature/commitplus the logs (pull them viagh/glabwhen you need more than the signature) to judge. - Non-actionable (do not fix): network/timeout, runner/image/cache/setup failures, failures pre-existing on the target branch, and flaky/known-intermittent jobs. Report these (surface them to the user) but never auto-fix them.
- Ambiguous attribution → treat as pending-user (Step 6): report and ask rather than auto-fixing.
fn-10.1 owns the write path for the CI items you do NOT hand downstream.
Immediately after reporting a non-actionable (or reported-ambiguous) CI item,
write its ## Handled record so the next wakeup does not re-report it:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" record \
--id <ID> --kind ci-job --decision <non-actionable|reported> \
--fingerprint <fingerprint-from-the-item> \
--commit <commit-from-the-item> \
--rationale "<why it isn't MR-attributable>"
The --fingerprint must be the item's own fingerprint (that is the CI
dedupe key). Only the MR-attributable failures go on to Step 5; fn-10.2 writes
their terminal ## Handled records when it implements or declines them.
Step 5 — decide and apply (the fn-10.2 loop)
You now hold the unseen items Step 3/4 handed you: human comments, bot/AI
comments, and MR-attributable CI failures. For each one, decide whether it
warrants a change, implement the worthy ones (tests first), acknowledge +
resolve, record the declined ones, and write a terminal ## Handled record.
Every item you touch here ends with exactly one ## Handled record written
through gather-feedback.sh record — never hand-edit the ledger.
Step 5a — assemble the spec guardrail (cumulative, not a chain)
Before judging anything, load all available guardrail sources and treat them together — none replaces another:
## Intentin.data/merge/<ID>.md(loaded in Step 2) — the author's pre-MR intent.- The PR/MR title and body (
gh pr view <ID>/glab mr view <ID>). - Any linked
.flow/specs/tasks discoverable by id in the branch name, the PR/MR body, or commit messages (e.g.fn-10,fn-10.2) — read the epic/task withflowctl cat <id>when one is discoverable. - The branch diff / commit range
<default>..HEAD(the## Change scopestash already holds this) — it describes scope only.
The diff never overrides a discoverable epic: it tells you what this change
touches, not what the change is allowed to be. When the sources conflict or are
incomplete — or when a feedback item's spec-impact is genuinely ambiguous —
ask the user once and record pending-user (Step 6) rather than guessing.
Step 5b — resolve the repo's published standards
Read the repo's technical standards in this precedence: CLAUDE.md /
AGENTS.md first, then docs/. These are what "consistent with repo
standards" (criterion 2 below) is measured against. Absence of any standard is
not license to invent one — fall back to the surrounding code's conventions.
Step 5c — the three-criteria implement decision
Implement a feedback item only when all three hold:
- It does not change the spec — the change stays inside the Step-5a guardrail (fixes/clarifies the existing scope; never adds or redefines it).
- It is consistent with the repo's published standards (Step 5b).
- It flags a legitimate shortcoming in the MR/PR code (a real bug, gap, or quality issue — not taste/preference, not already-correct code).
Outcomes:
- All three hold → implement (Step 5d), then acknowledge + record (Step 5e).
- Any one fails → decline (Step 5f).
- Spec-impact ambiguous (you cannot tell whether it would change the spec) →
ask once, record
pending-user(Step 6); do not implement or decline yet.
Step 5d — implement, then the test-before-push gate
For each worthy item, make the change following the surrounding code + Step-5b standards. Then, before committing:
- Discover the test command — in this order:
CLAUDE.md/AGENTS.md, package scripts (package.json,pyproject.toml, …), aMakefile/justfiletarget, or the CI config. Run the relevant automated tests for what you changed. - Commit + push only on pass. On a green run, commit the change and push to the PR/MR branch. Capture the commit SHA — you record it in Step 5e.
- No test command found → BLOCKER, not a warning. Stop, tell the user no
automated test command could be found, and do not commit or push without
their explicit approval — never an untested push. Record the item as
pending-userwith rationale"no automated test command found"(via the Step 6 command) so wakeups stop re-processing it until the user answers or the source changes. - Tests fail → the change isn't ready: fix it and re-run, or (if the item can't be satisfied within the guardrail) decline it (Step 5f). Never push red.
Step 5e — acknowledge, resolve, and record an implemented item
Once the change is committed + pushed, post exactly Fixed and resolve the
originating thread through the forge-specific helper:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/reply-resolve.sh" \
--forge <github|gitlab> --id <ID> \
--kind <thread|comment> --source-id <item.source_id>
kind=thread→ it repliesFixedand resolves (GitLab resolve-discussion / GitHubresolveReviewThread). ARESOLVED=0in its output / a non-zero exit means the thread stayed open — surface it.kind=comment→ non-resolvable plain comment: it postsFixedas a general note and reportsRESOLVED=skipped(the documented fallback).kind=ci-jobhas no thread — do not callreply-resolve.sh; the pushed commit is the acknowledgement. Go straight to the ledger record.
Then write the terminal ## Handled record — carrying the item's dedupe key
unchanged from the gather JSONL (--content-hash + --source-id for
thread/comment, --fingerprint for ci-job):
# thread / comment:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" record \
--id <ID> --kind <thread|comment> --decision implemented \
--source-id <item.source_id> --content-hash <item.content_hash> \
--commit <commit-sha>
# ci-job:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" record \
--id <ID> --kind ci-job --decision implemented \
--fingerprint <item.fingerprint> --commit <commit-sha>
Step 5f — record a declined item
When an item fails any of the three criteria, do not change code. Append the
item and a short rationale to the ## Declined section of .data/merge/<ID>.md
(create the heading if absent; it is append-only prose), e.g.:
## Declined
- **<thread/comment/CI ref>** — <one-line why>: <declined because it would change
the spec / conflicts with <standard> / isn't a legitimate shortcoming>.
Then write the terminal ## Handled record with --decision declined and the
rationale, carrying the same per-kind dedupe key:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" record \
--id <ID> --kind <thread|comment> --decision declined \
--source-id <item.source_id> --content-hash <item.content_hash> \
--rationale "<why it was declined>"
# (ci-job declines use --fingerprint <item.fingerprint> instead of --source-id/--content-hash)
The ## Declined prose is the human-readable record (per the user's request);
the ## Handled record is the machine dedupe key so the next wakeup never
re-surfaces the same declined item.
Step 6 — ambiguous items: ask once, record pending-user
When an item's spec-impact or CI attribution is genuinely ambiguous, ask the user once, then record it so wakeups stop re-asking:
bash "${CLAUDE_PLUGIN_ROOT}/skills/fix/scripts/gather-feedback.sh" record \
--id <ID> --kind <thread|comment|ci-job> --decision pending-user \
<dedupe-key flags: --content-hash <hash> --source-id <id> | --fingerprint <fp>> \
--rationale "<the question you asked>"
While a pending-user record stands, the Step-3 dedupe suppresses re-asking
that item — until either (a) its source changes (a new commit / fingerprint
for CI, or a new content_hash for a thread/comment) or (b) the user answers.
The user's answer supersedes the pending-user record: reprocess that one
item exactly once (implement or decline it via fn-10.2, which writes the
terminal record), rather than waiting for the next fetch.
Step 7 — schedule the next wakeup (or terminate)
Read MR_STATE from the trailer:
-
MR_STATE=closedormerged→ the PR/MR is closed. Terminate the loop and report a short summary (what was handled this session). Do not schedule another wakeup. -
otherwise → schedule the next wakeup with the harness
ScheduleWakeuptool, afterMR_POLL_SECONDS(the adaptive cadence hint: ~2–3 min while active, ~15–20 min when idle — you may adjust within that band). The wakeup payload must carry enough state to run stateless, because each wake re-enters this skill fresh:payload field value idthe PR/MR <ID>forgegithub/gitlab(from Step 1)stash.data/merge/<ID>.md(holds## Intent/## Declined/## Handled)last_activityMR_UPDATEDfrom the trailercadenceMR_CADENCE(active/idle)terminate_whenPR/MR closed The wakeup prompt re-invokes
/merge-request:fix <ID>— which re-runs Steps 1–7 from the top. Because gathering is deduped against the durable## Handledledger, a fresh wake never re-handles prior feedback.
Notes
- Session-bound. Scheduled wakeups live only for the current session; keep
active-poll intervals under ~5 min (the prompt-cache window). If the session
ends before the PR/MR closes, monitoring stops — resume by simply rerunning
/merge-request:fix <ID>. The## Handledledger makes resume idempotent. - The ledger is the source of truth for "already handled". Every terminal
outcome writes one record: reported / non-actionable CI here (fn-10.1);
implemented / declined and
pending-userin fn-10.2. Never re-derive dedupe by hand — always go throughgather-feedback.sh. - Read-then-write ordering. Record a CI item as reported/non-actionable immediately after you report it, before scheduling the next wakeup, so a quick next wake can't re-surface it.
04 同仓库更多 Skills
wendy
Summon Wendy, a performance coach modeled on Wendy Rhoades from Billions, when the user invokes /wendy or asks for Wendy by name, or explicitly asks to get his head right — tilting, stalling, spiraling, avoiding, flat, or needing to lock in before a hard push. Wendy works the operator's state, never the plan. Do NOT use for feedback on strategies, plans, or decisions, and do not trigger uninvited.
ubiquitous-language
Extract a DDD-style ubiquitous language glossary from the current conversation, flagging ambiguities and proposing canonical terms. Saves to ./docs/ubiquitous-language.md. Use when user wants to define domain terms, build a glossary, harden terminology, create a ubiquitous language, or mentions "domain model" or "DDD". Forked from Matt Pocock's "ubiquitous-language" skill.
tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development. Forked from Matt Pocock's "tdd" skill.
voice
Speak Claude's responses aloud through the native OS voice (macOS `say`) — on demand via /speak:speak (last response) or /speak:specify (pick one), or automatically on every response via a toggleable Stop hook. Works locally on a Mac and, through a manually started host listener, from inside a Dev Container. Use when the user wants responses read aloud / spoken / voice output, wants auto-speak turned on or off, or asks whether the speak install is healthy.
merge-request:review
Review a pull/merge request (by id) or batch-review every open one against Chris's own engineering standards, staging high-signal findings to .data/merge/<ID>.md for later posting. Fetches head SHAs and applies the "Reviewed at commit" skip check BEFORE any checkout, resolves the head fork-safely, builds/tests it in a dedicated worktree, and treats a failing build/checkout as the top blocking finding. First runs /detect-source-control and hard-stops when the forge is unsupported. Use as "review the PR", "review the open MRs", "any PRs need my eyes", "review <id>".
merge-request:post-findings
Take the findings staged by /merge-request:review in .data/merge/<ID>.md and, with per-finding approval, post the approved ones to the forge as inline comments (general-comment fallback when a finding has no valid diff location) — or formally sign off a clean PR/MR with a single "Looks good." First runs /detect-source-control and hard-stops when the forge is unsupported. Nothing reaches the forge except through the bundled scripts. Also runs a propose-then-confirm learned-preferences loop that teaches /merge-request:review what you value (Don't-raise / Wording / Confirmed-valued), and records skipped findings to the artifact's