/building:pre-pr-checkfrom building
Run the repo's documented lint and tests, sweep the diff for secrets, over-long comments and code it could do without, grade this change against the compliance checklist, and weigh its impact and risk. Follow this skill before pushing anything to a shared remote or opening a pull request, and whenever the user asks to review changes or for a pre-push review. Pass --full to add the project-level categories that are near-static between PRs.
Ships in building. 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.
git branch --show-currentgit status --shortgit config --get-regexp 'branch\..*\.stackBase' 2>/dev/null || echo "(none)"gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo "(no PR for this branch)"gh repo view --json defaultBranchRef -q .defaultBranchRef.name 2>/dev/null || echo maingit diff --name-only origin/HEAD...HEAD 2>/dev/null || echo "(cannot resolve origin/HEAD — resolve the base first)"git ls-files ':/AGENTS.md' ':/CLAUDE.md' | grep . || echo "(neither found at repo root)"Edit and Write are for the comment sweep's in-place rewrites and the design
docs it may need; Skill invokes concise-comments; Agent runs the
command discovery and the simplicity sweep. allowed-tools grants
unrestricted Bash deliberately: the lint and test
commands come from the repo's own agent doc and cannot be enumerated in
advance. Every other grant is the minimum the workflow uses.
Gates block. They are the existing behaviour: lint, tests, and a security sweep of what this PR would publish.
Graded categories are scored against the compliance checklist in
references/compliance-checklist.md. Load that file when you reach step 4 —
not before, it is long and most invocations need only part of it.
By default only the checklist's [diff] categories run: they ask "did this
change regress or fail to add it". With --full, the [project] categories
run too: they ask "does the repo have it at all". The project tier is excluded
by default because it is near-static between PRs — running it every time
reprints the same list until someone acts on it, which is how a report becomes
wallpaper.
Run every gate, then grade every applicable category, then report once. A partial report sends the user round the loop again for something this pass could already have told them.
A check that could not run is unknown, reported in its own section. Only an explicit negative from a tool that ran, a completed count of zero, or an empty result from a query that succeeded are confirmed negatives. Never round unknown toward either a pass or a gap. The checklist's preamble carries the reasoning and two worked examples.
Report findings; do not fix them in this pass. A secret already in pushed history needs a rewrite, not a follow-up commit — and silently "fixing" a finding hides the decision the user should be making.
A diff-tier category presupposes the repo already has the thing. Where it does not — no changelog at all, no coverage gate to weaken, no CI to pin actions in — the diff tier is N/A with that absence named, and the gap belongs to the project tier. Grading a pre-existing absence as a diff-tier Missing blocks a PR on something it neither caused nor can reasonably fix.
A category is N/A only when a named exception applies. Say which one. "Probably fine here" is not an exception; that is a gap you have talked yourself out of.
Take the first that applies: the stackBase entry matching this branch, the
open PR's base, the repo default branch. Current state above lists all three.
Every diff-scoped check runs against that base.
Read AGENTS.md, falling back to CLAUDE.md. AGENTS.md wins where a repo
has both. Take the Test and Lint commands from its Commands section.
If either is undocumented, dispatch one sub-agent to answer "how is this repo tested and linted?" from the repo's real signals — build manifests, Makefile or justfile targets, CI workflow jobs. Use its answer for this run, and offer to record it in the agent doc afterwards, following that doc's existing shape rather than inventing a format.
An undocumented command is NOT DOCUMENTED, which is a finding in its own right — not a silent skip.
Run Lint, then Test, then the security sweep. Continue through failures.
The security sweep inspects what this PR would actually publish — the diff
against the base and the new commits' contents — for credentials and secrets,
for personal or internal identifiers, and for anything that would be a problem
once the branch is public. Report every hit with its file:line.
Before reporting a sweep clean, check whether a hit is already established practice in the repo: a home path or an author email that an existing tracked file already carries is not a new disclosure. Say so rather than flagging it fresh each run.
Then the comment sweep. Invoke the concise-comments skill and apply its
rules to every comment the diff adds or changes, rewriting in place the ones
that break a rule. Where real rationale needs more room than a comment allows,
follow that skill's protocol: write the design doc and leave the pointer.
Report each rewrite as file:line, and give each design doc path.
Those rewrites land in the working tree uncommitted, so they need a commit
before the push — an uncommitted rewrite is NOT READY. The sweep is a
backstop: the comment-warn hook already warns as an edit writes an over-long
comment, and this catches what was written outside it.
Then the simplicity sweep. It runs here but does not block. Dispatch one
fresh general-purpose sub-agent, because whoever wrote the diff is the worst
judge of what it could leave out. Brief it with the base, the agent doc path, and
this task, but not your reasoning about the change:
Review
git diff <base>...HEADagainst the "Simplicity" section of the engineering rules, and against the rule to follow the patterns already established in the codebase. For conventions, read the agent doc and the code next to each change: naming, file layout, error handling, test style. Review only the lines the diff adds or changes. Report only; edit nothing. For each finding givefile:line, the rule it breaks, the simpler replacement, and what the replacement removes. For a convention, cite an example of it already in the repo. Skip a finding you cannot back with a concrete replacement.
Check only that each file:line is in the diff and each cited example
exists. Do not drop a finding because you disagree with it: that is the bias
the fresh sub-agent avoids. Each finding that passes is a concern. Report any
you drop, with the reason.
Load references/compliance-checklist.md now.
Work the [diff] categories. Add the [project] categories only if
--full was passed. For each, gather the evidence the checklist names, and
assign Missing, Partial, N/A or unknown. A Partial must name its shortfall; an
N/A must name its exception.
Skip conditional categories in one line when their condition does not hold — a repo that publishes no container image gets one N/A line, not a sub-report.
Answer each question for this diff in one or two sentences. This is judgement, not a gate: no machine checks it, so answer honestly, and say so when unsure.
An answer that shows a problem is a concern. Report it; do not fix it in this pass.
| Gate | Status |
|----------|--------|
| Lint | PASS / FAIL: n findings / NOT DOCUMENTED |
| Test | PASS / FAIL: n failures / NOT DOCUMENTED |
| Security | CLEAN / REVIEW: n items |
| Comments | CLEAN / n rewritten, awaiting commit |
Simplicity:
<file:line> <rule> <simpler replacement> — removes <what>, or none
Graded — this diff:
§n <category> Missing — <what is absent>
§n <category> Partial — <the specific shortfall>
§n <category> N/A — <the exception that applies>
Unknown — could not verify:
§n <category> <why, and what would be needed>
Weighed:
<question> <one or two sentences>
Concerns: <each concern, or none>
Overall: READY / NOT READY
Gaps: n · Unknown: n · N/A: n
NOT READY when a gate fails, when a comment rewrite is still uncommitted, or when a diff-tier category is Missing.
A concern from the simplicity sweep or step 5 does not make the change NOT READY. Do not recommend the push until the user has seen and acknowledged each one.
Everything else is reported without blocking:
Under --full, report the project tier in its own block so it is visibly not
about this diff.
Where gaps merit tracking, offer one issue per gap category — never one aggregate compliance issue, which gets triaged as a single unit and therefore not at all. Check for an existing open issue first. Filing is the user's call: this skill does not create issues.
| Condition | Behavior |
|---|---|
| No agent doc at repo root | Run the sub-agent discovery, report both commands as NOT DOCUMENTED, offer to write the section. |
| Lint or Test undocumented | NOT DOCUMENTED is a finding. Do not silently skip it. |
| Base cannot be resolved | Stop. Every diff-scoped check depends on it. |
| A tool the checklist names is absent | unknown for that category, naming the tool. Never Missing. |
gh call refused for token scope | unknown. The one exception is a 404 from the branch-protection endpoint, which checklist §18 grades. |
| Secret found in already-pushed history | Report it and say plainly that a new commit will not remove it. |
| Conditional category does not apply | One N/A line. No sub-items. |
--full, or skip the diff tier with it.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
10 skills in this plugin
/biasesCounter reasoning biases when investigating, debugging, or searching a codebase or history. Follow this skill when looking for every instance of a pattern, diagnosing an incident, judging a past decision, or answering "has this happened before" — anywhere a partial sample could pass for the whole population./ci-watchWatch a pull request's CI checks and repair failures until they pass. Follow this skill after opening a PR, or when asked to watch, babysit, or fix CI on a PR. Bounded at three fix rounds; never weakens a test to reach green./commitCreate atomic conventional commits. Follow this skill whenever committing code — commit without asking, never push, and sub-agents commit as they go and surface a summary in their return value./concise-commentsUse when writing or editing comments in source code, when a comment is running past two sentences, when explaining non-obvious design context, tradeoffs, constraints or workarounds in code, or when reviewing code that carries long explanatory comment blocks or changelog-style notes. Trigger on 'document this decision', 'explain why this is here', 'make sure the next person understands', 'comment this properly'./draft-prCreate a draft pull request with a standardized body (a blank Intent for the author, then What/Why/How) and conventional-commit title, or hand the user the exact `gh pr create --draft` command to run. Follow this skill whenever opening a pull request, or when the user asks for the command to open one — the draft PR is the human review checkpoint, so the body format is fixed, the title is conventional-commit, and the PR is always marked draft. Main agents only; sub-agents return their work to the main agent to PR./learning-styleSet how Claude presents information to you, and takes it in from you, for this session. Styles are reading, seeing (or visual), doing and listening; give one or more.npx claudepluginhub joelstoddard/guardrails --plugin building