You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/rules/code-style.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,11 @@
4
4
-**Python**: 3.9+ syntax
5
5
-**Package management**: Always use `uv`, never `pip`
6
6
-**Tooling**: Ruff for linting/formatting, mypy strict mode, prek for pre-commit checks
7
-
-**Comments**: Minimal - only explain "why", not "what"
8
-
-**Docstrings**: Do not add docstrings to new or changed code unless the user explicitly asks for them — not even one-liners. The codebase intentionally keeps functions self-documenting through clear naming and type annotations
9
-
-**Types**: Match the type annotation style of surrounding code — the codebase uses annotations, so add them in new code
10
-
-**Naming**: NEVER use leading underscores (`_function_name`) - Python has no true private functions, use public names
7
+
-**Comments**: Minimal — only explain "why", not "what"
8
+
-**Docstrings**: Do not add docstrings unless the user explicitly asks
9
+
-**Types**: Match the type annotation style of surrounding code
10
+
-**Naming**: No leading underscores (`_function_name`) — Python has no true private functions
11
11
-**Paths**: Always use absolute paths
12
-
-**Encoding**: Always pass `encoding="utf-8"` to `open()`, `read_text()`, `write_text()`, etc. in new or changed code — Windows defaults to `cp1252` which breaks on non-ASCII content. Don't flag pre-existing code that lacks it unless you're already modifying that line.
13
-
-**Verification**: Use `uv run prek` to verify code — it handles ruff, ty, mypy in one pass. Don't run `ruff`, `mypy`, or `python -c "import ..."` separately; `prek` is the single verification command
12
+
-**Encoding**: Always pass `encoding="utf-8"` to `open()`, `read_text()`, `write_text()` in new or changed code
13
+
-**Verification**: Use `uv run prek` — it handles ruff, ty, mypy in one pass. Don't run them separately
14
+
-**Code transforms**: Use `libcst` for code modification/transformation. `ast` is acceptable for read-only analysis
When encountering a bug, investigate the root cause. Don't patch symptoms. If you're about to add a try/except, a fallback default, or a defensive check — ask whether the real fix is upstream.
6
+
7
+
## Isolated testing
8
+
9
+
Prefer running individual test functions over full suites. Only run the full suite when explicitly asked or before pushing.
10
+
11
+
- Single function: `uv run pytest tests/test_foo.py::TestBar::test_baz -v`
12
+
- Single module: `uv run pytest tests/test_foo.py -v`
13
+
- Full suite: only when asked, or before `git push`
14
+
15
+
When debugging a specific endpoint or integration, test it directly instead of running the entire pipeline end-to-end.
16
+
17
+
## Subprocess failures
18
+
19
+
When a subprocess fails, always log stdout and stderr. "Exit code 1" with no output is useless.
- Never commit, amend, or push without explicit permission
5
-
- Don't commit intermediate states — wait until the full implementation is complete, reviewed, and explicitly approved before committing. If the user corrects direction mid-implementation, incorporate the correction before any commit
6
-
- Always create a new branch from `main` before starting any new work — never commit directly to `main` or reuse an existing feature branch for unrelated changes
- Keep commits atomic - one logical change per commit
9
-
- Commit message body should be concise (1-2 sentences max)
10
-
- Merge for simple syncs, rebase when branches have diverged significantly
11
-
- When committing to an external/third-party repo, follow that repo's own conventions for versioning, changelog, and CI
12
-
- Pre-commit: Run `uv run prek` before committing — fix any issues before creating the commit
13
-
- Pre-push: Run `uv run prek run --from-ref origin/<base>` to check all changed files against the PR base — this matches CI behavior and catches issues that per-commit prek misses. To detect the base branch: `gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo main`
6
+
- Don't commit intermediate states — wait until the full implementation is complete and approved
7
+
- Always create a new branch from `main` — never commit directly to `main`
0 commit comments