/jleechan-skills:pr-lifecyclefrom jleechan-skills
Lifecycle contract for opening PRs, driving them green, and fixing CI. Activates on PR open, green drive, CI fix, and slash commands /green, /es, /er, /advice.
Ships in jleechan-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This is the self-contained generic lifecycle contract. PR Workflow Manager is the command and branch entry point; keep its draft, stage, evidence-applicability and safety guidance in sync with this file.
Before selecting a review route, apply the Codex review dispatch policy when the originating PR driver is Codex, including its delegated runtimes. Codex defaults to at most three review rounds per PR; each round must account for its applicable seats across stages, and its explicit assignment ceiling does not waive a required independent gate. The policy limits automatic dispatch, not evidence collection or self-review, and does not replace the shared-default or repository rules for each seat's scope, quorum, evidence, or qualifications. Claude and agy keep the existing routes.
Before a candidate's first review dispatch, apply the access-smoke rule in advice's candidate checks. The same rule applies to each driver and selected seat across PR workflows and stage driving.
An unqualified /prw (/pr-workflow) defaults to driving the PR to FINAL_READY across all applicable Stage 5 gates, unless explicitly requested earlier. One session goal covers all PR work.
FINAL_READY (or an explicit earlier user endpoint). Reuse a matching existing goal without recreating it; preserve an unrelated active goal unless the user explicitly authorizes replacement; do not create per-PR duplicate goals. Never revive or re-install a goal the user cleared, paused, or stopped without a fresh explicit instruction. When unsupported or unavailable, fall back cleanly to the driver and PR obligation/execution record without claiming native goal activation or blocking authorized work. Verify actual persisted goal state/readback and functioning ownership/resumption separately rather than treating goal prose, a printed /goal line, or command delivery as activation.Goal: activated via <cmux|tmux|native> (readback ok), Goal: already active (reused|preserved-different), Goal: not set (<reason>), Goal: unsupported (<reason>), or Goal: unverified (<reason>) before the first PR-mutating action. Under plain tmux, use cmux-goal § tmux (bin/self_goal.py set, run only in the manager's verified isolated mode), which prints that line itself; silence is a contract violation. Read-only prerequisite inspection (including condition clause probes) may precede activation; activation and its truthful Goal: line must precede the first PR-mutating action (push, label, comment, edit). Write a user-set earlier stop or read-only limit into the goal condition as an "or" alternative, never as an extra required conjunct, so the Stop hook cannot deadlock.FINAL_READY certifies required obligations, checks, and receipts are complete. Merging requires separate authority under ~/.codex/AGENTS.md § Merge safety and repository policy. If authorized, merge executes immediately before optional reporting.FINAL_READY is verified (and merge executed if authorized); orExecute the PR's next unmet obligation continuously through FINAL_READY. Status replies do not end the request: refresh live state, answer briefly, then resume. Own started jobs and delegated lanes through results under parallelize-to-ceiling; integrate their artifacts. Stop only at the requested endpoint, user stop, or genuine external blocker. Missing reviewer votes are not such a blocker: once the order of attempts is finished, run the self-review fallback; the blocker record described below then names only the withheld final approval while other work continues. After a quota or rate-limit error, a restart or a dead lane, re-read the execution record and live PR state and re-validate it against the current head, and resume the earliest unmet obligation in that turn without waiting for a nudge (unless the user stopped or redirected), replacing the lane or using another eligible seat under the advice identity and counting rules and candidate access checks. Use current timestamped health evidence for the replacement seat. If only liveness is unknown and the other access prerequisites are verified, follow that same rule for the next eligible seat’s ordinary first authorized dispatch, including during recovery. Votes retain their candidate binding and canonical independence/class caps; a shared quota blocks every affected seat. If no eligible available seat can fill the remaining review within the authorized dispatch budget, state the evidenced constraint once as the blocker with its exact unblock condition (account quota reset, resource availability or missing authorization) and watch that condition instead of asking again. Print one line rendering the current stage (six-stage repositories) or lifecycle phase and the execution record: next_action, owner, job_handle and wake_condition, or the blocker. Print it at each stage change, at least every 15 minutes during a wait (alongside a source check, never as a standalone ping), and to close a turn that ends before the endpoint (the exit conditions above still decide whether it may).
Target repository instructions (AGENTS.md, CLAUDE.md) take precedence within their domain. Apply shared defaults only where silent; never remove a local requirement or infer an ungranted exception. A repository or operator PR overlay refines these defaults as described in pr-workflow-manager. Bind head repository, branch, SHA, and base from live PR metadata (gh pr view).
An existing user or standing authorization keeps covering the same action, target and outcome within its stated spending, request and retry bounds. Re-pin and review each newly prepared plan or plan SHA before execution; that is an integrity check, not a request for renewed human approval. A required validation or evidence step does not itself authorize extra paid work; obtain new authority only for paid work outside the authorized scope or beyond its bounds. Other merge, security, retry, source-integrity, budget and evidence gates can still block execution.
Use the selected route and repository policy to identify required obligations; conditional gates become required when their changed-claim or route conditions hold. Keep optional polish and telemetry off that critical path. Execute the next unmet obligation in the existing ledger through this cycle: no parallel checklist or new controller.
FINAL_READY is reached only when every applicable draft and closing obligation passes, current checks are green, and required receipts are published and read back from the PR. Synchronize the final presentation and verify it reflects those facts (scoping readiness strictly to the PR's own applicable obligations, while keeping additional unreviewed runtime or measurement closure claims marked UNVERIFIED per review-records.md without holding the PR for an optional report). For applicable visual claims, confirm published media renders in the PR body per evidence standards, and confirm video visual review accounts for every decoded source frame per visual verification.
Where repository policy requires video playback for an action/result claim, require the receipt to state the actual inspection/playback method and covered action-to-result time range; neither sampled frames nor all-frame image analysis substitutes for playback. If required playback is unavailable, keep that claim PENDING while retaining useful sampled observations; structural receipt checks prove presence, not perception.
FINAL_READY: This check also applies before any interim report that presents the PR as complete, ready or awaiting approval (such checkpoints are still not completion); that report carries each headline claim as proven (with its proof link) or UNVERIFIED, and each review verdict with reviewer and SHA. Before synchronizing FINAL_READY (or closing a broader task claim alongside a PR), check each headline claim directly against its actual proof:
UNKNOWN/null rather than 0, avoid keyword/repo heuristics for route claims, and label pre-change window cutoffs as baselines rather than post-change effect.UNVERIFIED; a stage label or narrower file approval cannot fill it.
Before merging, re-read the live review state at the exact head, including bot reviews and inline comments and any open CHANGES_REQUESTED decision; triage each open item (fix it, or record a reasoned disposition) without making advisory bots a gate or a wait. Authority: user-approved proposal (iMessage, 2026-11-28 15:11, approved 15:17). Then populate a missing merge_authorization field from applicable authority already in hand and revalidate its conditions against the exact head and counted delta, including any size tier; never repeat an approval question already answered for this scope. Once FINAL_READY is verified and merge authority holds at the exact head and merge_authorization: authorized is recorded, execute the merge immediately before optional post-merge reporting, telemetry snapshots, or secondary bookkeeping so optional bookkeeping cannot delay an authorized merge (while mandatory pre-merge gates, exact-head verification, and required receipt publication/readback still precede merge).Handoff transitions: The active driver owns both handoffs without an unattended gap:
evidence_ready_at), dispatch the required review immediately (review_requested_at) and verify actual reviewer pickup (actual_review_started_at); acknowledgment alone is not review start.review_return_at), start the next substantive action (next_substantive_action_started_at): apply supported fixes, advance the stage, or execute an authorized merge. Keep any independent authorized work moving while another result is pending.DRAFT
→ Route selection & exemptions (qualified Markdown instruction-only route skips separate /es and /er; documentation allowlist exempts /er but retains applicable /es)
→ When pinned source ready: Table-selected source review PASS @ SHA
(runs concurrently with independent evidence work;
votes still short once every seat in the order of attempts has a receipt or an evidenced skip reason:
self-review fallback for this gate only, final approval withheld)
→ For routes requiring evidence:
1. Complete evidence bundle (/es @ SHA; early preflight != final PASS)
2. Required independent visual findings (/visual-verification PASS @ SHA, for visual claims)
3. Closing evidence review (/er PASS @ SHA, adjudicating evidence + visual findings)
→ Mark ready-for-review (gh pr ready <N>)
→ /ready work: /green, comments, conflicts, regressions
→ Final closing /er and source review coverage applicable to candidate
→ FINAL_READY
→ Separate merge authorization
Before undrafting (gh pr ready <N>), select route and satisfy applicable gates:
/es or /er adjudication; they satisfy draft review through route-defined scenario review(s) and Markdown structure checks. Ordinary documentation-only exceptions under exceptions.md exempt /er under their exact allowlist, but retain applicable /es (proportionate diff/link/structure checks; no runtime proof added to ordinary docs merely by size).APPROVED at <SHA>) can start as soon as pinned source is ready, running concurrently with independent evidence work. When its votes are still short once every seat in the order of attempts has a receipt or an evidenced skip reason, the self-review fallback satisfies this gate, and only this gate, for progress./es) — When evidence is required, prepare the complete evidence bundle bound to tested SHA per ../evidence-standards/SKILL.md. An early evidence preflight checks artifact completeness, but is not final PASS./visual-verification) — When rendered-media review applies under the selected repository policy (or the shared default applies), an independent visual seat decodes media, inspects frames, and confirms VISUAL APPROVED at <40-char-sha> before closing evidence review (requiring two independent visual seats before undraft for headline visual claims unless a qualified one-vote UI route or explicit SINGLE-SEAT limitation applies, preserving independent author/evidence-seat rules per review-routing.md)./er) — When /er is required, obtain closing evidence review PASS (not PARTIAL/FAIL/INCONCLUSIVE) under review-routing.md, adjudicating complete evidence and visual findings when those are required.gh pr ready <N> once all applicable draft-phase gates pass, with gate 2 met for progress by the self-review fallback when it applies, or earlier only under the preview-deploy exception below.Preview-deploy exception (early undraft): When a repository's preview deployment workflow runs only on non-draft PRs (for example worldarchitect.ai's .github/workflows/pr-preview.yml, which triggers on the ready_for_review event and is gated on pull_request.draft == false) and a preview deployment is needed for evidence, the driver may run gh pr ready <N> before the draft-phase gates pass solely to trigger that preview. An early undraft under this exception passes no draft-phase gate, does not establish readiness, and grants no merge authority: every applicable gate above must still pass before FINAL_READY, /ready and closing obligations are unchanged, and merge still requires its separate authorization. In a repository opted into the six-stage title/label convention, the stage tag/label keeps tracking the earliest unmet gate — an early undraft for preview does not advance the stage, and label sync rules are unchanged.
/ready, then final reviewsUndrafting starts /ready; it does not establish readiness. Invoke ready for current-head /green, conflict resolution, and regression checks. Once ready-phase work stabilizes, complete final closing /er and source review coverage per review-routing.md. Reusing valid earlier approvals via delta assessment is permitted; duplicate reviews are not required when coverage applies. Report READY only when all closing obligations pass.
Resolve and read ../advice/SKILL.md or ../web-advice/SKILL.md. If absent, report UNAVAILABLE and keep dependent gates open; never invent a replacement runner or self-certify approvals.
/prwDrive every PR through /prw by default. UI and user-facing changes always use /prw unless an explicit human instruction overrides it for that PR. Lighter paths (documentation-only, qualified non-production changes, backup/mirror repos, or very small changes) drop intermediate stage transitions but retain all required checks, independent reviews, and merge authorization. When unsure, use /prw. See review-routing.md for full lighter-path eligibility and exclusions.
Explore → outcome spec → TDD (failing test first) → unit/integration tests → correctness review → targeted fixes. Collect expensive evidence only after code stabilizes.
Merge authorization follows the shared size-tiered rule in ~/.codex/AGENTS.md § Merge safety and explicit target-repository policy. This skill neither requires nor waives a human MERGE APPROVED phrase where the governing rule does not; explicit local approval requirements stay in force. The execution record's merge_authorization records which of these sources applies, with its quote; it adds no requirement beyond them. Earlier-SHA review applicability for readiness does not satisfy a stricter exact-head condition on a separately authorized automatic-merge route; keep that merge condition unless the human explicitly changes it. Readiness or this refactor grants no new permission.
See review-routing.md for the 9-class risk and claim matrix.
See review-routing.md.
See review-routing.md.
See review-routing.md.
See review-recovery.md.
Missing reviewer votes never stop the work. When every seat in the order of attempts has a receipt or an evidenced skip reason and the route's independent votes are still short, the driver's recorded self review counts for progress in place of the source-review gate: pass every other draft gate, undraft, get CI green and finish every other obligation, but withhold final approval and do not merge on it. See review-recovery.md.
See review-routing.md.
See review-routing.md.
See review-routing.md.
See review-recovery.md.
See review-recovery.md.
Only for a repository that explicitly adopts it, load the stage-specific rules in six-stage.md: specification placement, stage titles/labels (stage:0-spec to stage:5-final-approval), and Stage 5 closing validation.
See review-records.md for PR description review ledgers and observational Scratch telemetry. For every PR, also load evidence publication, including applicable inline media, receipt indexing and route exemptions; that shared section does not require adopting the six-stage presentation workflow.
See exceptions.md for trivial-change, one-liner fast path, and documentation allowlist rules.
For a diff that may be documentation-only, see exceptions.md: it owns the CI exception and the narrow /er allowlist. Use its existing canonical changed-path helper rather than by eye.
What SKILL.md sets; muted values are Claude Code's defaults
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: commands: Invalid input, agents.0: Invalid string: must start with "./", agents.0: Invalid string: must end with ".md", skills.0: Invalid string: must start with "./"
.claude-plugin/plugin.json: commands: Invalid input, agents.0: Invalid string: must start with "./", agents.0: Invalid string: must end with ".md", skills.0: Invalid string: must start with "./"
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
Other plugins' skills for the same job
242 skills in this plugin
/4layer/4layer - Four-Layer Minimal Repro Testing Protocol/ablationUse when diagnosing a bug in LLM/model behavior, or any stochastic system, where the cause is disputed or theorized rather than measured. Slash commands `/ablation` and `/abal`. Enforces the rule that you manipulate the REAL captured input and replay it through the REAL production path, one variable at a time, with a verbatim control arm run first to establish the base rate. Trigger phrases include "ablation", "ablate", "what actually causes", "is X the trigger", "prove the root cause", "A/B the payload", "does removing X fix it", "why does the model do this", "test the hypothesis", "root cause is disputed"./accept-adapt-reject