chore: add more opinions to CLAUDE.md (#1887)
This commit is contained in:
parent
e94b386a13
commit
c06362126b
1 changed files with 6 additions and 12 deletions
18
CLAUDE.md
18
CLAUDE.md
|
|
@ -6,9 +6,9 @@ This document contains critical information about working with this codebase. Fo
|
||||||
|
|
||||||
1. Package Management
|
1. Package Management
|
||||||
- ONLY use uv, NEVER pip
|
- ONLY use uv, NEVER pip
|
||||||
- Installation: `uv add package`
|
- Installation: `uv add <package>`
|
||||||
- Running tools: `uv run tool`
|
- Running tools: `uv run <tool>`
|
||||||
- Upgrading: `uv add --dev package --upgrade-package package`
|
- Upgrading: `uv lock --upgrade-package <package>`
|
||||||
- FORBIDDEN: `uv pip install`, `@latest` syntax
|
- FORBIDDEN: `uv pip install`, `@latest` syntax
|
||||||
|
|
||||||
2. Code Quality
|
2. Code Quality
|
||||||
|
|
@ -21,6 +21,7 @@ This document contains critical information about working with this codebase. Fo
|
||||||
3. Testing Requirements
|
3. Testing Requirements
|
||||||
- Framework: `uv run --frozen pytest`
|
- Framework: `uv run --frozen pytest`
|
||||||
- Async testing: use anyio, not asyncio
|
- Async testing: use anyio, not asyncio
|
||||||
|
- Do not use `Test` prefixed classes, use functions
|
||||||
- Coverage: test edge cases and errors
|
- Coverage: test edge cases and errors
|
||||||
- New features require tests
|
- New features require tests
|
||||||
- Bug fixes require regression tests
|
- Bug fixes require regression tests
|
||||||
|
|
@ -77,12 +78,11 @@ rather than adding new standalone sections.
|
||||||
- Line wrapping:
|
- Line wrapping:
|
||||||
- Strings: use parentheses
|
- Strings: use parentheses
|
||||||
- Function calls: multi-line with proper indent
|
- Function calls: multi-line with proper indent
|
||||||
- Imports: split into multiple lines
|
- Imports: try to use a single line
|
||||||
|
|
||||||
2. Type Checking
|
2. Type Checking
|
||||||
- Tool: `uv run --frozen pyright`
|
- Tool: `uv run --frozen pyright`
|
||||||
- Requirements:
|
- Requirements:
|
||||||
- Explicit None checks for Optional
|
|
||||||
- Type narrowing for strings
|
- Type narrowing for strings
|
||||||
- Version warnings can be ignored if checks pass
|
- Version warnings can be ignored if checks pass
|
||||||
|
|
||||||
|
|
@ -117,10 +117,6 @@ rather than adding new standalone sections.
|
||||||
- Add None checks
|
- Add None checks
|
||||||
- Narrow string types
|
- Narrow string types
|
||||||
- Match existing patterns
|
- Match existing patterns
|
||||||
- Pytest:
|
|
||||||
- If the tests aren't finding the anyio pytest mark, try adding PYTEST_DISABLE_PLUGIN_AUTOLOAD=""
|
|
||||||
to the start of the pytest run command eg:
|
|
||||||
`PYTEST_DISABLE_PLUGIN_AUTOLOAD="" uv run --frozen pytest`
|
|
||||||
|
|
||||||
3. Best Practices
|
3. Best Practices
|
||||||
- Check git status before commits
|
- Check git status before commits
|
||||||
|
|
@ -138,6 +134,4 @@ rather than adding new standalone sections.
|
||||||
- File ops: `except (OSError, PermissionError):`
|
- File ops: `except (OSError, PermissionError):`
|
||||||
- JSON: `except json.JSONDecodeError:`
|
- JSON: `except json.JSONDecodeError:`
|
||||||
- Network: `except (ConnectionError, TimeoutError):`
|
- Network: `except (ConnectionError, TimeoutError):`
|
||||||
- **Only catch `Exception` for**:
|
- **FORBIDDEN** `except Exception:` - unless in top-level handlers
|
||||||
- Top-level handlers that must not crash
|
|
||||||
- Cleanup blocks (log at debug level)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue