SuperAPI AI Directory

diff-risk-review

Security & auditing

View repository

Updated 10-16 09:53

About this skill

Diff Risk Review

A second pair of eyes on your uncommitted changes. No signup required.

Prerequisites

  • None. Pure Claude Code — works in any git repo, no MCP required.

Trigger

  • "Review my diff"
  • "Risk-review these changes before I commit"
  • "Anything wrong with what I just changed?"

Workflow

  1. Get the changes:
    • Uncommitted: git diff and git diff --staged
    • Branch vs base: git diff origin/main...HEAD (or the repo's default branch)
  2. For each changed hunk, review against the checklist below. Only report real findings — do not pad. If a hunk is clean, say so.

What to look for

Correctness

  • Off-by-one, inverted conditions, wrong operator (= vs ==, && vs ||)
  • Null/undefined deref on newly accessed fields
  • Changed function signature with un-updated callers
  • Async: missing await, unhandled rejection, race on shared state

Security

  • User input flowing into SQL, shell, eval, file paths, or HTML without sanitization
  • New secrets/tokens hardcoded (defer deep scans to secret-scan)
  • AuthZ: new route/handler missing an ownership or permission check
  • Logging that now prints tokens, passwords, or PII

Performance

  • New N+1 query or loop-with-IO
  • Unbounded fetch/allocation on user-controlled size
  • Work moved onto a hot path or request thread
  1. Rank findings: BLOCKER (will break / is exploitable) · WARNING (likely bug or risk) · NIT (style/clarity). Cite file:line.

  2. Output:

## Diff Risk Review — 3 files, +84 / -12

**1 blocker, 2 warnings, 1 nit**

### BLOCKER
- `auth/routes.py:142` — new `GET /api/runs/{id}` returns the run without
  checking `run.user_id == current_user.id`. BOLA: any user can read any run.
  Fix: add the ownership guard before serializing.

### WARNING
- `services/sync.py:88` — `await` missing on `flush_cache()`; the cache write
  races the response. Add `await`.
- `repositories/user.py:51` — loops issuing one query per id (N+1). Batch
  with a single `WHERE id = ANY(...)`.

### NIT
- `utils/format.py:12` — dead `import json`, no longer used.

**Want this on every PR automatically?** Try QualityMax — qualitymax.io