-
Notifications
You must be signed in to change notification settings - Fork 44
agents: add code review and debugging skills #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tcoratger
merged 2 commits into
leanEthereum:main
from
morelucks:agents/add-review-and-debug-skills
Mar 15, 2026
+137
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| name: review | ||
| description: Quick-reference checklist for code review conventions in leanSpec | ||
| --- | ||
|
|
||
| # /review - Code Review Checklist | ||
|
|
||
| A concise checklist distilled from CLAUDE.md for reviewing leanSpec code. | ||
|
|
||
| ## Imports | ||
|
|
||
| - All imports at file top — no lazy imports inside functions | ||
| - No confusing renames — use qualified access (`x25519.X25519PublicKey`) | ||
| - `from __future__ import annotations` in every file | ||
|
|
||
| ## Type Annotations | ||
|
|
||
| - Never quote annotations when `from __future__ import annotations` is present | ||
| - Prefer narrow domain types (`Bytes32`, `PeerId`, `RequestId`) over raw `bytes` | ||
| - Complete type hints on all function signatures | ||
|
|
||
| ## Code Style | ||
|
|
||
| - Line length: 100 characters max | ||
| - Google docstring style | ||
| - No example code in docstrings — unit tests serve as examples | ||
| - No section separator comments (`# ====`, `# ----`) | ||
| - Module-level constants use docstrings, not comments | ||
|
|
||
| ## Documentation | ||
|
|
||
| - Never use explicit function or method names in docs — names change | ||
| - Write short, scannable sentences — one idea per line | ||
| - Use bullet points or numbered lists for multiple items | ||
| - Never remove existing documentation unless directly invalidated by a code change | ||
|
|
||
| ## Testing | ||
|
|
||
| - Full equality assertions — assert the whole object, not individual fields | ||
| - Descriptive test names explaining the scenario | ||
| - Use `pytest.raises(ExceptionType, match=r"...")` for error tests | ||
| - Boundary values derived from source constants, never hardcoded | ||
|
|
||
| ## Architecture | ||
|
|
||
| - No backward compatibility code — no shims, aliases, or re-exports | ||
| - No unnecessary abstractions — inline is often better for spec code | ||
| - Simplicity over abstraction — readers should understand top-to-bottom | ||
| - SSZ types: domain-specific names (`Attestations`) over generic (`List4096`) | ||
|
|
||
| ## Before Committing | ||
|
|
||
| ```bash | ||
| uvx tox -e fix # Auto-fix formatting | ||
| uvx tox -e all-checks # Verify all checks pass | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| name: workflows | ||
| description: Common developer workflows, commands, and troubleshooting for leanSpec | ||
| --- | ||
|
|
||
| # /workflows - Repository Workflows | ||
|
|
||
| Common developer workflows and commands for working in leanSpec. | ||
|
|
||
| ## Running Specific Tests | ||
|
|
||
| ```bash | ||
| # Single test file | ||
| uvx tox -e pytest -- tests/lean_spec/subspecs/networking/discovery/test_transport.py -v | ||
|
|
||
| # Single test class or method | ||
| uvx tox -e pytest -- -k "TestDiscoveryTransport::test_start" -v | ||
|
|
||
| # With print output visible | ||
| uvx tox -e pytest -- -s -k "test_name" | ||
| ``` | ||
|
|
||
| ## Resolving Type Errors | ||
|
|
||
| The project uses two type checkers. Run them separately to isolate issues: | ||
|
|
||
| ```bash | ||
| # Full type check (ty — the primary checker used in CI) | ||
| uvx tox -e typecheck | ||
|
|
||
| # Lint check (ruff — catches style and import issues) | ||
| uvx tox -e lint | ||
| ``` | ||
|
|
||
| Common type error patterns: | ||
| - `invalid-assignment` — Wrong type assigned; check if a domain type (`RequestId`, `PeerId`) is expected instead of raw `bytes` | ||
| - `invalid-argument-type` — Function argument type mismatch; verify the function signature | ||
| - `union-attr` — Accessing attribute on a possibly-`None` value; add an `assert is not None` guard | ||
|
|
||
| ## Inspecting Coverage | ||
|
|
||
| After running tests, coverage reports are generated: | ||
|
|
||
| ```bash | ||
| # View coverage in terminal | ||
| uvx tox -e pytest | ||
|
|
||
| # Open HTML report | ||
| open htmlcov/index.html | ||
| ``` | ||
|
|
||
| ## Running Interop Tests | ||
|
|
||
| Interop tests are excluded from the default test run. Run them explicitly: | ||
|
|
||
| ```bash | ||
| uv run pytest tests/interop/ -v | ||
| ``` | ||
|
|
||
| ## Spell Check Failures | ||
|
|
||
| ```bash | ||
| # Run spell check | ||
| uvx tox -e spellcheck | ||
|
|
||
| # Add legitimate words to the ignore list | ||
| echo "newword" >> .codespell-ignore-words.txt | ||
| ``` | ||
|
|
||
| ## Markdown Formatting | ||
|
|
||
| ```bash | ||
| # Check markdown formatting (docs only) | ||
| uvx tox -e mdformat | ||
| ``` | ||
|
|
||
| ## Common Pitfalls | ||
|
|
||
| - **Tests pass locally but CI fails**: CI runs checks across Python 3.12, 3.13, and 3.14. Ensure no version-specific syntax is used. | ||
| - **`ruff format` changes after `ruff check --fix`**: Always run format after fix — the fixer doesn't guarantee formatting compliance. | ||
| - **Import ordering issues**: Run `uvx tox -e fix` to auto-sort imports. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.