agentleFS
0xrafasec0xrafasec/ai-workflow/skills/pr/SKILL.md

pr

Skill9 starsChanged 19 days agoMITView on GitHub

Push the current branch and open a pull request with gh (commits must already exist). Use when the user says 'open a PR', 'push this up for review', 'ship this branch', or 'create a draft PR'. Opens a draft, has the fresh-context wf:reviewer review it, fixes HIGH/MED findings (max 2 rounds), then marks it ready on PASS. Never merges.

  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. rafagomes/ai-workflow★ 9100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    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 repository16 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    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
  1. Very specific:

    Dirty tree: stop — *"Working tree has uncommitted changes.

    line 31
  2. Very specific:

    On <base>: stop — *"You're on <base>.

    line 32
  3. Very specific:

    Always pass --draft when the review loop will run, so the branch is never review-ready before its review.

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Open a pull request for the current branch. Commits must already exist (from /wf:commit, /wf:feature, /wf:fix, or by hand).

Default flow: open as a draft, have a fresh-context reviewer review the branch, fix HIGH/MED findings in a bounded loop, then mark the PR ready on a pass. This is the writer/reviewer rule in your global agent instructions (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md): a reviewer with cold context sees the branch before it becomes review-ready.

Parse Arguments

$ARGUMENTS (in hosts that do not substitute it, e.g. Codex, the text the user wrote after the skill name) may contain:

  • --draft — leave the PR a draft even after the review passes. The review still runs; only the final gh pr ready is skipped.
  • --no-review — skip the review loop and open the PR directly (ready, unless --draft). Two cases allow it. First, a fresh-context review of these exact commits already ran (say which). Second, the allow-list in your global agent instructions (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md) → Review, repeated here so the skill is self-contained (update both together): the whole diff is a typo, spelling or formatting fix in prose, or a changelog entry or project-version bump. Text that instructs an agent — a skill, an agent definition, a CLAUDE.md, a prompt — is behaviour and never qualifies; neither does a revert, a file move, or a dependency bump. When unsure, review. Small or urgent is not a reason to skip. State it in the PR body as Review: skipped — <reason>.
  • No flags — the default flow.

Guardrails

  • Don't force-push without explicit confirmation, and never to the trunk branch. Force-pushing rewrites history under everyone who has pulled it; surface the risk and confirm first.
  • Don't merge, request reviewers, add labels or milestones, or close issues. Those depend on team conventions this skill doesn't have. The body or commits may reference an issue (Closes #N), but closing is the user's decision.
  • No Claude / Anthropic co-author tags in the PR body. Co-authorship belongs on commits, not repeated in the description.
  • A dirty working tree stops the skill; point the user at /wf:commit. Mixing uncommitted work in obscures what the PR contains. The only commits this skill makes are review fixes in step 9, staging just the files it fixed.

Steps

  1. Check preconditions (in parallel where possible).
    • gh auth status — if it fails, stop and print the manual git push plus the proposed title and body.
    • gh pr view --json url,state,isDraft 2>/dev/null — if an open PR already exists for this branch, don't create another: push any new commits and continue at step 8 (review).
    • Resolve the trunk branch once as <base>: gh repo view --json defaultBranchRef -q .defaultBranchRef.name, falling back to git symbolic-ref --short refs/remotes/origin/HEAD (strip origin/). Run git fetch origin <base> and use origin/<base> in every range below.
    • git status and git rev-parse --abbrev-ref HEAD.
    • Dirty tree: stop — "Working tree has uncommitted changes. Run /wf:commit first, then re-run /wf:pr."
    • On <base>: stop — "You're on <base>. Create a feature branch first."
    • Branch name off the convention (feat|fix|refactor|docs|chore|test|perf|build|ci|security/<slug>, see Trunk-Based Workflow in your global agent instructions (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md)): warn and offer to rename before pushing.
    • Size. Measure the added hand-written source: the committed branch, git diff --numstat origin/<base>...HEAD, with the same exclusions as /wf:feature step 5 (Size gate: tests, lockfiles, generated files and pure moves out). Sum the first column and count the files. Past roughly 1,000 added lines or ~40 changed files, decide whether it is one concern. One concern: carry on, say in your report how large it is and why it stays together, and add that line to the PR body. More than one: warn, suggest the split, and proceed only if the user confirms. Never split one concern to get under the number.
  2. Gather the range: git log origin/<base>..HEAD --oneline, git diff origin/<base>...HEAD --stat, and the full diff when drafting. Empty range: stop, nothing to PR. Read every commit and the whole diff — the summary describes the branch, not the tip commit.
  3. Check upstream state: git rev-parse --abbrev-ref --symbolic-full-name @{u} and git status -sb.
    • No upstream: git push -u origin <branch>.
    • Ahead: git push origin <branch>.
    • Behind or diverged: stop; don't pull, rebase or force-push. Tell the user.
    • Up to date: proceed.
  4. Title — under 70 characters, imperative, no type prefix (that belongs in commit messages), describing the outcome. Good: Add rate limiting to auth endpoints. Bad: feat: added rate limiter middleware with token bucket algorithm.
  5. Body — these sections in order; delete any that has nothing to say:

    ## Summary
    - <1-3 bullets on what changed and why>
    
    ## Spec
    <link to the matching spec (scan docs/specs/, specs/, the feature dir)>
    
    ## Risk
    <`T1 — <one-line why>`; tiers are defined in your global agent instructions (`~/.claude/CLAUDE.md` or `~/.codex/AGENTS.md`) → **Risk tiers**.
    Always required; `T0 — <reason>` when --no-review skipped the review>
    
    ## Review
    <only with --no-review: `Review: skipped — <reason>`>
    
    ## Security checklist
    <only if the diff touches a security trigger (global agent instructions (`~/.claude/CLAUDE.md` or `~/.codex/AGENTS.md`) → **Security triggers**)>
    - [ ] Inputs validated at system boundary
    - [ ] No secrets or credentials in code/logs
    - [ ] Auth/authz checks unchanged or reviewed
    - [ ] External API calls use timeouts and error handling
    - [ ] <checks specific to what changed>
    
    ## Test plan
    - [ ] <how to verify each change: commands, URLs, manual steps>

    The Test plan is always required; "run the existing suite" counts. A focused 5-line body beats a templated 30-line one.

  6. Present the draft and wait for approval; revise on edits and re-present.
    Title: <title>
    Base:  <base>
    Head:  <branch>
    Flow:  draft → fresh review → ready   (or: draft-only [--draft] / direct, no review [--no-review])
    
    Body:
    <full body>
  7. Create the PR with a HEREDOC body:
    gh pr create --base <base> --title "<title>" [--draft] --body "$(cat <<'EOF'
    <body>
    EOF
    )"
    Always pass --draft when the review loop will run, so the branch is never review-ready before its review. With --no-review, pass it only if the user wants a draft.
  8. Review. Skip only when --no-review was passed. You are the writer and never review your own work; an in-session review skill runs in your context and does not count. Dispatch the reviewer agent, which starts cold. It runs in your working tree, so the tree must be clean. In Claude Code that is wf:reviewer; in Codex, spawn the wf-reviewer custom agent (installed by ./install.sh --codex) with the same prompt. If neither agent is available, stop and tell the user to run the review in a fresh session: never review your own code. The Claude Code dispatch:

    Agent(
      subagent_type: "wf:reviewer",
      description: "Review PR branch",
      prompt: "Base: <base>\nSpec: <spec-path, or 'none'>\nRisk: <tier from the body>\nVerify: <the project's lint / typecheck / test commands>"
    )

    Take the Verify commands from the project's agent instructions (CLAUDE.md or AGENTS.md), Makefile or package scripts; pass none if there are none. It returns VERDICT (PASS or FIX_REQUIRED), REVIEWED_AT (the sha it read), RISK (the tier it assesses from the diff; reported only there, never as a finding), CHECKS, FINDINGS (HIGH / MED / LOW) and SUMMARY.

  9. Process the verdict and fix. Record the verdict with its REVIEWED_AT sha as a PR comment (gh pr comment <url> --body …), never as gh pr review --approve. Keep the LOW findings of every round: they are not fixed and a re-review does not repeat them, so the final comment and report list all of them.

    • PASS, and no LOW finding in any round: Review: PASS; go to step 10.
    • PASS, with LOW findings from this or an earlier round: Review: PASS_WITH_NITS; list them all in the final report; go to step 10.
    • FIX_REQUIRED: change only what the listed HIGH/MED items require, including the callers, docs and tests the fix needs (LOW items are listed, never fixed in a fix cycle), each fix with a test that fails without it where the project's suite can test it (otherwise say how it was verified). Re-run the project's lint, typecheck and the whole test suite, commit the fixes (conventional message), git push, and re-dispatch the reviewer with two extra lines, Previous findings: <list> and Reviewed at: <the REVIEWED_AT sha of the latest verdict>. That is a narrow re-review: it reads the fix commits; what they broke blocks as usual, and a defect that was already there blocks only when HIGH.

    At most 2 fix cycles. If cycle 2 still returns FIX_REQUIRED, record Review: NEEDS_HUMAN — <count> HIGH/MED unresolved after 2 cycles (add Spec ambiguity suspected at <spec-path> if one finding category recurred), leave the PR a draft, and stop looping. PASS_WITH_NITS and NEEDS_HUMAN are this skill's labels, not reviewer verdicts. Commits that change behaviour after a PASS need a fresh review before merge.

  10. Ready transition.
    • If the diff touches a security trigger (the list in your global agent instructions (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md) → Security triggers; the security subset of T2), run the built-in /security-review first (fresh context; in Codex, a fresh-context security review prompt, or the Codex Security plugin if installed). A HIGH or MED finding keeps the PR a draft (with --no-review the PR is already ready: convert it back with gh pr ready --undo <url>; the fix commits change behaviour, so the reviewer in step 8 runs on them even though --no-review was passed): fix it under the fix-cycle rules of step 9, commit and push, then re-dispatch the reviewer as step 9's narrow re-review, with the security findings in Previous findings (only with --no-review, where no review has run yet, is it step 8's full review), and re-run /security-review on the new commits. These fixes draw on the same budget as step 9 — 2 fix cycles per PR in total, not 2 more. With no cycle left, or a HIGH/MED security finding still open after the last one, record Review: NEEDS_HUMAN — security finding unresolved, leave the PR a draft and stop. List LOW findings in the report.
    • PASS or PASS_WITH_NITS, no open HIGH/MED security finding, and no --draft: gh pr ready <url>.
    • --draft: leave it a draft and report the passing verdict.
    • NEEDS_HUMAN: leave it a draft and report the unresolved items.
    • --no-review and no security fix was made: nothing to flip; step 7 set the final state. If a security fix was made, the bullets above apply.
  11. Report the PR URL, its draft/ready state, its tier (the higher of the declared and the reviewer's RISK; if the reviewer's is higher, update the body's ## Risk section yourself with gh pr edit; that is not a fix cycle and needs no re-review), and the review outcome (PASS, PASS_WITH_NITS with the nits, or NEEDS_HUMAN with the unresolved items). If the reviewer's CHECKS says a check left the tree dirty, say so, or the next /wf:pr run stops on a dirty tree unexplained. Then add this reminder without running it (the PR isn't merged yet):

    "After merge: git checkout <base> && git pull --ff-only && git push origin --delete <branch>; git branch -D <branch> (only once the PR shows MERGED; the remote delete is a no-op if GitHub already deleted it), plus git worktree remove <path> if you used a worktree. Never reuse a merged branch."

    For a T2 PR, also state "T2: a human merges". This skill never merges; the line tells the user the PR is not covered by a blanket merge authorization.

The skill ends here.

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.