/agent-skills:pr-authorfrom agent-skills
Write code changes as small, independent pull requests that can merge at any time. Uses git worktrees when the machine has room, splits any bug found on the base branch into its own fix PR so it ships without waiting, keeps PRs non-blocking (flags, expand and contract, owned paths), runs the project's checks locally, self-reviews with a fresh agent running the pr-review skill, opens the PR as a draft until the review is clean so review fixes do not start CI, and hands the PR to the maintainer. Use this skill whenever the user asks to implement a feature or fix and open a PR, work on several branches at once, split work into PRs, or when a roadmap worker from the parallel-roadmap skill builds a node, even if they do not say "pull request".
Ships in agent-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.
Read when SKILL.md points to them.
Every pull request should be able to merge on its own, at any time, without waiting for another one. That is what lets several agents and people work at once without blocking each other. This skill is the habits and tools that make that true.
python3 <skill>/scripts/capacity.py # how many worktrees this machine can take now
python3 <skill>/scripts/wt.py new <branch> --base main # worktree in .worktrees/<branch>, hidden from git status
python3 <skill>/scripts/wt.py list
python3 <skill>/scripts/wt.py remove <branch> [--delete-branch]
python3 <skill>/scripts/wt.py prune-merged --base main [--base dev] [--remote] [--agent-worktrees] [--dry-run]
python3 <skill>/scripts/ci_guard.py # will a push start billed CI? exit 2 means ask first
python3 <skill>/scripts/risk.py --base main # reach, exports, data, dependencies, untested files, suggested rating
The scoped-checks skill provides checks.py (lint, format, typecheck, build, tests) in <skills>/scoped-checks/scripts/. The pr-review skill provides repro.py (fails on base, passes on head) and the review itself. This skill uses them from <skills>/pr-review/scripts/.
Ask only when the answer changes what you do next. Before you ask, write down the next step for each answer. When only one answer moves the task forward, the question has one answer: take that step and report it.
A step that needs approval is a real question, because "no" has its own path. A push that starts billed CI is one: "no" keeps the branch local. Others are deleting remote branches, posting where others see it, and a major changeset. Say in the question what "no" does.
Ask a real question once, list the answer you would pick first, and keep working on everything that does not depend on it.
Run capacity.py. It weighs free memory, CPU load, free disk and existing worktrees.
wt.py new. Several branches (yours or other agents') can then be worked on and checked at the same time.Never work directly in the user's main checkout when it has uncommitted changes. Those are theirs.
Never run git stash when working with worktrees. All worktrees of a repo share one stash list. A stash made in one worktree can be popped or dropped in another, by you or by another agent. The changes then land on the wrong branch or are lost. To set work aside, commit it on its branch (a wip: commit you amend or squash later), or open a new worktree for the other task.
A new worktree has none of the main checkout's gitignored files, such as .env, so tests and dev servers that need them fail there. wt.py new copies the gitignored files that .worktreeinclude names (gitignore syntax, at the repo root) and lists them under copied. Claude Code does the same for the worktrees it creates. When checks need a gitignored file and the repo has no .worktreeinclude, tell the user and suggest adding one with that file's pattern.
Each worktree has an index (shown by wt.py new and wt.py list). When a dev server or test database needs a port, derive it from the index (for example 3000 + 10 * index) so parallel worktrees do not collide.
Find the base with python3 <skills>/pr-review/scripts/branch_policy.py --type <feature|fix|hotfix|...>. Trunk-based repos use the default branch for everything. Gitflow-style repos (a dev or develop branch exists, maybe next) send features and fixes to dev, hotfixes to the default branch, and promote dev -> next -> main in release PRs. A roadmap's GOAL.md or a .github/branches.yml file can set the policy explicitly. When a roadmap node has a target, that wins.
Start from the latest base: git fetch first, then wt.py new <branch> --base origin/<base> or the local base. Name branches by type: feat/..., fix/..., hotfix/..., refactor/..., docs/..., release/.... When the work starts in a worktree with a generated branch name (such as worktree-agent-<hash>), rename it with git branch -m <descriptive name> before the first commit, so the pull request does not carry the generated name. For a roadmap node, use the branch and pr_title from plan.py ready --json.
Hotfix: a fix that must reach the released branch now. Branch from the default branch, open the PR against it, and after it merges open back-merge PRs into the other integration branches (the back_merge list from branch_policy.py, for example next then dev), so the fix is not lost at the next release. A normal fix goes to dev and ships with the next release.
Release: a PR from one stage to the next (dev -> next, next -> main) with no new code in it. Its description lists the changes it promotes. In a roadmap it is a type: release node.
When building a roadmap node, the node's brief is the spec. Stay inside its owned paths.
Prove the problem first. Some changes fix a problem: a bug, a slow path, a memory or size cost, a flake. Such a change starts with proof that the problem exists on the base. That is the smallest test that fails there, or a cost beyond the noise that a profile places in the code you will change. Evidence in a brief, an issue or a planning document is a lead: it may come from an older commit. If the problem does not show, change nothing and report what you measured. Open the pull request only when the same proof passes on the branch.
Read references/non-blocking.md. The short version:
When you find a bug that exists on the base branch (not one your branch introduced):
A vulnerability is the exception. Do not open a fix PR, an issue or an inbox entry for it, and do not push a test that shows it. Stop and report it to the user, or to the orchestrator when you are a subagent, and fix it with the security-fix skill.
repro.py from pr-review, or in a worktree of the base. A bug you cannot show on the base is not ready for a fix PR.wt.py new fix/<slug> --base <base>, add the failing test, fix, check, self-review, open the PR against the branch the policy gives for a fix (or for a hotfix, when the bug is in released code and cannot wait for the next release). It ships on its own, without waiting for your feature.fix-small verdict comes back here as a fix PR. In a roadmap, add a diagnose node instead of running it inside your node.Run the project's checks in the worktree on what the branch changed: python3 <skills>/scoped-checks/scripts/checks.py <worktree> --run --install --changed <base>. The scoped-checks skill says what each check covers and when to run the full set. All of them must pass. When a check also fails on the base, say so in the PR and do not try to fix unrelated failures in this PR.
When the change is a finished feature on code that runs often (render loops, request handlers, parsers, startup) or adds to what a browser downloads, run the perf-pass skill on it now, before the self-review: measure, try several options, keep the one with the best gain for its cost. Put its numbers in the PR's Cost section. Skip the full pass for fixes, docs and changes with no measurable cost, and say so in the PR. A fix on such code still gets one measurement of its trade in step 5c.
Read references/risk.md. Run risk.py --base <base> --head <branch> for the facts: the files that use each changed symbol, exports in entry files, changed migrations or schemas, changed dependencies, and changed files no test names. Then answer the four questions:
bench.py or pr-review's size_diff.py.Rate it low, medium or high. The script's suggestion is a floor: raise it for a hot path, security or concurrency code, and lower it only with a reason. When a roadmap brief has a risk: estimate, the higher of the two counts, and a measured rating above the estimate gets one line saying why. Write the Risk block from references/risk.md into the PR description. A high rating means a fresh review in step 6 and the maintainer in step 7.
Skip this step only for changes with no code or behavior in them, such as a typo in prose or a comment. Say in the PR that it was skipped and why. For everything else, review in one of two modes. Use the mode the caller gives you (a roadmap worker gets it as review from plan.py ready --json). Without one, use self mode for S changes and docs or chore changes, and fresh mode for the rest. A high risk rating from step 5c always uses fresh mode.
Fresh mode. Spawn a fresh agent to review the branch with the pr-review skill in local mode. Give it only the repo path, the base and the branch name. Do not give it your reasoning or a summary of what you did, because a reviewer that sees your reasoning tends to agree with it. The reviewer runs the full checks, so do not run them again on the same commit. A subagent cannot spawn agents. If you are one, as a roadmap worker is, skip the review, open the pull request, and report "fresh review needed": the caller spawns the reviewer and sends you its findings.
Review <branch> against <base> in <repo> with the pr-review skill, in local mode. Do not post anything.
The claim: <PR title and the what-and-why paragraph, the linked issue or roadmap brief>.
Write your expectations (pr-review step 2b) before you read the diff.
Return the verdict, the checks result, the expectation counts, and the findings, sorted into blocking, should fix, nits, and bugs found on the base.
Give the claim, not your summary of the code: the reviewer must form its own expectations from what the change is for. When the reviewer reports "docs tests needed", spawn the docs-test agent from pr-review's references/blind-review.md yourself and send the failures back to the reviewer, or as a roadmap worker report it to the orchestrator.
Self mode. Review the branch yourself in this session. No new agent loads the repo again, so it costs less, but you will tend to agree with your own reasoning. Two steps work against that. First, write down what a complete change would include from the brief or issue alone (the kinds in pr-review's references/blind-review.md: behavior, edge cases, callers, public surface, docs, tests, release), then check the diff against that list. Second, run pr-review's surface.py --base <base> --head <branch> and fix every stale mention it finds. Then read git diff <base>...<branch> from start to end as if someone else wrote it. Go through pr-review's references/evaluation.md (correctness, simplicity, cost, risk), and run the checks once with scoped-checks' checks.py --run --changed <base>. Sort what you find into the same four groups. A self-review never counts toward auto-merge.
Then:
Run at most two review rounds. If blocking findings remain after the second, stop and tell the user what is left instead of looping. Report the mode, the rounds, the verdict and the checks result, so the caller does not review or check again.
ci_guard.py. On a private repo where a push would start workflows, ask the user before pushing: CI minutes there are billed. Until they say yes, keep the branch local and report the local checks. A draft saves CI runs only when the workflows skip drafts. When runs_on_drafts lists workflows, tell the user once, and suggest adding if: ${{ !github.event.pull_request.draft }} to their jobs and ready_for_review to their pull_request types (repo-setup's check.yml has both). Do not edit the workflows in this PR.references/pr-body.md: what and why, changes, proof (the failing test on the base and passing on the branch, for fixes), roadmap node, cost, the Risk block from step 5c, and anything not done.git push -u origin <branch> and gh pr create --draft --base <base> --body-file <file>. Do not merge it.gh pr ready <n>. When the review was already clean before the PR was opened, mark it ready right away. If the review stops with blocking findings left after two rounds, leave it a draft and say why.auto, the orchestrator decides with plan.py can-merge --risk <rating> and may merge it without the user (parallel-roadmap, "Auto-merge"). Report the rating so it can. A high rating always goes to the maintainer. Otherwise, hand it to the maintainer as pr-review describes: if the user is the maintainer, give them the link, the evidence and gh pr review <n> --approve. Otherwise post a short comment that it is ready for maintainer approval and mention them.Write all PR text by the plain-writing rules if that skill is installed.
When the base moves and the PR conflicts, rebase onto the base, resolve the conflicts in the worktree, rerun the checks, and push with --force-with-lease. Resolve conflicts by keeping both sides' intent. When that is not clear, ask the author of the other change or the user.
After a PR merges, run wt.py prune-merged with every integration branch as a --base (for example --base main --base next --base dev, the branches in the policy's promote list). For each merged branch it removes the worktree and the local branch. It asks GitHub for the merged pull request, so squash and rebase merges are found too, and it falls back to commit ancestry without gh. It keeps branches with no commits yet, branches with commits newer than their merged PR, and worktrees with uncommitted changes.
Agents started with worktree isolation leave their checkouts in .claude/worktrees/, and nothing removes them on its own. Add --agent-worktrees to sweep those too. It skips locked worktrees (an agent is still running), worktrees with a commit or checkout in the last 6 hours (--min-age-hours), and worktrees with uncommitted changes. It also removes clean detached review checkouts whose commit is in a base. Run it with --dry-run first when the machine is short on disk.
The remote branch:
--remote to delete the remote branch of each merged PR. Deleting a remote branch is visible to others, so the first time in a repo, show the user what --dry-run --remote would delete and ask. Suggest turning the setting on with gh repo edit --delete-branch-on-merge (also a change others see, so ask).GitHub moves stacked PRs onto the next base when their base branch is deleted after a merge, so deleting a merged fix branch does not break a feature stacked on it.
Opened #57 fix: subtotal skipped the first item -> main (draft until review was clean, now ready: gh pr review 57 --approve)
Opened #58 feat: sales tax on the subtotal -> main (independent of #57, marked ready after review)
Proof (#57): src/cart.test.js fails on main, passes on fix/subtotal-first-item
Checks: lint, build, tests pass locally on both branches
Risk (#57): medium, 6 caller files of roundPrice, reverts alone, +2.1% on bench/cart.js
Self-review: 1 round, 0 blocking, 1 nit fixed, 1 nit left (listed in #58)
Worktrees: .worktrees/fix-subtotal-first-item, .worktrees/feat-tax (pruned after merge)
evals/bug-found-mid-feature/case.yaml (opens in a new tab)evals/bug-found-mid-feature/files/setup.sh (opens in a new tab)evals/bug-found-mid-feature/graders/01-separate-fix-branch.md (opens in a new tab)evals/bug-found-mid-feature/graders/02-fix-branch-focused.md (opens in a new tab)evals/bug-found-mid-feature/graders/03-feature-branch.md (opens in a new tab)evals/bug-found-mid-feature/graders/04-checks.md (opens in a new tab)evals/bug-found-mid-feature/graders/05-self-review.md (opens in a new tab)evals/bug-found-mid-feature/graders/06-main-untouched.md (opens in a new tab)evals/bug-found-mid-feature/graders/07-pr-descriptions.md (opens in a new tab)evals/bug-found-mid-feature/graders/08-exact-half-up.md (opens in a new tab)evals/bug-found-mid-feature/place-files.sh (opens in a new tab)evals/bug-found-mid-feature/prompt.md (opens in a new tab)evals/gitflow-hotfix/case.yaml (opens in a new tab)evals/gitflow-hotfix/files/setup.sh (opens in a new tab)evals/gitflow-hotfix/graders/01-from-main.md (opens in a new tab)evals/gitflow-hotfix/graders/02-pr-to-main.md (opens in a new tab)evals/gitflow-hotfix/graders/03-back-merges.md (opens in a new tab)evals/gitflow-hotfix/graders/04-proof.md (opens in a new tab)evals/gitflow-hotfix/graders/05-branches-untouched.md (opens in a new tab)evals/gitflow-hotfix/place-files.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
17 skills in this plugin
/changesetsWrite the changeset for a change in a repo that releases with changesets (a `.changeset/` folder exists). The bump level follows one question, whether the thing existed before: patch for changed behavior, minor for something new, major only with the maintainer's approval. Use this skill whenever finishing a change, opening a pull request or reviewing one in such a repo, even when nobody asks for a changeset, and when the user asks about bump levels or changelog entries./docs-siteMethod for planning, writing and maintaining a documentation site for a library, CLI, framework, API or app. Splits the site by what the reader needs (learn, do a task, understand, look up) into getting started, guides, concepts and reference, plus examples, troubleshooting, migration and a glossary. Gives each page type a fixed template, including the feature page (what it is, why, how it works, usage, options, limits, related) and the API reference entry. Covers navigation, code examples that run, keeping docs in step with the code, versioned docs and pages agents can read. Includes page templates, a checker script for page structure, links, orphan pages and code fences, and a review checklist. Use this skill whenever writing, restructuring, auditing or reviewing documentation, a docs site, a docs page, a README that has grown into docs, API reference, a getting started page, a migration guide or the docs part of the website/ folder, even if the user does not say "docs site". Load plain-writing with it.npx claudepluginhub lxsmnsyc/agent-skills --plugin agent-skillsOther plugins' skills for the same job