Generic AI code review catches style and syntax; data pipelines fail on idempotency, partition pruning, timezone math, and grain changes — failures a generic reviewer sails past.
This playbook sets up AI-assisted PR review tuned to data-engineering failure modes, with a checklist the reviewer must walk explicitly, so review comments point at the bugs that actually take pipelines down.
Use this on every nontrivial pipeline PR — new models, DAG changes, refactors — either as the first-pass reviewer before a human, or as the second pair of eyes on your own PR before requesting review. It matters double when the PR itself contains AI-generated code: roughly half of current DE job postings expect exactly this skill, reviewing and debugging AI-written pipeline code.
Triggers:
Encode the checklist once, in the repo. Create a review-checklist file the agent reads every time (e.g., .claude/review-checklist.md or your review bot's config). Seed it with the DE core:
Data pipeline review checklist — walk EVERY item, answer per item:
PASS / FAIL / NOT APPLICABLE, with file:line evidence.
1. Idempotency: can every changed model/task rerun safely after a
partial failure without duplicating or dropping rows?
2. Grain: does any join or aggregation change output grain? Is the
grain still asserted by a uniqueness test?
3. Incremental correctness: unique_key valid? lookback window
justified? is_incremental() predicate prunes partitions?
4. Partition/cluster pruning: do new filters and joins preserve
pruning, or force full scans?
5. Timezone and date math: any naive timestamp comparison, implicit
session-timezone dependence, or date truncation at a boundary?
6. NULL semantics: joins on nullable keys, NOT IN with nullable
subqueries, COALESCE that masks data errors?
7. Schema contracts: does any output column change type, name, or
nullability that a downstream consumer depends on?
8. Backfill blast radius: if this needs a backfill, what does it cost
and who is impacted?
9. Tests and docs updated to match the change?
Run the review against the diff plus context. In an agentic tool, the prompt is short because the checklist carries the weight:
Review PR #482 using .claude/review-checklist.md. Read the changed
files AND their upstream/downstream models (follow refs) before
answering. Output: the checklist verdict table first, then detailed
findings ranked by severity, each with file:line and a suggested fix.
Do not comment on formatting. If you cannot verify an item from the
code alone, say what query or run would verify it.
Triage findings by verifiability. Sort AI findings into: verifiable now (a query or dry run settles it), design questions (human judgment), and noise. The first bucket is where AI review earns its place — run the verifications immediately, inline:
-- finding: "join to dim_customer may fan out fct rows"
SELECT customer_id, COUNT(*) AS n
FROM dim_customer
GROUP BY customer_id
HAVING COUNT(*) > 1;
A nonzero result confirms the finding; zero rows with a unique constraint refutes it. Paste refuted findings back — the agent's next pass on this repo improves when corrected in-conversation.
Demand evidence on the two chronic blind spots. Whatever the tool, explicitly ask: "Show me the rerun path after a mid-run failure" (idempotency) and "Which downstream models select the columns this PR changes?" (blast radius). These two produce the worst incidents and get the vaguest generic-review coverage.
Gate, do not replace. The AI verdict table plus your verification results go into the PR as a comment; a human still approves. The checklist FAILs must be resolved or explicitly waived with a reason — a waived-without-reason FAIL is how the process decays into theater.
Feed incidents back into the checklist. Every pipeline incident postmortem asks: would a checklist item have caught this? If yes and none exists, add it. The checklist is a living asset; six months of this loop makes it worth more than the tool running it.
Ask the reviewer for PASS/FAIL/N-A per item with evidence, never "review this PR." Open-ended review prompts produce confident essays about the code's style; forced verdicts with file:line evidence produce falsifiable claims you can check.
dbt ls --select model+), not from the reviewer's memory.Client repos need review too, and diffs are client IP. Run the same checklist through an assistant on approved tenancy — Bedrock or Azure OpenAI wired into the client's own GitHub/GitLab via their sanctioned integration — or, where nothing is approved, a local model via Ollama reviewing locally checked-out diffs. The checklist file itself is generic and travels between engagements; the evidence queries run inside the client warehouse. Never paste client diffs into public review tools, and keep the PR-comment evidence (query results) masked to schema-level information rather than row-level data.