pr-guard
Skill0 starsChanged 7 days agoMITView on GitHub
Full PR review-and-merge gate - orchestrates security review, code review, clean-code and test-quality lenses, runs the tests for real, checks CI/conflicts, then merges ONLY after explicit user approval in the same session. CRITICAL/HIGH findings block the merge automatically. Use when the user asks to "review and merge a PR", "review PR #N", "ship this PR", "راجع الـ PR وادمجه", or wants a gated merge with a written review report. NOT for reviewing local uncommitted changes (use a plain code review) or for creating a PR from scratch.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Abdox-menara/guard-skillstheir own version, first seen Aug 24, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Abdox-menara/guard-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- ahmed-humanizerSkill
- directSkill
- git-conflict-resolveSkill
- git-conflict-reviewSkill
- git-pr-mergeSkill
- sql-server-dbaSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
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
- Distinctive: line 18
CRITICAL or HIGH findings block the merge path entirely: Do not offer the merge option.
- Distinctive: line 22
Report what actually ran: Test results are pasted from real command output.
- Distinctive: line 23
If a step was skipped, the report says so and why.
- Very specific: line 30
Check out the head branch locally (gh pr checkout <N>) — required for Phase 3.
- Distinctive: line 39
Run the applicable lenses.
- Very specific: line 52
Every finding records: severity, file:line, one-sentence defect statement, and a concrete failure scenario (inputs/state → wrong outcome).
- Distinctive: line 67
If the repository defines a project layer, run its gates now as an additional lens.
- Distinctive: line 80
Run for real, paste real output into the report:
- Very specific: line 96
Write the review to a persistent file — default .claude/PRPs/reviews/pr-<N>-review.md (create the directory if missing.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 Guard — Review + Permission-Gated Merge
Review a GitHub PR through parallel quality lenses, verify by actually running the project's tests, write a persistent review report, and merge only after the user explicitly approves in the same session. Never auto-merge. Never merge with open CRITICAL or HIGH findings.
Non-negotiable rules
- No merge without an explicit user "yes" given in this session, after the verdict was presented. Prior instructions like "review and merge it" authorize the workflow, not the merge itself — still ask at the gate.
- CRITICAL or HIGH findings block the merge path entirely. Do not offer the merge option; offer to fix instead.
- Never push to the base branch directly. The only write to the base branch is
the merge performed through the PR (
gh pr merge). - Report what actually ran. Test results are pasted from real command output. If a step was skipped, the report says so and why.
Phase 0 — Intake
- Resolve the PR: from the argument (number or URL), or the current branch's PR via
gh pr view --json number,title,baseRefName,headRefName,mergeable,url. - Fetch the diff (
gh pr diff <N>) and the file list (gh pr view <N> --json files). - Check out the head branch locally (
gh pr checkout <N>) — required for Phase 3. - Classify the diff:
- Production code vs test code vs config/docs — decides which lenses run.
- Security-sensitive? auth/session code, input handling, DB queries, file operations, crypto, payments, secrets/credential handling, new endpoints.
- Load the project layer if one exists (see "Project layer" below).
Phase 1 — Review lenses
Run the applicable lenses. Prefer parallel subagents (one per lens) when the Agent tool is available; otherwise run them sequentially in-context. Each lens receives the diff plus enough surrounding file context to judge it — reviewing the raw diff alone is not acceptable for correctness claims.
| Lens | When | How |
| Security | Always; deep pass if security-sensitive | Use an installed security skill (owasp-security, security-review, …) if present; else the security section of references/review-lenses.md |
| Code review | Production code changed | Dedicated reviewer agent if available; else the code-review section of review-lenses.md |
| Clean code | Production code changed | clean-code-guard skill if installed; else the clean-code section of review-lenses.md |
| Test quality | Diff contains test files | test-guard skill if installed; else the test-quality section of review-lenses.md |
| Secret scan | Always | Grep the diff with the patterns in review-lenses.md §Secrets |
Every finding records: severity, file:line, one-sentence defect statement, and a
concrete failure scenario (inputs/state → wrong outcome). Findings without a failure
scenario get downgraded or dropped — no vague "consider improving X".
Severity policy
| Severity | Meaning | Effect on merge |
| CRITICAL | Security vulnerability, data loss/corruption path | Blocks — fix required |
| HIGH | Real bug or broken contract a user will hit | Blocks — fix required |
| MEDIUM | Maintainability / operational concern | Merge allowed; listed as follow-ups |
| LOW | Style, minor suggestion | Merge allowed |
Phase 2 — Project gates (extension point)
If the repository defines a project layer, run its gates now as an additional lens. A project layer is discovered in this order:
- A project skill whose SKILL.md declares it wraps
pr-guard(e.g.dc-pr-guardin.claude/skills/) — follow its gates and parameter overrides. - A checklist in the repo's agent instructions (CLAUDE.md / AGENTS.md) that gates merges (architecture rules, mandated patterns, forbidden constructs).
Project-gate violations are scored with the same severity table. A project layer may also override: test commands, report path, merge style, reviewer models.
Phase 3 — Verification (proof of execution, not reading)
Run for real, paste real output into the report:
- Formatter/linter on the changed files, using the project's own entrypoint.
- The PR's own tests, then the affected suite (the test directory/module covering the changed area). Full-repo suite only if the project layer demands it.
- CI status:
gh pr checks <N>— all required checks green, or the failure is explained and accepted by the user. - Mergeability:
mergeableis clean, no conflicts, branch not stale against base (behind-by is acceptable only if CI ran on a current-enough merge commit — when in doubt, say so in the report).
Any red result here is treated as a HIGH finding (blocks) until resolved or the user explicitly waives it.
Phase 4 — Report
Write the review to a persistent file — default .claude/PRPs/reviews/pr-<N>-review.md
(create the directory if missing; project layer may override the path). Follow
references/report-template.md: Summary, Findings by
severity with file:line + failure scenario, per-lens results, validation table with
real outputs, files reviewed, Decision (APPROVE / APPROVE-WITH-COMMENTS / BLOCK).
Phase 5 — Merge gate
- If any CRITICAL/HIGH is open → present the findings and stop. Offer to fix them on the PR branch; after fixes, re-run the affected lenses and Phase 3.
- Otherwise → present a compact verdict (decision, finding counts, test results, CI state) and ask for explicit approval to merge. Use AskUserQuestion when available; the merge option must name the PR and the merge style.
- On explicit approval only:
- Stacked-PR check first:
gh pr list --base <headRefName>— if any open PR targets this PR's branch, merge without--delete-branch(deleting a mid-chain branch retargets/closes the stacked PRs). - Merge:
gh pr merge <N> --squash(project layer may override style). Add--delete-branchonly when the stacked-PR check came back empty. - Confirm the result: report the merge commit SHA on the base branch.
- Stacked-PR check first:
- On decline → leave the PR open, report where the review artifact lives.
Project layer authoring (for wrapper skills)
A project wrapper skill should stay thin: declare "Follow the generic pr-guard
workflow" and then list only deltas — extra gates (with severities), test/lint
commands, report path, merge style, reviewer-agent/model preferences. Do not
duplicate the phase logic; it lives here.
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
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.

