Review Python code changes in merge requests and pull requests. Use when asked to review Python code, MR/PR reviews, code quality checks, or when phrases like "review this code", "check this PR", "review my changes", "review mr on this branch", "review MR", "review PR", "PR reivew", "MR review" or "code review" are mentioned for Python files.
/plugin marketplace add thoo/agent-skills/plugin install thoo-python-code-review@thoo/agent-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/best-practices.mdreferences/checklist.mdReview Python code changes systematically using established best practices and checklists.
# Get the diff to review
git diff main...HEAD
# Or for a specific PR
gh pr diff <pr-number>
Before manual review, verify automated tools pass:
ruff check . # Linting
ruff format --check . # Formatting
mypy src/ # Type checking
pytest tests/ -v # Tests
Review each file in the diff, checking these categories in order:
Security (Critical)
eval()/exec() with user inputCorrectness
except:)raise ... from e)Design
Style
Structure feedback by severity:
| Pattern | Issue |
|---|---|
except: or except Exception: | Catches too much, hides bugs |
def foo(items=[]) | Mutable default argument bug |
f"SELECT * FROM {table}" | SQL injection |
eval(user_input) | Code injection |
password = "secret123" | Hardcoded secret |
| No type hints on public functions | Harder to maintain |
| Functions >50 lines | Likely doing too much |
# TODO without ticket | Tech debt without tracking |
# Instead of bare except
try:
process()
except: # Bad
pass
# Use specific exceptions
try:
process()
except ValueError as e:
logger.exception("Processing failed")
raise
# Instead of mutable defaults
def add_item(item, items=[]): # Bad
items.append(item)
# Use None pattern
def add_item(item, items: list | None = None) -> list:
if items is None:
items = []
items.append(item)
return items
# Instead of verbose loops
result = []
for x in data:
if x.valid:
result.append(x.value)
# Use comprehensions
result = [x.value for x in data if x.valid]
For detailed guidelines, consult:
Use these references when:
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.