python-anti-patternslisted
Install: claude install-skill Jartan-LLC/grimoire
# Python Anti-Patterns Checklist
A reference checklist of common mistakes and anti-patterns in Python code. Review this before finalizing implementations to catch issues early.
**Note:** This skill focuses on what to avoid. For guidance on positive patterns and architecture, see the `python-patterns` skill.
## Core Concepts
### 1. Centralize Cross-Cutting Concerns
Timeouts, retries, and configuration should live in one place, not scattered across every call site.
### 2. Separate Layers
Keep I/O, business logic, and API concerns in distinct layers. Don't mix SQL into business functions or leak ORM models to API consumers.
### 3. Handle Failures Explicitly
Catch specific exceptions, preserve partial results in batch operations, and validate inputs at boundaries.
### 4. Use the Type System
Annotate all public functions, use typed collections, and let static analysis catch bugs before runtime.
## Infrastructure Anti-Patterns
### Scattered Timeout/Retry Logic
```python
# BAD: Timeout logic duplicated everywhere
def fetch_user(user_id):
try:
return requests.get(url, timeout=30)
except Timeout:
logger.warning("Timeout fetching user")
return None
def fetch_orders(user_id):
try:
return requests.get(url, timeout=30)
except Timeout:
logger.warning("Timeout fetching orders")
return None
```
**Fix:** Centralize in decorators or client wrappers.
```python
# GOOD: Centralized retry logic
@retry(stop=stop_after_