agentleFS
on-paron-par/software-factory/.claude/skills/merge-policy/SKILL.md

merge-policy

Skill6 starsChanged 2 days agoMITView on GitHub

The software-factory rule that main must always be green, and how to land PRs under it — when a bypass/admin merge is and is not allowed, how to handle a hung required check, and what to do when main goes red. Use before merging or landing any PR, before running `gh pr merge --admin` or any merge that skips required checks, when a required check is stuck or failing, or when a test fails on main.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Never use gh pr merge --admin, or any merge that bypasses required status checks, to get past a check that is actually FAILURE.

    line 12
  2. Very specific:

    Run bash scripts/verify.sh --no-e2e locally and get it green.

    line 18
  3. Very specific:

    Run targeted checks for anything the fast path skips (coverage: npm run test then npm run coverage-ratchet).

    line 19
  4. Distinctive:

    Treat it as the top-priority task.

    line 28

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Merge policy: main must always be green

main must never carry a genuinely failing test, type error, or lint violation.

The rule

Never use gh pr merge --admin, or any merge that bypasses required status checks, to get past a check that is actually FAILURE. Fix the failure instead.

The only two legitimate bypasses

  1. The factory's own auto-merge. It bypasses the review-approval requirement, which a bot cannot obtain. Its CI gate (waitForMerge in packages/cli/src/cli/index.ts) still refuses to merge unless CI reported a real success. It never merges on a failure or an unresolved or hung outcome.
  2. A human confirms a required check is hung, not failed (for example the #739 CI deadlock). Before merging:
    1. Run bash scripts/verify.sh --no-e2e locally and get it green.
    2. Run targeted checks for anything the fast path skips (coverage: npm run test then npm run coverage-ratchet).
    3. Say explicitly in the merge or PR comment that the check was hung and what you ran instead.

A bypass under case 2 is a workaround for an infra bug, not a norm. Open or link the issue that fixes the hang.

History: the multi-hour ci hang of #739/#755 was an unbounded microtask-only spin loop in router/index.test.ts, not the integration tests. CI jobs now carry a timeout-minutes ceiling so a future spin cannot strand open PRs.

When main is red

  1. Treat it as the top-priority task. A red main blocks every open PR, and every PR's diff is measured against it.
  2. Reproduce on a fresh branch off origin/main with bash scripts/verify.sh.
  3. Fix the root cause in a small PR. Do not skip or delete the failing test to get green.
  4. Land the fix with normal required checks. Rebase other open PRs afterwards.

Landing a factory PR

  • factory ship and factory run-issue stop at a ready-for-review PR. They never merge.
  • factory land <issue> squash-merges a ready PR and cleans up its worktree.
  • factory run merges only when auto-merge is on (--auto-merge, .factory/config.yaml, or FACTORY_MERGE=1), and only through the CI gate above.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.