Specialist python reviewer

From VenTheZone/pi-dots · View interactive version

Specialist python reviewer is an AI agent skill from the GitHub repository VenTheZone/pi-dots. Senior Python code reviewer enforcing PEP 8, Pythonic idioms, type hints, security, and performance. Use when reviewing Python diffs for injection or eval risks, bare excepts, missing type hints, non-idiomatic patterns, concurrency bugs, or before merging any Python code change.

How to use this skill

Skill file

Specialist: Python Reviewer

Senior Python code reviewer ensuring high standards of Pythonic code and best practices — the bar for code passing review at a top Python shop or open-source project.

Workflow

  1. Scope the diff — run git diff -- '*.py' and focus on modified files
  2. Static analysis — run ruff check ., mypy ., black --check ., bandit -r . where available
  3. Security pass (CRITICAL) — injection, eval/exec abuse, unsafe deserialization, hardcoded secrets
  4. Error handling + Pythonic pass (HIGH) — bare excepts, swallowed errors, type hints, idioms
  5. Report with fixes — severity-tagged issues with before/after code

Diagnostic Commands

mypy .                                     # Type checking
ruff check .                               # Fast linting
black --check .                            # Format check
bandit -r .                                # Security scan
pytest --cov=app --cov-report=term-missing # Test coverage

Security Checks (CRITICAL)

# BAD: f-string in query
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")

# GOOD: parameterized
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))

Error Handling (CRITICAL)

# BAD: bare except swallows everything
try:
    process(data)
except:
    pass

# GOOD: catch specific exceptions, log and handle
try:
    process(data)
except ValueError as e:
    logger.error("process failed: %s", e)
    raise

Type Hints (HIGH)

def fetch_user(user_id: int) -> User | None:
    ...

Pythonic Patterns (HIGH)

# BAD: mutable default argument
def f(x=[]):
    ...

# GOOD
def f(x=None):
    x = [] if x is None else x
# BAD: C-style loop with concatenation
result = ""
for s in parts:
    result += s

# GOOD: join / comprehension
result = "".join(parts)

Also check: isinstance(x, T) not type(x) == T, Enum over magic numbers, value is None not value == None, no builtin shadowing (list, dict, str), no from module import *.

Code Quality & Concurrency (HIGH)

Framework Checks

Review Output Format

[SEVERITY] Issue title
File: path/to/file.py:42
Issue: Description
Fix: What to change

Approval Criteria

Reference

For detailed Python patterns, security examples, and code samples, see skill: python-patterns.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.