Skill Details
Runtime
(claude-4-6-sonnet)
Example user message
[userMessage]: def get_user(user_id): conn = psycopg2.connect(DB_URL) cur = conn.cursor() cur.execute(f"SELECT * FROM users WHERE id = {user_id}") return cur.fetchone()
Example agent response
TRACE PROTOCOL — Code Review Active
Scope: Python function | Confidence baseline: MEDIUM (no schema or tests visible)
Triage complete. 3 findings.
┌─ FINDING 1 ──────────────────────────────────────────┐
│ Severity: CRITICAL │
│ Confidence: HIGH │
│ Location: cur.execute() — line 4 │
│ Issue: SQL injection via f-string interpolation │
│ Pattern: Direct user input in query body — any │
│ string value in user_id controls SQL │
│ Fix: cur.execute( │
│ "SELECT * FROM users WHERE id = %s", │
│ (user_id,) │
│ ) │
└──────────────────────────────────────────────────────┘
┌─ FINDING 2 ──────────────────────────────────────────┐
│ Severity: HIGH │
│ Confidence: HIGH │
│ Location: Connection — no close() called │
│ Issue: Connection never closed → leak on every │
│ call under load │
│ Fix: with psycopg2.connect(DB_URL) as conn: │
│ (use context manager throughout) │
└──────────────────────────────────────────────────────┘
┌─ FINDING 3 ──────────────────────────────────────────┐
│ Severity: MEDIUM │
│ Confidence: MEDIUM ⚠️ │
│ Location: Return value │
│ Issue: fetchone() returns None if no user — │
│ caller probably unhandled │
│ Fix: Return Optional[tuple], add type hint, │
│ document None case │
└──────────────────────────────────────────────────────┘
PATTERNS: No error handling anywhere in the function. No type hints.
PRIORITY:
1. Fix immediately → SQL injection (Finding 1)
2. Fix before merge → Connection leak (Finding 2)
3. Consider → None handling + type hints (Finding 3)
LIMITS: Cannot assess query performance without EXPLAIN ANALYZE. Cannot verify DB_URL source without seeing config layer.
By purchasing this skill, you agree to our terms of service
CLAUDE-4-6-SONNET
aste any code, function, or PR diff. Get a structured findings report — each issue as a severity-rated card with confidence level and a specific fix.
Identifies cross-cutting patterns across your file and gives you a ranked action list: fix now, fix before merge, consider for refactor.
Confidence-tagged output: HIGH evidence findings stay separate from LOW confidence assumptions.
Works with Python, JavaScript, TypeScript, SQL, Go, and more.
...more
Added 3 weeks ago
