Skip to content

Commit d1929b9

Browse files
committed
feat: enhance AGENTS.md with detailed style, linting, and organization guidelines
1 parent eb2eb63 commit d1929b9

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

AGENTS.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22

33
## Style and Linting
44
- Python formatting and linting is handled by **ruff**.
5-
- Rust code must pass `cargo fmt`, `cargo clippy`, and `cargo tomlfmt`.
5+
- Follow [PEP 8](https://www.python.org/dev/peps/pep-0008/) and these key
6+
ruff rules:
7+
- Use double quotes for string literals
8+
- Use explicit relative imports such as `from .module import Class`
9+
- Limit lines to 88 characters
10+
- Provide type hints for parameters and return values
11+
- Avoid unused imports
12+
- Prefer f-strings over other string formatting
13+
- Avoid `else` blocks after `return`
14+
- Use `isinstance()` instead of direct type comparison
15+
- Keep docstrings concise in Google format
16+
- Assign exception messages to variables before raising
17+
- All modules, classes, and functions should include docstrings.
18+
- Tests must use descriptive function names, pytest style assertions, and be
19+
grouped in classes when appropriate.
20+
- Rust code must pass `cargo fmt`, `cargo clippy`, and `cargo tomlfmt` and
21+
should omit unnecessary parentheses around `if` conditions.
622
- Install the pre-commit hooks with `pre-commit install` and run them with
723
`pre-commit run --files <file1> <file2>` or `pre-commit run --all-files`.
824
- The same checks can be run manually using the scripts in `ci/scripts`:
@@ -11,6 +27,19 @@
1127
- `./ci/scripts/rust_clippy.sh`
1228
- `./ci/scripts/rust_toml_fmt.sh`
1329

30+
## Code Organization
31+
- Keep functions focused and under about 50 lines.
32+
- Break complex tasks into well-named helper functions and reuse existing
33+
helpers when possible.
34+
- Prefer adding parameters to existing functions rather than creating new
35+
versions with similar behavior.
36+
- Avoid unnecessary abstractions and follow established patterns in the
37+
codebase.
38+
39+
## Comments
40+
- Add meaningful comments for complex logic and avoid obvious comments.
41+
- Start inline comments with a capital letter.
42+
1443
## Running Tests
1544
1. Ensure submodules are initialized:
1645
```bash

0 commit comments

Comments
 (0)