---
description: "Run a code review on the current changes before opening a PR"
mode: agent
---

# Code Review

Review the changes about to be committed or pushed in this repository.

## Steps

1. Determine the diff:
   - If anything is staged: `git --no-pager diff --staged`.
   - Otherwise: `git --no-pager diff HEAD`.
2. List the changed files and group them by area (e.g., src, tests, docs).
3. Read the project's `.github/copilot-instructions.md` and any matching `.github/instructions/*.instructions.md` to load the local conventions.
4. For each changed file, check:
   - Naming follows project conventions.
   - Error handling matches the project's pattern.
   - Tests exist or were updated for behavior changes.
   - No `console.log`, `debugger`, `dbg!`, or commented-out code.
   - Imports respect module boundaries.
   - Types are explicit (no implicit `any` / `interface{}` / `Any`).
5. Run the project's verification script if available (`./verify.sh`, `npm run verify`, `make verify`).

## Output

Produce a single Markdown report with these sections:

### Summary

One paragraph: scope, risk, recommendation (LGTM / needs changes / blocking issues).

### Findings

For each finding:

- **File**: `path/to/file.ts:42`
- **Severity**: blocking / major / minor / nit
- **What**: one line describing the issue.
- **Why**: one line on the rule or principle violated.
- **Fix**: one or two lines on the change to make.

### Verification

- `<verify command>` — passed / failed / not run.

### Suggested Commit Message

`<type>(<scope>): <subject>` plus a one-paragraph body.

Stop after the report. Do not make changes unless explicitly asked.
