lean-pr
Agnostic PR-workflow skill for the whole Lean ecosystem. Upstream-specific conventions (Lean 4 core; Mathlib 4) live in
references/upstream/lean4-pr.mdandreferences/upstream/mathlib4-pr.md; this skill dispatches into them based on target repo.
Routing
- USE FOR: any PR action against a Lean-ecosystem repo: branch-from-fork, title shaping (
<type>: <subject>for Lean core,<type>(<scope>): <subject>for Mathlib), description authoring (first paragraph = changelog text), label selection per repo, runninglake exe mk_allafter Mathlib file renames, cross-linking dependent PRs via- [ ] depends on: #XXXX. - DO NOT USE FOR: in-tree proof review (
@lean-proof-review); Mathlib-specific review checklists (references/upstream/mathlib4-review.md); writing or fixing the proof itself (@lean-proof); validating the build before pushing (@lean-build); creating a bug-report repro (@lean-mwe). - TRIGGERS: PR, pull request, "open a PR", changelog label, bors,
maintainer-merge,lake exe mk_all, "file upstream", "ready to merge".
Workflow
- Pick conventions — consult the dispatch table (Lean 4 core / Mathlib 4 / Cslib / downstream). Read the relevant
references/upstream/<repo>-pr.mdif unfamiliar. STOP and ask if the target repo isn't in the table. - Title + description — imperative present tense, lowercase subject, no period. First paragraph of description = changelog text, starts with "This PR ...". Skip
## Summary/## Test plan/## Implementation detailsheaders — CI + code carry that. - Labels + commands — apply the repo's label conventions (Mathlib:
t-<topic>/easy/awaiting-author; Lean core:changelog-language/changelog-tactics/ etc. forfeat/fix). For Mathlib file moves:lake exe mk_all. For Lean core: confirm copyright header on new.leanfiles insrc/. - Cross-link + handoff — declare
- [ ] depends on: #XXXXfor any predecessor PR. On merge, history is squash-rewritten → keep the PR description complete (it becomes the merge commit body). For in-tree review feedback received during PR review, hand to@lean-proof-review.
Recovery & STOP
- Unknown target repo (not in dispatch table) → STOP, ask which conventions apply before pushing.
- Missing
changelog-*label on Lean corefeat/fixPR → CI will block; readreferences/upstream/lean4-pr.md§Changelog labels before re-pushing. - Mathlib CI fails after file rename → most common cause is forgetting
lake exe mk_all; re-run and amend. - PR description fails to render the changelog correctly → confirm the first paragraph starts with
This PRand does not have a leading heading. - Branch was opened from main, not a fork → STOP, push to a fork and re-open; both Mathlib and Lean reject PRs from same-repo branches.
Handoffs
- Predecessors / successors: see FM
handoffs. Typical inbound:@lean-build(clean local build),@lean-mwe(for upstream bug-report PRs),@lean-bisect(when filing a known-version regression),@lean-proof-review(when the council green-lit a contribution). Typical outbound:@lean-proof-review(for in-tree feedback) or@lean-zettelkasten(recording PR-process lessons). - REDIRECT pointer:
mathlib-prslug routes here (preserved per Chesterton-protocol). - Source notes: vendor mirror at
vendor/leanprover-skills/skills/lean-pr/SKILL.md.
Lean Ecosystem PR Workflow
This SKILL is the agnostic PR workflow shared across the Lean
ecosystem. The two upstream-specific convention sets — Lean 4 core
(leanprover/lean4) and Mathlib 4 (leanprover-community/mathlib4) —
live as references and are dispatched into below.
W4 Wave 2 / move A1 of lab/design/07-cluster-workflow.md extracted
the per-repo content; mathlib-pr is now a REDIRECT stub pointing
back here.
Dispatch — which conventions apply?
| Target repo | Read first | Title format |
|---|---|---|
leanprover/lean4 |
references/upstream/lean4-pr.md |
<type>: <subject> |
leanprover-community/mathlib4 |
references/upstream/mathlib4-pr.md |
<type>(<scope>): <subject> |
Cslib (cslib) |
references/upstream/mathlib4-pr.md (closest convention sibling) |
<type>(<scope>): <subject> |
| Downstream projects | Repo-local CONTRIBUTING.md if present; otherwise references/upstream/mathlib4-pr.md |
repo-local |
Generic workflow
- Branch from a fork. Mathlib and Lean both reject PRs from branches on the main repo.
- Title using the upstream's convention. Use the dispatch table above to pick the format. Imperative present tense, lowercase subject, no period — these are shared across the ecosystem.
- Description first paragraph carries the changelog text. Start
with
This PR ...and keep it concise. Skip## Summary,## Test plan, and## Implementation detailsheaders — CI handles tests, code handles details. - Apply the right labels. Mathlib:
changelog-*is not used; insteadt-<topic>,easy,awaiting-author. Lean core:changelog-language/changelog-tactics/etc. is mandatory forfeat/fix. See per-repo reference. - Run the upstream's update commands. Mathlib:
lake exe mk_allif files added/removed; Lean core: no analogue. - Cross-link dependencies. Both repos accept the
- [ ] depends on: #XXXXcheckbox syntax in PR descriptions.
Common to all Lean-ecosystem PRs
- Copyright headers on new files in
src/(Lean core) or any.leanfile outsidetests/(Mathlib, Cslib). Use the existing pattern in the directory. - Imperative present tense in commit subjects across the ecosystem.
- No trailing period in subjects.
- Squash on merge is the default for both Lean core (via maintainer squash) and Mathlib (via bors). Your branch history is rewritten — keep the PR description complete because it becomes the merge commit body.
Recovery & STOP
- If unsure which repo conventions apply, fall back to the dispatch table above and read the relevant reference before pushing.
- If a
changelog-*label is missing on a Lean corefeat/fixPR, CI will block — readreferences/upstream/lean4-pr.md§Changelog labels. - If Mathlib CI fails after a file rename, you likely forgot
lake exe mk_all. - For in-tree review feedback during PR review, hand off to
lean-proof-review.
See also
../../../templates/Template_Refactoring.md— Template: Module splitting and import re-organization../../../references/mathlib4-conventions.md— Naming, file headers, capitalization expected in PRs../../../references/upstream/lean4-pr.md— Lean 4 core (leanprover/lean4) PR conventions (W4 Wave 2)../../../references/upstream/mathlib4-pr.md— Mathlib4 PR conventions (W4 Wave 2)../../../references/upstream/mathlib4-review.md— Mathlib PR review standards../mathlib-pr/SKILL.md— REDIRECT stub (legacy slug)