Review and merge rules for every ReqSeq pull request - draft first, the review with /code-review, the blocker filter, auto-merge and the merge criteria, CI changes and the release steps. Use when opening, reviewing or merging a ReqSeq PR, or preparing a release.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Merge?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/thomasbirkmaier-merge)
---
name: merge
description: Review and merge rules for every ReqSeq pull request - draft first, the review with /code-review, the blocker filter, auto-merge and the merge criteria, CI changes and the release steps. Use when opening, reviewing or merging a ReqSeq PR, or preparing a release.
---
# From review to merge
**Draft first (#303).** Open every PR as a draft: a draft runs only the Ubuntu lane of CI, so the pushes while it is worked on are cheap. Push once per round (the first push, then one push per fix round), never in between. When the Ubuntu lane is green on the last push of the review round (or of the first push, if the review had no blocking finding), mark the PR ready for review with the GitHub MCP tool `update_pull_request` (`draft: false`). When the review has no open blocking finding by then, enable auto-merge in the same step (Merge as soon as it is green), unless the PR is labelled `needs-human` or works on performance. That run and each later push run both lanes at once (#412). There is no limit on how many PRs are ready at a time: a ready PR starts four jobs, one of them on macOS (fifteen, four on macOS, with the Electron suite; the limit of three ready PRs came from those, #739, #2295). A PR that only changes docs or rules may be opened ready at once.
**Labels.** A PR needs no labels, and labels on a PR are optional. `perf` starts the performance suite (below). No check reads the PR text or its labels, so editing them never needs a new CI run.
**Size.** `static` warns when a PR changes more than 800 lines without generated files (step `Pull request size`). Split such a PR before marking it ready, unless its change cannot be split; then the PR text says why.
**Review.** A second agent reviews each PR once with the built-in `/code-review`. It runs at effort `medium`, or `high` for a risky change as CLAUDE.md defines it. It starts at the push and does not wait for CI. Give it the issue and the SR as well as the PR. Besides the code, it checks what only ReqSeq has: the product rules and the repository text rule in CLAUDE.md, AK tags and trace, and written reasons for every ignore (ADR-0016). It checks the PR title too, since it becomes the commit subject on `main` (CLAUDE.md, Traceability); a title in neither Conventional Commit form nor `SR-036: …` is corrected before the merge, which needs no new CI run. For every AK of the SR with method Test it names the test, the access through which the test triggers the behaviour, and the result it asserts; for the other methods it checks the record in `verification/` (#389). For each blocking finding it gives the file and line, why it is wrong, and how to show that it fails (a test, an input or a command). For a PR that changes user docs (`docs/guide/`, or the descriptions in `schemas/` the reference is generated from), it checks the whole changed guide page, or every description in a changed schema file, not only the diff: each statement about a concept or behaviour with its source (glossary term, SR, decision, ADR, or code file), and every statement without one or against it, and every cited ID that does not say what it is cited for, is blocking (CLAUDE.md, Repository text). For an AK with visible behaviour, the PR shows the evidence: the CLI output; a PR writes no demo file. For a spec PR, it checks that the PR names the touchpoints of the dependency check (`spec-change`) and what was done with each, and, for a content change as CLAUDE.md (How we work) defines it, the six headings of step 7 of `spec-change` (Content change, Mockup, Dependency check, Concept review, Outdated relations, Issue cut), each with what was done or why it was not needed, and under Concept review the wording check of step 6, or for a small change that its one review read the wording; a missing heading, or a "not needed" without a reason, is blocking. Use `/security-review` in addition for changes to file access, the UI server and the desktop shell's host code, or the dependencies.
## Filter: a separate step by the author or the session that started the review
The filter applies this list and never downgrades a finding on it. Blocking findings are correctness, a broken product rule, wrong or missing AK tags or trace, an AK with method Test that no test triggers through the access the AK names (for all four accesses, a core test plus a tagged cross-access scenario; an app test only for app UI), a breach of the repository text rule (also a doc statement without a source or against it), and an unjustified ignore or weakened gate. A blocking finding or red CI the PR caused starts one fix round (a red job it did not cause: below, Merge as soon as it is green), which also takes that PR's should-fix items. Send the fix round to the agent that wrote the code (SendMessage) while it is reachable, because it still has the context; send the findings soon after the review. Otherwise start a fresh agent with the plan, the findings and the diff. The fix needs no new review, unless it adds logic the findings did not ask for. A blocking finding too large for the PR is fixed in a PR of its own, and this PR stays a draft until that one merged; the fix becomes an issue only if CLAUDE.md (Issues) allows one. Without a blocking finding, small should-fix items are fixed in the PR, the rest stay as notes in the PR description and become no issue (CLAUDE.md, Issues), and the PR merges on green CI. Before auto-merge is enabled or the PR is merged, its section "Review rounds" (pull request template) holds the reviewer's verdict and each blocking finding with how it was settled, because GitHub allows no review on these PRs and the PR is where a reader looks (#2722).
## CI changes
`main` blocks force-pushes and deletion and requires the checks `static`, `shell scope`, `web (ubuntu-24.04)` and `checks` on each of `ubuntu-24.04`, `macos-26` and `windows-2025`. A CI change that aims at speed or cost names its measure and its baseline (#412). When a condition behind the CI strategy changes (runner cost, visibility, required checks), check the strategy again.
## Conflicts and stacked PRs
No stacked PRs (#412): branch every PR from `main`, never from another PR's branch. A squash merge of the lower PR forces every PR above it to merge `main` and run the whole CI again. Work that builds on an open PR waits for its merge, or goes into the same PR.
Merge `main` into a PR only when GitHub reports a conflict, after a change of its base branch (below), or when the PR is red because `main` is (an open issue labelled `main-red`, written by `main-check.yml`, #796; fix `main` first, then merge it into the PRs it broke). The ruleset does not require an up-to-date branch, so merging `main` without a conflict only starts a full run. Merge it with `pnpm merge:main`, which regenerates conflicting generated files. A conflict resolved by hand needs a look at that diff before the merge. If the two sides cannot both be kept, label the PR `needs-human` and give the product owner the options.
## Merge as soon as it is green
PRs labelled `needs-human` are not merged. Once the review has no open blocking finding and the PR is not a draft, enable GitHub auto-merge with the GitHub MCP tool `enable_pr_auto_merge` (`mergeMethod: SQUASH`) and subscribe to the PR's activity (#412): GitHub merges when the required checks pass. Auto-merge sometimes does not fire, and a job the runner cancelled sends no event: when no merge event arrives, read the head's check runs at the next wake and merge by hand. A later push keeps auto-merge on, so disable it (`disable_pr_auto_merge`) before a push that needs a new review. Auto-merge reads only the required checks, not the other checks below: so a PR that works on performance (`perf` below) is merged by hand. If GitHub refuses it, or another check below is red, merge by hand on the check-run event, when the check runs of the head commit (`GET /repos/ThomasBirkmaier/ReqSeq/commits/{sha}/check-runs?per_page=100`) show all of this:
- The PR is not a draft, and `static`, `shell scope`, `web (ubuntu-24.04)` and `checks` for `ubuntu-24.04`, `macos-26` and `windows-2025` exist on the head commit and concluded `success`. Each of these names needs one `success` on the head commit; cancelled runs of the same name from superseded runs do not count against it, and skipped matrix jobs show names like `checks (${{ matrix.os }})` and do not count; one green workflow is not enough.
- Every other check run completed with `success` or `skipped`. The one exception is a PR that works on performance: there `perf` may be red when every row over its limit was already over it on main and no measurement is worse. The PR names the rows and the comparison. The label `perf` starts the perf job once when it is added, not on later pushes, so add it after the last reviewed push, and measure the comparison locally in the container.
A change of the base branch starts no CI run (#372): after it, merge the new base with `pnpm merge:main` and push before the merge, so the checks ran against it.
**A red job the PR did not cause** (a flaky or timed-out test, or a step that fails on code the PR does not touch) is a bug on `main`, so it gets an issue before any re-run (CLAUDE.md, Issues: a failing test). If a `main-red` issue is open, that is the issue: do not re-run, fix `main` first (Conflicts and stacked PRs). Otherwise search the open issues for the test file or test title, not the error text (`gh api -X GET search/issues -f q='repo:ThomasBirkmaier/ReqSeq is:issue is:open servers.test.ts'`); if one exists, comment there with the new job link. That makes at least its second sighting, so the flake gets fixed rather than only re-run: set `P1` in place of its priority and, unless an open PR closes it, start its fix in a PR of its own. The current PR is still re-run (below) and does not wait for that fix. Else open a `bug` following CLAUDE.md, Issues, with the area of the failing code and `P2` unless it blocks most PRs, naming the job link, the step, the test and its error. You find the failed step with `GET .../actions/runs/{run_id}/jobs` (`steps[].conclusion`), because the annotation only says "exit code 1" (ThomasBirkmaier/ReqSeq-archive#566). A pure runner fault (a lost runner, a GitHub outage) needs no issue. Then, once the whole run has completed, re-run only its failed jobs (`POST .../actions/runs/{run_id}/rerun-failed-jobs`, or the GitHub MCP tool `actions_run_trigger` with `method: rerun_failed_jobs`); never push an empty commit for it. A red nightly run gets its issue from `nightly-check.yml` (below).
Merge with `PUT /repos/ThomasBirkmaier/ReqSeq/pulls/{n}/merge` and `merge_method: squash`, keeping the `Implements:` trailers; GitHub deletes the branch. Use `rebase` instead only when the commits should stay revertible one by one. Never merge red.
## After the merge
`main` gets no full CI run after a merge, only `main-check` (typecheck and lint), the nightly run and a manual one. A red nightly run is the first work of the morning, fixed through a PR to `main` (#340); `nightly-check.yml` opens an issue `Nightly run is red: <workflow>` for it and closes it on the next green nightly run. This is no licence to merge without green PR CI.
## Release
A release x.y.z needs only steps 3 and 4, and its milestone, if one is planned, has no open issue; a release x.y with its milestone needs all four.
1. The milestone's issues are closed, and `pnpm trace-check --require <the SRs its issues complete> --report trace-<milestone>.md` passes.
2. Prepare the acceptance: what to try in the app or CLI, the `verification/` records with method Inspektion or Demonstration, and the known limitations. Count the keys three tasks take in the app and compare them with the last milestone: (1) open a given requirement, (2) all requirements of a need, (3) all requirements without a passed test; note the numbers (#362).
3. Before the version PR, measure the performance suite on Windows and macOS on the `main` commit the version PR branches from (the nightly run measures only Ubuntu, #2469). Windows: start the `Performance` workflow by hand on `main` with system `windows-2025`; it ends in an evidence pull request `perf evidence of main@<sha>` with `perf-windows-2025.xml` in the Windows variant only; check that it merged, and name a red run (its perf issue) in the version PR. macOS: the hosted macOS runner is below the reference machine of macOS, a Mac with Apple M1 Pro and 16 GB (ADR-0011, D-087), so the thread runs the suite on a Mac through Remote Control: it checks out that exact `main` commit, runs `pnpm install --frozen-lockfile`, prints the system, chip, cores, memory and Node (`node -e 'const os = require("node:os"); console.log(os.platform(), os.release(), os.arch(), os.cpus()[0].model, os.cpus().length, Math.round(os.totalmem() / 1024 ** 3), process.version)'`), then runs `pnpm build && pnpm test:perf`. The system must be `darwin`: in a Linux container on a Mac the system is Linux (D-087), and such a run is no macOS run. As ADR-0011 says, a pass is evidence on Apple M1 Pro with 16 GB or on Apple M1 with at most 16 GB; a run on any other Mac is for comparison only and records nothing. A failure on any Mac other than Apple M1 Pro with 16 GB (Apple M1 included) is measured again on Apple M1 Pro with 16 GB and counts only there: then it is a record `failed`, and the thread opens a `bug` issue following CLAUDE.md, Issues, with the test, its time and bound, the machine and the commit. On the Mac, bounds of ADRs and issues are for comparison only. From the run's `test-results/junit-perf.xml` it writes, in the version PR, a section `## macOS (VAR-003)` into `verification/<SR>.md` for each SR the suite tags that stands in the macOS view, today SR-262 to SR-264, SR-061 and SR-062 (`verification/README.md`): the machine (chip, system, cores, memory, Node), the commit, the date, and per tagged test its time, threshold and result, written by an agent and not confirmed. Without a run on such a Mac, the version PR says so, and the last record keeps counting. After a person confirms it at the acceptance, the record goes in with `node packages/cli/dist/bin.js evidence record <SR> --kind verification --method test --result <passed|failed> --item "main@<sha> (macOS)" --variant VAR-003 --criteria <keys> --evidence ../../../verification/<SR>.md --workspace spec` (options: `schemas/commands/evidence.record.json`), never without `--variant`, so that it counts in the macOS view and not in the core. A PR bumps the root `version` (and runs `pnpm contracts:generate`); for a version x.y its description carries the trace-check report and the acceptance notes of steps 1 and 2, for x.y.z only the version. The same PR adds the summary for the user, `docs/releases/<version>.md`, as its README there says: what changed for the user since the last release, in words of the app, with the point for existing workspaces when the standard model changed; the summary of the first release that knows the pinned ReqSeq version (`reqseq-version` in the workspace file) says that older ReqSeq versions report a workspace file with that key as faulty, so a team updates together. After the version bump, `pnpm contracts:generate` and `pnpm build`, it pins `spec/` to the new ReqSeq version with `node packages/cli/dist/bin.js workspace pin-version --workspace spec` (SR-255), which writes the version of the running build, checks that the output's pinned version is the new ReqSeq version, and commits `spec/reqseq-workspace.yaml`; this is the one change of `spec/reqseq-workspace.yaml` outside a spec PR. It pins `reqseq-practices/` the same way (`--workspace reqseq-practices`), so that its check does not warn about an older pinned version. It rewrites ReqSeq's own skill with `node packages/cli/dist/bin.js tool guide --skill --write --workspace spec` after `pnpm build`, so `.claude/skills/managing-requirements/SKILL.md` and `.agents/skills/managing-requirements/SKILL.md` carry the new version (SR-229); a PR that changes the skill's text in core rewrites it the same way. It also regenerates the guide's screenshots and the README animation with `pnpm docs:screenshots` on Linux and commits `docs/guide/images/` (ADR-0017); a PR that changes what they show regenerates them too. After its merge, start the `Release` workflow by hand once on `main` (`ref: main`, not the PR branch); it publishes nothing, finds packaging regressions (its delivery tests, ADR-0011), and saves the download cache where the tag run can read it, because a tag run reads only the caches of its tag and of `main` (#1238). The tag goes on the commit this run checked: after a fix, or when the tag follows more than 7 days later (GitHub evicts an unused cache after 7 days), run it again on the new `main`.
4. After the product owner accepts, the product owner sets the release tag `v<version>`, or `v<major>.<minor>` for a patch of 0 (`tagReleasesVersion` in `scripts/package/lib.mjs`) on the checked commit; agents cannot create tags. The tag starts the `Release` workflow, which writes the release text from the summary and the commits. When a summary of a published release changes, start the workflow `Release texts` by hand on `main`. Never mark a milestone accepted yourself. Once the `Release` workflow of the tag is green, close the milestone of the released (accepted) version; if an issue in it is still open, ask the product owner to move it first. Closing it keeps the lowest open version, by which agents and the workflows that open issues place new issues, an unreleased one.