From python3-development
Reviews Python code for type safety, error handling, security vulnerabilities, and performance issues. Reports findings by severity/location with fix examples.
npx claudepluginhub jamie-bitflight/claude_skills --plugin python3-developmentThis skill uses the workspace's default tool permissions.
<review_targets>$ARGUMENTS</review_targets>
Reviews Python code for type safety, error handling, security vulnerabilities, performance issues, and modern patterns. Use for code reviews, PRs, or quality assessments.
Reviews Python code for PEP8 style, type safety, async patterns, error handling, and common mistakes like mutable defaults. Use when reviewing .py files, type hints, async/await, or exceptions.
Reviews Python code enforcing type hints, Pythonic patterns, naming clarity, imports, testing practices, and maintainability. Strict on existing code modifications.
Share bugs, ideas, or general feedback.
<review_targets>$ARGUMENTS</review_targets>
The model performs comprehensive code review across multiple quality dimensions.
<review_targets/>
Consult ../python3-development/references/python3-standards.md when checking code against shared architecture, typing, testing, or CLI rules. The dimensions below supplement that document; they do not replace it.
Check for:
Any without justificationList, Dict, Optional, Union)Severity: High (type errors cause runtime failures)
# Bad - missing types
def process(data):
return data.get("value")
# Good - complete types
def process(data: dict[str, int]) -> int | None:
return data.get("value")
Check for:
except: or except Exception:add_note()Severity: High (silent failures cause data corruption)
# Bad - swallowed exception
try:
result = risky_call()
except Exception:
pass # Silent failure
# Good - specific handling with context
try:
result = risky_call()
except ConnectionError as e:
e.add_note(f"Failed connecting to {host}")
raise
Check for:
subprocess.run(..., shell=True) with user inputeval() or exec() with external inputSeverity: Critical (security vulnerabilities)
# Bad - SQL injection risk
query = f"SELECT * FROM users WHERE id = {user_id}"
# Good - parameterized query
query = "SELECT * FROM users WHERE id = ?"
cursor.execute(query, (user_id,))
Check for:
in list vs in set)__slots__ for data classes with many instancesSeverity: Medium (degraded performance)
# Bad - O(n) lookup on each iteration
valid_codes = [200, 201, 204]
for code in codes:
if code in valid_codes: # O(n) each time
process(code)
# Good - O(1) lookup
VALID_CODES = {200, 201, 204}
for code in codes:
if code in VALID_CODES: # O(1) each time
process(code)
Check for:
unittest.mock in pytest testsSeverity: Low (technical debt)
# Bad - legacy pattern
from typing import Optional
result = expensive_call()
if result:
process(result)
# Good - modern pattern
if result := expensive_call():
process(result)
Check for:
__all__ in public modulesSeverity: Medium (maintainability)
Check for:
Severity: Low (maintainability)
For each finding, report:
## [SEVERITY] [Category]: [Brief Description]
**Location**: `file.py:123` in `function_name`
**Issue**: Detailed explanation of the problem.
**Fix**:
```python
# Suggested fix with code example
Impact: Why this matters (security, performance, reliability).
---
## Review Checklist
```text
TYPE SAFETY
- [ ] All functions have complete type hints
- [ ] No legacy typing imports (List, Dict, Optional, Union)
- [ ] TypeVar/Protocol used appropriately
- [ ] Generic types are correct
ERROR HANDLING
- [ ] No bare except clauses
- [ ] No swallowed exceptions
- [ ] Exceptions have context (add_note or from)
- [ ] Specific exception types used
SECURITY
- [ ] No SQL injection vulnerabilities
- [ ] No command injection (shell=True with user input)
- [ ] No hardcoded secrets
- [ ] Input validation present
PERFORMANCE
- [ ] Sets used for membership testing
- [ ] No string concatenation in loops
- [ ] Appropriate caching used
- [ ] Async patterns correct
MODERN PATTERNS
- [ ] Builtin generics used (list, dict, not List, Dict)
- [ ] Walrus operator where beneficial
- [ ] Match-case for dispatch
- [ ] pytest-mock instead of unittest.mock
STRUCTURE
- [ ] Functions under 50 lines
- [ ] No deep nesting (>3 levels)
- [ ] No circular imports
- [ ] __all__ defined in public modules
DOCUMENTATION
- [ ] Public functions have docstrings
- [ ] Docstrings match signatures
- [ ] Complex logic commented
End the review with:
## Review Summary
**Files Reviewed**: [count]
**Total Findings**: [count]
| Severity | Count |
|----------|-------|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |
**Top Issues**:
1. [Most important issue]
2. [Second most important issue]
3. [Third most important issue]
**Recommendation**: [APPROVE / REQUEST CHANGES / BLOCK]