pr-automerge
Skill1 starsChanged 9 months agoMITView on GitHub
Activate when asked to auto-review and merge a PR. Runs a closed-loop workflow: subagent Stage 3 review -> fix findings -> re-review -> post ICA-REVIEW receipt -> merge (optional via workflow.auto_merge).
In this repository44 other files it gives its agents.
- agent-browserSkill
- ai-engineerSkill
- architectSkill
- autonomySkill
- backend-testerSkill
- best-practicesSkill
- branch-protectionSkill
- commit-prSkill
- create-work-itemsSkill
- database-engineerSkill
- developerSkill
- devops-engineerSkill
- file-placementSkill
- github-issues-planningSkill
- github-state-trackerSkill
- git-privacySkill
- ica-bootstrapSkill
- ica-cliSkill
- ica-get-settingSkill
- infrastructure-protectionSkill
- mcp-clientSkill
- mcp-commonSkill
- mcp-configSkill
- mcp-proxySkill
- memorySkill
- parallel-executionSkill
- plan-work-itemsSkill
- pmSkill
- processSkill
- qa-engineerSkill
- releaseSkill
- requirements-engineerSkill
- reviewerSkill
- run-work-itemsSkill
- security-engineerSkill
- skill-creatorSkill
- skill-writerSkill
- suggestSkill
- system-engineerSkill
- tddSkill
- thinkingSkill
- user-testerSkill
- validateSkill
- web-designerSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
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
- Very specific: line 29
Default base branch for PRs is dev.
- Very specific: line 30
Never merge unless a merge-eligible ICA-REVIEW-RECEIPT exists for the PR's current head SHA:
- Very specific: line 39
If workflow.auto_merge=true (standing approval), the agent MAY merge once gates pass.
- Distinctive: line 47
Run Stage 3 review via a dedicated reviewer subagent:
- Distinctive: line 48
Use your Task/sub-agent mechanism to run Reviewer Stage 3 in a temp checkout.
- Very specific: line 56
If PR author == current authenticated gh user: GitHub forbids approving your own PR (server-side rule).
- Distinctive: line 57
If repo rules require approvals, merge will still be blocked.
- Distinctive: line 58
Verify merge gates (receipt + head SHA + checks green).
- Distinctive: line 61
If repeated failures or unclear/risky changes are required, pause for a human decision.
- Very specific: line 63
If workflow.auto_merge=true and base is dev: merge the PR (agent-performed merge.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.
Files
PR Auto-Review And Merge (Closed Loop)
This skill implements the closed-loop workflow: Review via subagent -> ICA-REVIEW receipt -> merge when NO FINDINGS -> otherwise fix and restart.
Inputs
- PR number (required):
<PR-number>
Safety Rules
- Default base branch for PRs is
dev. Never auto-merge a PR targetingmainunless it is an explicitly requested release workflow. - Never merge unless a merge-eligible
ICA-REVIEW-RECEIPTexists for the PR's current head SHA:Reviewer-Stage: 3 (temp checkout)Reviewer-Agent: ... (subagent)Head-SHAmatchesheadRefOidFindings: 0andNO FINDINGSResult: PASS
- GitHub approvals are OPTIONAL by default (self-review-and-merge workflow). If you want to enforce GitHub-style approvals,
set
workflow.require_github_approval=true. - Merge approval:
- If
workflow.auto_merge=true(standing approval), the agent MAY merge once gates pass. - Otherwise, stop and wait for explicit user approval.
- If
Workflow (Loop Until Clean)
- Read PR metadata:
- base branch, head SHA, head branch
- checks status
- Run Stage 3 review via a dedicated reviewer subagent:
- Use your Task/sub-agent mechanism to run Reviewer Stage 3 in a temp checkout.
- Reviewer must fix findings by pushing commits to the PR branch.
- Reviewer must re-run Stage 3 until findings are zero and checks are green.
- Reviewer must post
ICA-REVIEW-RECEIPTNO FINDINGS comment for the current head SHA. - Pragmatic GitHub approval (best-effort; only if
workflow.require_github_approval=true): after posting NO FINDINGS receipt, reviewer subagent should:- Skip if an
APPROVEDreview already exists. - Otherwise, attempt:
gh pr review <PR-number> --approve --body "Approved based on ICA Stage 3 review receipt (NO FINDINGS)." - If PR author == current authenticated
ghuser: GitHub forbids approving your own PR (server-side rule). Skip.- If repo rules require approvals, merge will still be blocked; use a second GitHub identity/bot for approvals.
- Skip if an
- Verify merge gates (receipt + head SHA + checks green).
- If gates fail:
- Restart from step 2 (fresh temp checkout).
- If repeated failures or unclear/risky changes are required, pause for a human decision.
- If gates pass:
- If
workflow.auto_merge=trueand base isdev: merge the PR (agent-performed merge; do NOT use--auto). - Else: stop and ask for explicit approval.
- If
Command Snippets (Reference)
PR info:
PR=<PR-number>
gh pr view "$PR" --json number,baseRefName,headRefName,headRefOid,state,mergeable --jq .
gh pr checks "$PR"Approval check (optional gate):
PR=<PR-number>
PR_AUTHOR=$(gh pr view "$PR" --json author --jq .author.login)
GH_USER=$(gh api user --jq .login)
APPROVALS=$(gh pr view "$PR" --json reviews --jq '[.reviews[] | select(.state=="APPROVED")] | length')
echo "Approvals: $APPROVALS"
if [ "$PR_AUTHOR" = "$GH_USER" ]; then
echo "Self-authored PR ($GH_USER): GitHub forbids self-approval; approvals may require a bot/second identity."
fiReceipt verification:
PR=<PR-number>
HEAD_SHA=$(gh pr view "$PR" --json headRefOid --jq .headRefOid)
RECEIPT=$(gh pr view "$PR" --json comments --jq '.comments | map(select(.body | contains("ICA-REVIEW-RECEIPT"))) | last | .body // ""')
echo "$RECEIPT" | rg -q "Reviewer-Stage: 3 \\(temp checkout\\)"
echo "$RECEIPT" | rg -q "Reviewer-Agent:.*\\(subagent\\)"
echo "$RECEIPT" | rg -q "Head-SHA: $HEAD_SHA"
echo "$RECEIPT" | rg -q "Findings: 0"
echo "$RECEIPT" | rg -q "NO FINDINGS"
echo "$RECEIPT" | rg -q "Result: PASS"Merge (agent-performed):
gh pr merge <PR-number> --squash --delete-branchDoes 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
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.

