File PR
MUST: the adversarial review runs before the PR is filed
Before filing, the branch diff has had an adversarial code quality review: the
code-quality-review skill, dispatched to a reviewer context that did not
write the code. If it has not run, run it now and act on its findings first.
Violating the letter of this gate is violating the spirit of it. The
review exists to be run by someone who did not write the code; a session that
reasons its way past it has produced the exact outcome the gate prevents.
Honor an explicit user waiver or superseding repository process. Otherwise the
following cases do not require a new review:
- The branch changes no code. Documentation, comments, and config-only
edits with no behavior change. Measured on the diff, not on how routine the
work felt.
- The review already ran on this diff. It was dispatched, it came back,
and its findings were acted on. Loading this skill is not a reason to run it
a second time. Record its revision and dispositions; verify direct corrections.
Material changes to behavior, design, or risk need focused independent follow-up.
Repeat a full review only if subsequent work broadly invalidated it.
Nothing else is an exemption. Not a deadline, not a reviewer waiting, not a
branch that has been open a long time, not the user asking for the PR
directly. If the gate cannot be satisfied, say so and ask; do not file and
mention it afterward.
What the exemptions are not
| The reasoning |
What is actually true |
| "This is trivial: one file, small diff." |
Trivial is not an exemption. Only no code changed is. A one-line change to a conditional is code. |
| "It's just a refactor, behavior is identical." |
A refactor is the change class this review exists for. Structure is its entire subject. |
| "It's config / a version bump / generated output." |
Config that changes behavior is code. If the diff changes what runs, the gate applies. |
| "I reviewed it carefully as I wrote it." |
The author is the one context that cannot run this review. That is stated in code-quality-review, not implied. |
| "I ran the rubric over my own diff and found nothing." |
A self-served pass is not this gate. It is reported as an author's pass or not at all. |
| "The review ran earlier in this work-stream." |
Check its revision and later changes. Verified corrections need no full repeat; material changes need focused follow-up. |
| "The user asked for a PR now, so they've accepted the trade." |
Asking for a PR is not waiving the gate. If time is the constraint, surface it and let them waive it explicitly. |
| "CI is green and the tests pass." |
Passing tests say the code works. This review asks whether it should be built this way. |
| "I'll open it as a draft and get the review after." |
A draft PR is a filed PR. The gate is before filing. |
Red flags: stop and dispatch the review
- Reaching for a synonym of "trivial" to describe a diff that changes code.
- Counting your own pass over your own diff as the review.
- Counting an earlier review without checking whether later changes invalidate it.
- Treating urgency, a waiting reviewer, or a direct "open the PR" as a waiver.
- Filing as a draft to defer the gate.
Each of these means: dispatch the review, then file.
File a finished branch as a PR and see it through: a template-true body, gh pr create, then an autonomous tend loop that fixes red CI (via the fix-ci skill) and
merge conflicts until the PR is green and mergeable, or reports precisely why it
stopped.
When to use
The work on the current branch is ready for a PR and this session is authorized to
push and open one. Missing authorization and missing access are different gaps.
Finish local reviewable preparation, then report the exact delivery step needing
permission or access; do not ask again for authority already given.
The two rules that make the body right
- The body must stand alone. Reviewers arrive with no access to this session,
so the summary and every field are derived from the branch diff and the
ticket, never from "what we discussed this session."
- The PR body belongs to the repo, not to this skill: follow its template, never
replace it. If the repo ships a PR template, the body is that template
filled in: its exact headings, order, checkboxes, and hidden
<!-- markers -->,
with additions only when governing instructions require them, such as a host
attribution footer. The built-in skeleton below is a last resort for
repos that have no template; never emit it, or its Summary / Ticket /
Caveats headings, when a template exists.
Steps
Prepare
Detect branch and base. git branch --show-current; base defaults to main
unless the repo says otherwise. Summarize the change from `git diff
Sync with the base before filing. Fetch the latest base. If the branch is
behind and conflicts, merge the base into the branch and resolve. Mechanical
conflicts (imports, adjacent edits, formatting) resolve confidently; a
semantic collision, where both sides changed the same logic with different intent,
stops the skill. Report it as a decision; do not guess. Never rebase published
commits and never force-push.
Run focused local checks and required local gates. Discover what this repo gates a PR on
rather than assuming a toolchain: read its CI workflow definitions, hook config,
build/package script targets, and contributor docs. Run the fast static
checks (format, lint, type-check) separately from the tests; they are usually
the cheapest to fail: against the freshly-synced base. Run affected tests; full
suites normally run in PR CI. A wider local run needs an explicit local gate or
a specific unresolved integration risk, not merely the existence of a CI job.
If any commit bypassed hooks (--no-verify), the formatter and linter never ran
on it, establish their result manually unless unchanged relevant evidence already
covers them. Fix in-scope failures before filing and disclose baseline issues. A PR opened on a
known-red baseline wastes the tend loop's bounded attempts. Record the exact
commands and results for the report.
Identify the ticket. Scan the branch name, commit messages, and any existing
description for a ClickUp / Linear / Jira id or URL. Exactly one candidate →
carry its full link (never synthesize a URL from a bare id). Multiple
candidates → ask. None → proceed without and note the absence in the report,
asking only if the repo's template has a required ticket field.
Find the repo's PR template (match filenames case-insensitively):
.github/pull_request_template.md / .github/PULL_REQUEST_TEMPLATE.md, any file
under .github/PULL_REQUEST_TEMPLATE/, and the same names in the repo root and
under docs/. Multiple templates → pick the one matching the branch's intent and
record why. Record the search outcome as found (path) or none-found-after-search
before building anything; the fallback is allowed only after a recorded empty
search.
Build the body. If a template was found, fill it verbatim with the same headings, order,
every checkbox, comment markers preserved; map content into the fields it already
has; tick [x] only what was actually verified; leave unfillable fields blank
rather than fabricating. Before finalizing, check your headings against the
template's: same set, same order, none added or renamed; if they differ, you
replaced the template, redo the body. Required host attribution may follow the
template without a new section. If there is no template, use the minimal fallback:
Summary
<what changed and why, grounded in the diff>
Ticket
<ticket link(s), or omit the section if none>
Caveats / follow-ups
<anything the reviewer should know; "none" if none>
Conform to enforced conventions. If the repo enforces PR-title or branch-name
patterns (a title linter, commit-lint, a branch rule), discover the pattern from
the linter / CI config and conform: don't guess a prefix that gets the PR
rejected.
File
- Push and open. Push the branch per the repo's conventions (pull first; use
its push skill if it ships one), then
gh pr create --base <base> --head <branch> with the title and body. Report the PR URL as soon as it exists: the
tending continues after.
See it through
- Watch to a verdict. Checks run through the
fix-ci skill's loop; it
owns the failing-log diagnosis, flake-vs-fault triage, minimal in-session fixes,
the two-attempt cap, and the never-weaken-a-check rule. Watching always runs in a
separate Opus agent on Claude or gpt-5.6-sol agent on Codex, never Astra/Fable or
the parent; accept only results for the target SHA and required checks. Mergeability comes from
gh pr view --json mergeable,mergeStateStatus.
- If the base moves and conflicts appear, merge the base in again, resolve,
and push: at most two re-syncs; a base that keeps moving is reported, not
chased. Semantic collisions stop the loop here too.
- Stop when the PR is green and mergeable, or when a cap is hit, and report
either way.
Output
Verdict-first report:
- PR URL and end state: green and mergeable / still red / conflicted / blocked.
- Validation provenance: the discovered gate commands and each result, by kind
(format / lint / type-check / tests); this lives in the report, and lands in the
PR body only where the template has a testing/QA field for it.
- Ticket link, template used (path, or "none: fallback"), fixes applied (files +
commits), attempts and re-syncs used.
- If stopped early: the diagnosis and the recommended next step.
Boundaries
- Files and tends the PR; never merges it, never enables auto-merge, never
closes or re-targets it.
- Never force-pushes, rebases published commits, or rewrites history: conflict
resolution is merge-based.
- Never deletes, skips, or weakens a failing check to get to green; a red check that
encodes an intended-behavior question is reported as a decision for the user.
- Keep substantive PR text focused on the change. Include attribution required
by governing host/user/repository instructions; do not invent extra footers.
- Hard caps:
fix-ci's two fix attempts for CI, two base re-syncs for conflicts;
after that, report rather than thrash.
- Semantic merge collisions and product decisions are never resolved by guessing.
They end the loop with a plain report.
1---2name: file-pr3description: Always use before or to file/open a PR.4---56# File PR78## MUST: the adversarial review runs before the PR is filed910Before filing, the branch diff has had an adversarial code quality review: the11`code-quality-review` skill, dispatched to a reviewer context that did not12write the code. If it has not run, run it now and act on its findings first.1314**Violating the letter of this gate is violating the spirit of it.** The15review exists to be run by someone who did not write the code; a session that16reasons its way past it has produced the exact outcome the gate prevents.1718Honor an explicit user waiver or superseding repository process. Otherwise the19following cases do not require a new review:2021- **The branch changes no code.** Documentation, comments, and config-only22 edits with no behavior change. Measured on the diff, not on how routine the23 work felt.24- **The review already ran on this diff.** It was dispatched, it came back,25 and its findings were acted on. Loading this skill is not a reason to run it26 a second time. Record its revision and dispositions; verify direct corrections.27 Material changes to behavior, design, or risk need focused independent follow-up.28 Repeat a full review only if subsequent work broadly invalidated it.2930Nothing else is an exemption. Not a deadline, not a reviewer waiting, not a31branch that has been open a long time, not the user asking for the PR32directly. If the gate cannot be satisfied, say so and ask; do not file and33mention it afterward.3435### What the exemptions are not3637| The reasoning | What is actually true |38|---|---|39| "This is trivial: one file, small diff." | Trivial is not an exemption. Only *no code changed* is. A one-line change to a conditional is code. |40| "It's just a refactor, behavior is identical." | A refactor is the change class this review exists for. Structure is its entire subject. |41| "It's config / a version bump / generated output." | Config that changes behavior is code. If the diff changes what runs, the gate applies. |42| "I reviewed it carefully as I wrote it." | The author is the one context that cannot run this review. That is stated in `code-quality-review`, not implied. |43| "I ran the rubric over my own diff and found nothing." | A self-served pass is not this gate. It is reported as an author's pass or not at all. |44| "The review ran earlier in this work-stream." | Check its revision and later changes. Verified corrections need no full repeat; material changes need focused follow-up. |45| "The user asked for a PR now, so they've accepted the trade." | Asking for a PR is not waiving the gate. If time is the constraint, surface it and let them waive it explicitly. |46| "CI is green and the tests pass." | Passing tests say the code works. This review asks whether it should be built this way. |47| "I'll open it as a draft and get the review after." | A draft PR is a filed PR. The gate is before filing. |4849### Red flags: stop and dispatch the review5051- Reaching for a synonym of "trivial" to describe a diff that changes code.52- Counting your own pass over your own diff as the review.53- Counting an earlier review without checking whether later changes invalidate it.54- Treating urgency, a waiting reviewer, or a direct "open the PR" as a waiver.55- Filing as a draft to defer the gate.5657**Each of these means: dispatch the review, then file.**5859File a finished branch as a PR and see it through: a template-true body, `gh pr60create`, then an autonomous tend loop that fixes red CI (via the `fix-ci` skill) and61merge conflicts until the PR is **green and mergeable**, or reports precisely why it62stopped.6364## When to use6566The work on the current branch is ready for a PR and this session is authorized to67push and open one. Missing authorization and missing access are different gaps.68Finish local reviewable preparation, then report the exact delivery step needing69permission or access; do not ask again for authority already given.7071## The two rules that make the body right72731. **The body must stand alone.** Reviewers arrive with no access to this session,74 so the summary and every field are derived from the **branch diff and the75 ticket**, never from "what we discussed this session."762. **The PR body belongs to the repo, not to this skill: follow its template, never77 replace it.** If the repo ships a PR template, the body **is** that template78 filled in: its exact headings, order, checkboxes, and hidden `<!-- markers -->`,79 with additions only when governing instructions require them, such as a host80 attribution footer. The built-in skeleton below is a **last resort for81 repos that have no template**; never emit it, or its `Summary` / `Ticket` /82 `Caveats` headings, when a template exists.8384## Steps8586### Prepare87881. **Detect branch and base.** `git branch --show-current`; base defaults to `main`89 unless the repo says otherwise. Summarize the change from `git diff90 <base>...HEAD` and the commit list rather than session memory.912. **Sync with the base before filing.** Fetch the latest base. If the branch is92 behind and conflicts, **merge the base into the branch** and resolve. Mechanical93 conflicts (imports, adjacent edits, formatting) resolve confidently; a94 **semantic collision**, where both sides changed the same logic with different intent,95 stops the skill. Report it as a decision; do not guess. Never rebase published96 commits and never force-push.973. **Run focused local checks and required local gates.** *Discover* what this repo gates a PR on98 rather than assuming a toolchain: read its CI workflow definitions, hook config,99 build/package script targets, and contributor docs. Run the **fast static100 checks** (format, lint, type-check) separately from the tests; they are usually101 the cheapest to fail: against the freshly-synced base. Run affected tests; full102 suites normally run in PR CI. A wider local run needs an explicit local gate or103 a specific unresolved integration risk, not merely the existence of a CI job.104 If any commit bypassed hooks (`--no-verify`), the formatter and linter never ran105 on it, establish their result manually unless unchanged relevant evidence already106 covers them. **Fix in-scope failures before filing** and disclose baseline issues. A PR opened on a107 known-red baseline wastes the tend loop's bounded attempts. Record the exact108 commands and results for the report.1094. **Identify the ticket.** Scan the branch name, commit messages, and any existing110 description for a ClickUp / Linear / Jira id or URL. Exactly one candidate →111 carry its full **link** (never synthesize a URL from a bare id). Multiple112 candidates → ask. None → proceed without and note the absence in the report,113 asking only if the repo's template has a required ticket field.1145. **Find the repo's PR template** (match filenames **case-insensitively**):115 `.github/pull_request_template.md` / `.github/PULL_REQUEST_TEMPLATE.md`, any file116 under `.github/PULL_REQUEST_TEMPLATE/`, and the same names in the repo root and117 under `docs/`. Multiple templates → pick the one matching the branch's intent and118 record why. **Record the search outcome** as found (path) or none-found-after-search119 before building anything; the fallback is allowed only after a recorded empty120 search.1216. **Build the body.** If a template was found, fill it **verbatim** with the same headings, order,122 every checkbox, comment markers preserved; map content into the fields it already123 has; tick `[x]` only what was actually verified; leave unfillable fields blank124 rather than fabricating. Before finalizing, check your headings against the125 template's: same set, same order, none added or renamed; if they differ, you126 replaced the template, redo the body. Required host attribution may follow the127 template without a new section. If there is no template, use the minimal fallback:128129 > ## Summary130 > `<what changed and why, grounded in the diff>`131 >132 > ## Ticket133 > `<ticket link(s), or omit the section if none>`134 >135 > ## Caveats / follow-ups136 > `<anything the reviewer should know; "none" if none>`1377. **Conform to enforced conventions.** If the repo enforces PR-title or branch-name138 patterns (a title linter, commit-lint, a branch rule), discover the pattern from139 the linter / CI config and conform: don't guess a prefix that gets the PR140 rejected.141142### File1431448. **Push and open.** Push the branch per the repo's conventions (pull first; use145 its push skill if it ships one), then `gh pr create --base <base> --head146 <branch>` with the title and body. Report the PR URL as soon as it exists: the147 tending continues after.148149### See it through1501519. **Watch to a verdict.** Checks run through the **`fix-ci` skill's loop**; it152 owns the failing-log diagnosis, flake-vs-fault triage, minimal in-session fixes,153 the two-attempt cap, and the never-weaken-a-check rule. Watching always runs in a154 separate Opus agent on Claude or gpt-5.6-sol agent on Codex, never Astra/Fable or155 the parent; accept only results for the target SHA and required checks. Mergeability comes from156 `gh pr view --json mergeable,mergeStateStatus`.15710. **If the base moves and conflicts appear**, merge the base in again, resolve,158 and push: at most **two** re-syncs; a base that keeps moving is reported, not159 chased. Semantic collisions stop the loop here too.16011. **Stop when the PR is green and mergeable, or when a cap is hit**, and report161 either way.162163## Output164165Verdict-first report:166167- PR URL and end state: **green and mergeable** / still red / conflicted / blocked.168- Validation provenance: the discovered gate commands and each result, by kind169 (format / lint / type-check / tests); this lives in the report, and lands in the170 PR body only where the template has a testing/QA field for it.171- Ticket link, template used (path, or "none: fallback"), fixes applied (files +172 commits), attempts and re-syncs used.173- If stopped early: the diagnosis and the recommended next step.174175## Boundaries176177- Files and tends the PR; **never merges it**, never enables auto-merge, never178 closes or re-targets it.179- Never force-pushes, rebases published commits, or rewrites history: conflict180 resolution is merge-based.181- Never deletes, skips, or weakens a failing check to get to green; a red check that182 encodes an intended-behavior question is reported as a decision for the user.183- Keep substantive PR text focused on the change. Include attribution required184 by governing host/user/repository instructions; do not invent extra footers.185- Hard caps: `fix-ci`'s two fix attempts for CI, two base re-syncs for conflicts;186 after that, report rather than thrash.187- Semantic merge collisions and product decisions are never resolved by guessing.188 They end the loop with a plain report.