/python-review Command
This command invokes the python-reviewer agent for comprehensive Python-specific code review.What This Command Does
- Identify Python Changes: Find modified
.pyfiles viagit diff - Run Static Analysis: Execute
ruff,mypy,pylint,black --check - Security Scan: Check for SQL injection, unsafe deserialization
- Type Safety Review: Analyze type hints and mypy errors
- Pythonic Code Check: Verify PEP 8 and Python best practices
- Generate Report: Categorize issues by severity
Review Categories
CRITICAL (Must Fix)
- SQL/Command injection vulnerabilities
- Unsafe eval/exec usage
- Pickle unsafe deserialization
- Hardcoded credentials
- YAML unsafe load
- Bare except clauses hiding errors
HIGH (Should Fix)
- Missing type hints on public functions
- Mutable default arguments
- Swallowing exceptions silently
- Not using context managers for resources
- C-style looping instead of comprehensions
- Using type() instead of isinstance()
MEDIUM (Consider)
- PEP 8 formatting violations
- Missing docstrings on public functions
- Print statements instead of logging
- Not using f-strings for formatting
- Magic numbers without named constants
Automated Checks Run
Command Syntax
Common Fixes
Fix Mutable Defaults
Use Context Managers
Use f-strings
Framework-Specific Reviews
Django Projects
- N+1 query issues (use
select_related,prefetch_related) - Missing migrations for model changes
- Missing
transaction.atomic()for multi-step operations
FastAPI Projects
- CORS misconfiguration
- Pydantic models for request validation
- Proper async/await usage
Flask Projects
- Context management (app context, request context)
- Proper error handling
- Blueprint organization
Related
- Agent:
agents/python-reviewer.md - Skills:
skills/python-patterns/,skills/python-testing/ - Commands:
/tdd,/code-review,/verify