← ClaudeAtlas

py-anti-patternslisted

Review Python code for common correctness and maintainability anti-patterns including hard-coded configuration, mixed I/O and business logic, leaked internal models, scattered retries, mutable defaults, and resource misuse. Use as a focused checklist during Python review.
CodeSigils/py-review-skill · ★ 0 · AI & Automation · score 62
Install: claude install-skill CodeSigils/py-review-skill
# Python Anti-Pattern Review Use these rules as a correctness-first checklist. Do not flag broad architecture preferences unless the changed code creates a concrete maintenance or behavior risk. **Freshness:** stable (no external references) — review rules based on core Python conventions, not volatile APIs. ## Review Rules ### Rule: anti-hard-coded-config **Impact:** HIGH **Applies when:** Code adds endpoints, credentials, filesystem paths, timeouts, feature flags, or environment-specific values. **Skip when:** The value is a harmless local constant or test fixture. **Python:** any **Tools:** none **Review signal:** Production configuration or secrets are hard-coded in module globals or functions. **Incorrect:** ```python API_KEY = "sk-live-example" DB_HOST = "prod-db.example.com" ``` **Correct:** ```python class Settings(BaseSettings): api_key: str = Field(alias="API_KEY") db_host: str = Field(alias="DB_HOST") ``` **Reason:** Hard-coded environment values make deployments brittle and can leak secrets. ### Rule: anti-mixed-io-business-logic **Impact:** MEDIUM-HIGH **Applies when:** Business decisions are added near SQL, HTTP calls, filesystem reads, or ORM queries. **Skip when:** The function is a thin adapter whose only job is I/O orchestration. **Python:** any **Tools:** none **Review signal:** A function both fetches raw data and implements domain decisions that should be testable independently. **Incorrect:** ```python def calculate_discount(user_id: str