npx claudepluginhub cbirkbeck/mathlib-quality --plugin mathlib-quality# /pre-submit - Pre-PR Submission Checklist Final verification before submitting a PR to mathlib. ## Usage ## Checklist ### 1. Compilation - [ ] `lake build` succeeds without errors - [ ] No warnings in modified files - [ ] All `sorry` removed - [ ] No `#check`, `#print`, `#eval` debugging statements ### 2. File Quality For each modified file: - [ ] File length โค 1500 lines - [ ] All lines โค 100 characters - [ ] Proper copyright header - [ ] Module docstring present - [ ] Imports organized and minimal ### 3. Code Quality - [ ] No bare `simp` (use `simp only`) - [ ] No `set_option m...
Final verification before submitting a PR to mathlib.
/pre-submit [file_path or directory]
lake build succeeds without errorssorry removed#check, #print, #eval debugging statementsFor each modified file:
simp (use simp only)set_option maxHeartbeatsset_option trace.*set_option pp.*@[nolint] is justifiedfeat/fix/refactor/docs(area): descriptionlake build
Verify no errors in output.
/check-style [modified_files]
Address all ๐ด and ๐ก issues.
lake exe runLinter [modified_files]
Fix any linter errors.
-- Search for these patterns and remove if found:
sorry
#check
#print
#eval
set_option trace
set_option pp
set_option maxHeartbeats
For each public declaration:
lake build
Ensure clean build.
## Pre-Submit Check: [project/files]
### โ Build Status
- Compilation: โ Successful
- Warnings: 0
- Errors: 0
### โ File Quality
| File | Lines | Max Line | Header | Docstring |
|------|-------|----------|--------|-----------|
| Foo.lean | 234 | 98 | โ | โ |
| Bar.lean | 456 | 95 | โ | โ |
### โ Code Quality
- sorry: 0 found
- Debug options: 0 found
- Bare simp: 0 found
### โ Documentation
- Public declarations: 15
- With docstrings: 15
- Missing: 0
### โ Linters
- Errors: 0
- Warnings: 0
### PR Checklist
- [ ] Title format: `feat(Algebra): add FooBar lemmas`
- [ ] Description written
- [ ] Related issues: #1234
### Ready for Submission: โ
---
To submit:
1. Create branch: `git checkout -b feat/foo-bar`
2. Commit changes: `git commit -m "feat(Algebra): add FooBar lemmas"`
3. Push: `git push -u origin feat/foo-bar`
4. Create PR via GitHub
โ Found sorry at:
- Foo.lean:45
- Bar.lean:123
Action: Complete these proofs before submission
โ Found debug options:
- Foo.lean:12: set_option trace.Meta.Tactic.simp true
- Bar.lean:34: set_option maxHeartbeats 400000
Action: Remove debug options
โ Missing docstrings:
- Foo.lean:67: def importantFunction
- Bar.lean:89: theorem keyResult
Action: Add docstrings for public API
โ Linter errors:
- Foo.lean:45: unused argument 'x'
- Bar.lean:67: simp lemma not in normal form
Action: Fix linter errors or add justified @[nolint]
type(scope): description
Types:
- feat: New feature
- fix: Bug fix
- refactor: Code restructuring
- docs: Documentation only
- style: Formatting only
- perf: Performance improvement
- test: Adding tests
- chore: Maintenance
Scope: Area of mathlib (Algebra, Topology, Analysis, etc.)
Examples:
- feat(Algebra/Ring): add comm_ring instance for Foo
- fix(Topology): correct definition of LocallyCompact
- docs(Analysis/Calculus): improve docstrings for derivative lemmas
- refactor(Data/List): simplify proof of length_append
references/style-rules.mdreferences/naming-conventions.mdreferences/linter-checks.mdAfter completing the pre-submit check and showing the report, capture any notable findings.
For each significant issue found, write a JSON entry to .mathlib-quality/learnings.jsonl (create the file and directory if they don't exist):
{
"id": "<generate a short unique id>",
"timestamp": "<current ISO timestamp>",
"command": "pre-submit",
"type": "<style_correction|naming_fix|golf_pattern|failed_pattern>",
"before_code": "<the problematic code, max 500 chars>",
"after_code": "<the fix if applied, max 500 chars>",
"pattern_tags": ["<relevant pattern names>"],
"description": "<1-2 sentence description of what was caught in pre-submit>",
"math_area": "<analysis|algebra|topology|number_theory|combinatorics|order|category_theory|measure_theory|other>",
"accepted": true,
"source": "agent_suggestion",
"context": {
"file_path": "<relative path>",
"theorem_name": "<if applicable>"
}
}
What to capture from pre-submit:
What NOT to capture:
/cleanup or /check-style runsKeep it lightweight - only 1-3 entries per command run, focusing on lessons for future runs.