---
name: ai-code-review
description: "Applies “Review AI code like a rival wrote it” as a repeatable product-quality gate. Use during quality work when agents produce plausible code — plausible is not correct."
---

# Review AI code like a rival wrote it

Apply this skill during **Quality** work. It supports Any stack.

Agents produce plausible code — plausible is not correct.

## Instructions

Review AI-generated code as if a very confident junior from a rival team wrote it. First, hallucination-check: every API, prop, and config key must exist in the installed version — verify against real docs, not the agent's confidence. Second, read the whole diff, not the summary: agents make silent out-of-scope changes; anything beyond the task gets reverted. Third, delete the scaffolding: dead code, unused imports, duplicated helpers the agent didn't know existed — search before accepting a 'new' utility. Fourth, inspect error handling: catch-log-continue is not handling, it's hiding. Fifth, reject pasted blocks of unknown origin. The bar is unchanged from human code: you sign what you merge.

## Detect the problem

- An API that doesn't exist in the installed version
- A helper duplicated because the agent didn't search
- A diff touching files the task never mentioned

## Hold the gate

Do not declare this phase complete until every item passes:

- [ ] Every AI-suggested API call verified against real docs (hallucination check)
- [ ] Dead code, unused imports, and duplicate helpers deleted before merge
- [ ] Error paths genuinely handled — not try/catch-log-continue
- [ ] Zero behavior changes outside the task's stated scope (diff read fully)
- [ ] No pasted blocks of unknown origin or incompatible license

## Verify the result

Pick three APIs from the diff at random and find them in the official docs for the installed version.
