|
| 1 | +--- |
| 2 | +name: review |
| 3 | +description: Quick-reference checklist for code review conventions in leanSpec |
| 4 | +--- |
| 5 | + |
| 6 | +# /review - Code Review Checklist |
| 7 | + |
| 8 | +A concise checklist distilled from CLAUDE.md for reviewing leanSpec code. |
| 9 | + |
| 10 | +## Imports |
| 11 | + |
| 12 | +- All imports at file top — no lazy imports inside functions |
| 13 | +- No confusing renames — use qualified access (`x25519.X25519PublicKey`) |
| 14 | +- `from __future__ import annotations` in every file |
| 15 | + |
| 16 | +## Type Annotations |
| 17 | + |
| 18 | +- Never quote annotations when `from __future__ import annotations` is present |
| 19 | +- Prefer narrow domain types (`Bytes32`, `PeerId`, `RequestId`) over raw `bytes` |
| 20 | +- Complete type hints on all function signatures |
| 21 | + |
| 22 | +## Code Style |
| 23 | + |
| 24 | +- Line length: 100 characters max |
| 25 | +- Google docstring style |
| 26 | +- No example code in docstrings — unit tests serve as examples |
| 27 | +- No section separator comments (`# ====`, `# ----`) |
| 28 | +- Module-level constants use docstrings, not comments |
| 29 | + |
| 30 | +## Documentation |
| 31 | + |
| 32 | +- Never use explicit function or method names in docs — names change |
| 33 | +- Write short, scannable sentences — one idea per line |
| 34 | +- Use bullet points or numbered lists for multiple items |
| 35 | +- Never remove existing documentation unless directly invalidated by a code change |
| 36 | + |
| 37 | +## Testing |
| 38 | + |
| 39 | +- Full equality assertions — assert the whole object, not individual fields |
| 40 | +- Descriptive test names explaining the scenario |
| 41 | +- Use `pytest.raises(ExceptionType, match=r"...")` for error tests |
| 42 | +- Boundary values derived from source constants, never hardcoded |
| 43 | + |
| 44 | +## Architecture |
| 45 | + |
| 46 | +- No backward compatibility code — no shims, aliases, or re-exports |
| 47 | +- No unnecessary abstractions — inline is often better for spec code |
| 48 | +- Simplicity over abstraction — readers should understand top-to-bottom |
| 49 | +- SSZ types: domain-specific names (`Attestations`) over generic (`List4096`) |
| 50 | + |
| 51 | +## Before Committing |
| 52 | + |
| 53 | +```bash |
| 54 | +uvx tox -e fix # Auto-fix formatting |
| 55 | +uvx tox -e all-checks # Verify all checks pass |
| 56 | +``` |
0 commit comments