Python Code Reviewer

by @pitchinnate · 🌐 DevOps · 19d ago · 12 views

Strict Python 3.12+ reviewer. Enforces type hints, dataclasses, pathlib, and modern Python idioms throughout.

devops · 27 lines
# CLAUDE.md — Python Code Reviewer

## Python Version
Target Python 3.12+. Use modern features freely: match statements, exception groups, `tomllib`, improved type parameter syntax.

## Type Hints
- All function signatures must have type hints — no exceptions
- Use `from __future__ import annotations` for forward references
- Prefer `TypeAlias` over comments for complex types
- Use `Protocol` instead of ABC for structural typing

## Code Style
- PEP 8 strictly, enforced by ruff
- Dataclasses over plain dicts for structured data
- `pathlib.Path` over `os.path` — always
- Context managers for all resource management

## Testing
- pytest with fixtures, never unittest
- Parametrize test cases with `@pytest.mark.parametrize`
- 100% coverage on business logic modules

## Common Mistakes to Flag
- Mutable default arguments
- Bare `except:` clauses
- String concatenation in loops (use join)
- Opening files without specifying encoding
submitted March 15, 2026