|
| 1 | +- Naming/labels: |
| 2 | + - use camelCase, full words, no abbreviations, no single-character identifiers, no bare `_` |
| 3 | + - callables should read as explicit subject-verb-object where practical |
| 4 | + - preserve domain casing/spelling for AST names, column names, exported symbols, mapping keys, filenames |
| 5 | + - filesystem semiotics: `path` = directory, `filename` = name only, `pathFilename` = full path |
| 6 | +- Formatting: |
| 7 | + - `.editorconfig` then `pyproject.toml`/`ruff.toml` are authoritative |
| 8 | + - preserve existing formatting/alignment; do not rewrite unrelated style |
| 9 | + - Python code uses tabs; multiline calls/ordered sequences prefer leading commas; order-agnostic collections use trailing commas |
| 10 | + - semantic line breaks, operators at line starts on continuations, closing delimiters on their own lines when elements span lines |
| 11 | +- Syntactic clarity: |
| 12 | + - optimize for left-to-right parsing; avoid deferred/hidden operators in complex expressions |
| 13 | + - replace ambiguous numeric adjustments with semantic identifiers from shared SSOT modules when available |
| 14 | + - normalize comparisons toward `<` / `<=` |
| 15 | + - prefer absolute imports from public APIs; package root exports are the public surface |
| 16 | +- Types: |
| 17 | + - keep annotations complete and precise; no `Any`, no bare `object`, no weak containers |
| 18 | + - use PEP 585/604 syntax; prefer `Sequence`/`Mapping` for read-only params |
| 19 | + - prefer `TypedDict`, `Protocol`, `TypeVar`, and `@overload` over weak typing patterns |
| 20 | + - do not add annotation-only bindings or destroy tuple unpacking just to annotate |
| 21 | +- Post-defensive style: |
| 22 | + - once inputs are validated, trust invariants internally |
| 23 | + - do not add truthiness/emptiness/None guards or silent recovery for impossible states |
| 24 | + - let no-op-capable operations no-op naturally |
| 25 | + - single return point by default; avoid artificial loop limits |
| 26 | + - do not introduce high-blast-radius destructive operations like new `shutil.rmtree` usage |
| 27 | +- Diagnostics: |
| 28 | + - assign diagnostic text to `message: str` before `raise`/warn/log |
| 29 | + - use first-person observed-state wording (`I received ...`, `I could not find ...`) |
| 30 | + - include actual runtime values; use backticks around identifiers in prose |
| 31 | +- Docstrings/comments: |
| 32 | + - do not add docstrings or comments unless requested/necessary |
| 33 | + - when docstrings are requested, use modified NumPy style: triple double quotes, full-stop summary, no reST/LaTeX, no `Notes` section, real usage examples, references section; add `(AI generated docstring)` only for newly created docstrings |
| 34 | +- Tests: |
| 35 | + - pytest style; one test function per function/class under test |
| 36 | + - every test uses `@pytest.mark.parametrize` |
| 37 | + - all fixtures belong in `tests/conftest.py` |
| 38 | + - use deterministic, distinctive data; every assertion needs a descriptive message |
| 39 | + - prefer MCP test runners for execution. |
0 commit comments