Review

From dannys-code-corner/incan · View interactive version

Review is an AI agent skill from the GitHub repository dannys-code-corner/incan. Perform a thorough, Incan-project-aware code review. Use when the user asks for a review, code critique, PR review, or says /review. Checks Rust anti-patterns, compiler pipeline completeness, error handling, test coverage, style conventions, and RFC compliance specific to the Incan compiler codebase

How to use this skill

Skill file

Code Review — Incan Compiler

For broad dirty worktrees or explicitly delegated review, prefer review-orchestrate over this generic reviewer. Use /review for smaller or local review passes.

Persistent report

/review must keep a live report in the current worktree at:

Do not keep the findings list only in memory. Create or update this file as you review.

The report is the shared source of truth for /fix, /loop, /review-and-fix, and ralph-loop.

The report must use this exact top-level shape:

# Review Report

- branch: <branch or worktree>
- status: in_progress | clean | blocked

## Scope
- user request:
- issue / RFC:
- reviewed worktree: true

## Activity
- [21:54] review started
- [21:55] scope derived from issue 73 / RFC 015 / dirty worktree
- [21:57] found 2 warnings in loaves/oven/oven_model/src/project_lifecycle/version.rs
- [22:01] running make fmt
- [22:04] make pre-commit passed

## Files

### <path/to/file_a>
- status: pending | clean | findings | fixed | blocked
- checks:
  - scope_audit: pass | fail | n/a
  - rust_prose_audit: pass | fail | n/a
  - markdown_prose_audit: pass | fail | n/a
  - rfc_reference_audit: pass | fail | n/a
  - docs_claims_audit: pass | fail | n/a
  - public_docs_audit: pass | fail | n/a
  - test_style_audit: pass | fail | n/a
  - release_note_inventory_audit: pass | fail | n/a
- notes:
  - touched and reviewed

### <path/to/file_b>
- status: findings
- checks:
  - scope_audit: pass
  - rust_prose_audit: fail
  - markdown_prose_audit: n/a
  - rfc_reference_audit: n/a
  - docs_claims_audit: n/a
  - public_docs_audit: pass
  - test_style_audit: n/a
  - release_note_inventory_audit: n/a
- findings:
  - [ ] blocker | <label> | <line>
    <why it matters>

### <path/to/file_c>
- status: fixed
- checks:
  - scope_audit: pass
  - rust_prose_audit: pass
  - markdown_prose_audit: n/a
  - rfc_reference_audit: n/a
  - docs_claims_audit: n/a
  - public_docs_audit: pass
  - test_style_audit: n/a
  - release_note_inventory_audit: n/a
- findings:
  - [x] warning | <label> | <line>
    <what changed>

### <path/to/file_d>
- status: blocked
- checks:
  - scope_audit: pass
  - rust_prose_audit: fail
  - markdown_prose_audit: n/a
  - rfc_reference_audit: n/a
  - docs_claims_audit: n/a
  - public_docs_audit: pass
  - test_style_audit: n/a
  - release_note_inventory_audit: n/a
- findings:
  - [ ] external_blocker | <label> | <command or line>
    <why it is blocked>

## Verification
- <command> — <result>

Every touched/reviewed file in scope must appear under ## Files. Start each file as status: pending; do not mark a file clean before you actually audit it. Do not keep a separate mental list of "files I looked at". If a finding changes state during the review, update the report file instead of relying on a rewritten summary later.

For each file, fill out the applicable checks explicitly:

Use n/a only when the check genuinely does not apply to that file.

## Activity is append-only. Add a short timestamped entry every time you:

A prose summary that omits ## Activity or ## Files is invalid output. Do not replace the report with a narrative summary at the end.

Each new /review invocation starts a fresh report for the current run. Do not inherit findings, statuses, or activity entries from an older run. At the start of the review, overwrite .agents/state/review-report.md with a fresh scaffold using the required sections, then populate it from the current worktree state.

Workflow

  1. Identify scope from the current worktree, not just committed history: inspect git status --short, git diff main...HEAD, and any files the user names. Review staged, unstaged, and untracked files that are part of the current task; do not silently narrow the review to committed diffs when the worktree is dirty.
  2. Derive the expected scope before judging the implementation. Use, in order: the user's request in the thread, the issue number / branch name / short description when available, the governing RFC or design doc, and the generated user-facing docs/CLI reference/examples on the branch. Write down, at least mentally, what behavior the branch claims to implement.
  3. Check for both directions of scope drift:
  1. Determine which pipeline stages are touched: Parser · Typechecker · Lowering · Emission.
  2. If the change is user-facing, stdlib-facing, or architectural, also consult AGENTS.md, architecture.md, layering.md, readable-maintainable-rust.md, and extending_language.md as relevant.
  3. If review uncovers a likely compiler bug outside the current change scope, trigger flag-compiler-bug: minimize the repro, judge blocking vs workaround, check whether the bug is already filed, and then raise or draft the bug before continuing.
  4. Work through the checklists below in order.
  5. Stay in review mode. /review is report-only unless the user explicitly asks for edits inside the same request. Do not silently fix findings by default; that responsibility belongs to /fix or /review-and-fix.
  6. Do an explicit prose audit on touched documentation-bearing files before you finalize findings:
  1. Record findings in .agents/state/review-report.md as you go. Do not wait until the end to reconstruct the review from memory.
  2. At the start of the run, reset .agents/state/review-report.md to a fresh scaffold for the current review. Do not preserve stale entries from prior runs.
  3. Maintain ## Activity as a live audit trail while you work. Do not backfill it only at the end.
  4. Maintain the report as a per-file ledger: every touched/reviewed file gets an explicit entry, status, and checklist.
  5. A file may move from pending to clean only after the applicable checks are filled in and all are pass or n/a.
  6. If the report is missing ## Scope, ## Activity, ## Files, or ## Verification, the review is incomplete. Fix the report before you declare any result.
  7. Output a structured report (see Output format) describing the current review state of the worktree.
  8. Before declaring the review clean, work through the mandatory closing checklist below and make sure the persistent report matches it. Do not rely on memory or a vague sense that the branch is "basically done".

Checklist 1 — Blockers (must fix before merge)

These fail CI or panic at runtime. Flag every occurrence.

Use ?, .map_err(|e| miette!(...)), or explicit match.

The only accepted exemption is #[cfg(test)] blocks in backend::project submodules that already carry #[allow(clippy::unwrap_used)].


Checklist 2 — Compiler pipeline completeness

Only applies when the diff touches a language feature (not a pure refactor or docs change).


Checklist 3 — Rust quality (anti-patterns)

| Check | Bad | Preferred |

| ----------------------------- | --------------------------------------------- | ---------------------------------- |

| Parameter types | &String, &Vec<T>, &Box<T> | &str, &[T], &T |

| Type casting | x as u32 (silent truncation) | x.try_into()? or From/Into |

| Visibility | pub on everything | pub(crate) or private by default |

| Wildcard imports | use foo::* | use foo::{Bar, Baz} |

| Collecting to iterate | .collect::<Vec<_>>() then loop | chain iterators directly |

| Owned clone to appease borrow | .clone() as a reflex | restructure ownership or borrow |

| Stringly-typed APIs | fn set(role: &str) | typed enum / newtype |

| Code duplication | identical logic in multiple arms | extract shared helper before/after |

| Shared-state escape hatch | Rc<RefCell<_>> / Arc<Mutex<_>> by default | restructure ownership first |


Checklist 4 — Error handling


Checklist 5 — Style and readability


Checklist 6 — Tests


Checklist 7 — RFC compliance (if applicable)


Checklist 7b — Claimed scope vs delivered scope


Checklist 8 — Architecture and layering


Checklist 9 — Contributor hygiene


Output format

Produce a report with:

## Review — <subject / branch / files>

### Blockers 🔴
<item> — <file>:<line> — <explanation and fix>

### Warnings 🟡
<item> — <file>:<line> — <explanation and fix>

### Suggestions 🟢
<item> — <file>:<line> — <optional improvement>

### Notes 💡
<observation or question that doesn't require a change>

### Follow-up bugs
<drafted issue or explicit recommendation to file one, when review uncovered a likely compiler bug outside scope>

### Summary
One or two sentences on overall quality and merge-readiness.

Omit sections that have no items. If there are zero blockers and zero warnings, say so explicitly in the summary.

Mandatory closing checklist

Before you write "no blockers", "no warnings", or equivalent clean-review language, explicitly verify all of the following:

If any item is unchecked, do not claim the review is clean. Report the remaining gap explicitly.

Verification failure policy

A failed broad verification command does not invalidate the review.

If make fmt, make pre-commit, mkdocs build --strict, or another broad check fails for reasons unrelated to the

current local findings, you must still:

  1. keep reviewing the worktree,
  2. run the narrow relevant verification you still can,
  3. report the broad-check failure as residual risk.

Do not abandon the review merely because a broad verification command failed.

If the user explicitly asked for edits as part of the review request, use /fix or /review-and-fix rather than improvising your own repair loop.

Only stop short of a stronger verification claim when the gap is clearly one of:

For every unresolved verification gap or blocked check, say which of those categories applies.

Default behavior

When the user invokes /review or otherwise asks for a review without explicitly saying "report only" or "do not change code", you should:

  1. review the code,
  2. run relevant verification,
  3. update .agents/state/review-report.md,
  4. produce findings only,
  5. recommend /fix or /review-and-fix if actionable findings remain.

Before declaring the loop clean, do one explicit final sweep for the common misses this skill is meant to catch:

The default verification bar for a strong review is:

If either command was not run, say so explicitly in the final review report and treat that as residual risk rather than silently claiming the branch is clean.

Findings ledger

.agents/state/review-report.md is per-worktree and gets overwritten by the next run (Step 11). To keep a durable record of what review actually catches over time, append one line to .agents/state/findings-ledger.md (a symlink into a private, non-git location — see AGENTS.md) whenever this run:

Format, appended not rewritten:

- YYYY-MM-DD | review | <one-line finding> | <what changed, or "pending" if not yet fixed>

Skip the ledger entirely for a clean pass with nothing to report — it should stay a record of real findings, not a heartbeat log. If .agents/state/findings-ledger.md doesn't exist (e.g. this workspace layout wasn't set up), skip this step silently rather than creating it yourself.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.