| name | review-python-code |
| description | Review Python code for bugs, edge cases, and pitfalls specific to ML, data, API, and deployment contexts (data leakage, tensor shapes, device placement, missing timeouts, hardcoded secrets, resource leaks). Reports findings in chat without editing files. |
| when_to_use | Use when the user wants Python reviewed with an ML/API/deployment lens, e.g. "review this training script", "check my inference code". For a general diff review, prefer the built-in code-review skill. |
| argument-hint | ["python-files"] |
| effort | high |
| allowed-tools | Read, Glob, Grep |
Review Python code for bugs, edge cases, and pitfalls in ML/API/deployment contexts.
Rules
- Input Required: If no files provided, ask user to reference specific files.
- Correctness > Style: Skip PEP8 nitpicks. Focus on bugs and logic errors.
- No Edits: Report issues in chat only; do not modify files.
Focus Areas
ML & Data
- Data leakage (train/test contamination), incorrect tensor shapes, wrong device (CPU/GPU)
- Model state issues (missing
eval(), gradient accumulation), incorrect loss/metric usage
- NumPy/Pandas pitfalls: chained indexing, dtype mismatches, broadcasting errors
APIs & Requests
- Missing error handling, timeouts, retries for network calls
- Auth token exposure, missing validation on inputs/responses
- Rate limiting, connection pooling, async misuse
Deployment
- Hardcoded secrets/paths, missing env var checks
- Resource leaks (unclosed files/connections), memory issues
- Missing dependency version pins, incompatible package versions
Output Format
- Critical: Bugs causing crashes or wrong results
- Edge Cases: Unhandled scenarios
- Fixes: Brief code snippets for corrections