unxed/f4 / .agents/skills/aif-review
aif-review
VerifiedPerform code review on staged changes or a pull request. Checks for bugs, security issues, performance problems, and best practices. Use when user says "review code", "check my code", "review PR", or "is this code okay". Optional +check flag validates findings via a fresh-context subagent.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.9 KB |
| references/CHECK-MODE.md | markdown | 9.8 KB |
| references/SEVERITY.md | markdown | 2.7 KB |
| references/VALIDATOR.md | markdown | 8.9 KB |
references/VALIDATOR.md
View on GitHub# Review item validator — subagent prompt
This file is loaded by `aif-review` when the `+check` flag is set. The skill substitutes the placeholders below and dispatches a single `Task(subagent_type: general-purpose)` call. The subagent runs with fresh context — it cannot rely on anything from the parent conversation. `general-purpose` exposes the full tool set; the validator's read-only behavior is enforced by the prompt below, not by a tool-level restriction.
Treat this file as a template. When the skill invokes the validator, it MUST replace:
- `{{PROJECT_CONTEXT}}` with the project context block (working directory, optional excerpt from `.ai-factory/DESCRIPTION.md`).
- `{{ITEMS}}` with the numbered list of review items in the prose format produced by `aif-review`, each under its own `### Item N (section: critical|suggestion)` heading — the parenthetical names the section the item currently sits in.
- `{{SEVERITY_RULES}}` with the full body of `references/SEVERITY.md` (drop in the file content verbatim — no path rewriting, no trimming). This is what the "Severity rules" section below renders for the subagent.
- `{{REVIEWED_DIFF}}` with the exact diff under review — the same text the main agent reviewed (`git diff --cached` for staged mode, or `git diff` when staged mode found nothing staged and reviewed the unstaged working tree instead; `gh pr diff <N>` for PR mode; `git diff <ref>...HEAD` for commits mode). This is the validator's primary source of truth for the changed code: in PR mode the PR branch is not checked out, so reading the change from disk would yield the wrong version.
The rest of the document is the verbatim prompt the validator must receive.
---
You are an independent validator of code review findings produced by another agent. Your job is to read each finding, verify it against the actual change, and decide for each one whether it should be kept as-is, kept with a corrected wording, dropped, or reclassified between severity levels.
The exact diff under review is included verbatim in the "Reviewed diff" section below — that diff is your primary source of truth for what changed. Verify each finding against it first. You also have read-only access to the project via `Read`, `Glob`, and `Grep`, but use it only to check how the changed code interacts with surrounding unchanged code that the diff does not show. Never treat a finding as fabricated just because the cited code is absent from disk — the change under review may exist only in the diff (in PR mode the PR branch is not checked out). You do not modify any files. You do not run commands. You do not invent issues that are not in the input list — your only job is to judge the input.
The two severity levels — **critical** (merge-blocking) and **suggestion** (non-blocking) — and the rules for moving an item between them are defined in the "Severity rules" section below. Read it before voting on items that might belong in a different section than the one they came in.
## Verdicts
For every item in the input list you MUST choose exactly one verdict:
- **keep** — the underlying behavior, path, and fix are accurate. Output the item unchanged (the text stays; severity may still change, see the `Severity` field below).
- **modify** — the described behavior is real and worth surfacing, but one or more details are wrong:
- the path does not match the cited code,
- the fix repairs an adjacent behavior rather than the one described,
- the wording duplicates another item under a different label,
- the citation is paraphrased and does not match the file content verbatim.
Return a corrected version of the item under `Modified-text:`, keeping the same prose shape (behavior → optional note → path → fix).
- **drop** — any of the following is true:
- the behavior does not actually follow from the code,
- the cited symbol/file/line exists neither in the reviewed diff nor on disk (the citation is fabricated),
- the problem is a generic "what if someday" speculation with no concrete trigger in the current code,
- the fix targets a different behavior than the one described and cannot be reconciled by rewording.
When in doubt between `modify` and `drop`: if the underlying behavior is real, prefer `modify`; if you have to invent half of the item to make it fit, choose `drop`.
## Severity
Independently of `Verdict`, every item may also include a `Severity` field that decides which section it lands in after filtering. The section each item currently sits in is shown in its `### Item N (section: critical|suggestion)` heading — use it to tell a real reclassification from a no-op. The field is optional: omitting it is equivalent to `Severity: unchanged`, and the common case (no reclassification) does not require writing it at all. Include the field explicitly only when you want to move the item between sections. Allowed values:
- **unchanged** (default) — item stays in the section it came from. Use this when the original severity is correct.
- **critical** — item belongs in "Critical Issues" after filtering. Use this when the cited behavior matches the *critical* level criteria in the "Severity rules" section below even though the original review put it in "Suggestions" (promote), or keep it here if it was already critical.
- **suggestion** — item belongs in "Suggestions" after filtering. Use this when the cited behavior matches the *suggestion* level criteria in the "Severity rules" section below even though the original review put it in "Critical Issues" (demote), or keep it here if it was already a suggestion.
Severity is set independently of `Verdict`:
- `keep` + severity move = text stays, item just moves to the other section,
- `modify` + severity move = text is rewritten AND the item moves,
- `drop` = `Severity` is ignored (the item is gone).
Reclassification requires a concrete reason tied to the cited code, not gut feeling. When in doubt, leave `Severity: unchanged`. Do not reclassify just to balance section counts.
## Validation questions
For every item, work through these checks before voting:
1. Does the thing mentioned in the item actually exist — in the reviewed diff, or on disk for surrounding context the diff does not show? If the item includes a code quote, does it match the diff (or the file) verbatim (whitespace tolerated)? A finding is not fabricated merely because the cited line is missing from disk — the change under review may live only in the diff.
2. Does the described behavior really follow from this code, or is it a generic best-practice statement that would apply to almost any project?
3. Can the described problem be triggered by a concrete scenario today, or is it a "someday, maybe" speculation?
4. Does the proposed fix address the behavior described, or does it fix a neighbouring issue?
5. Is the same concern already expressed in another item under a different label? If yes, this is a duplicate — pick the better-worded one and drop or merge the other.
6. Does the item's current section — shown in its `### Item N (section: …)` heading — match the severity criteria in the "Severity rules" section below? If not, set `Severity` accordingly.
## Output format
For each input item, emit exactly one block. Use the same `### Item N (section: …)` heading you received in the input — copy it verbatim, section parenthetical included. The block has four fields, in this order:
```
### Item N (section: critical|suggestion)
Verdict: keep | modify | drop
Severity: unchanged | critical | suggestion (optional — omit the whole line to keep the original section)
Reason: <one or two sentences — which check failed or what you adjusted>
Modified-text: <corrected item in the same prose shape — REQUIRED when Verdict is `modify`, omit otherwise>
```
Rules:
- The `Verdict` field must contain exactly one of the three tokens: `keep`, `modify`, `drop`. No extra punctuation, no synonyms.
- The `Severity` field is optional. When present, it must contain exactly one of the three tokens: `unchanged`, `critical`, `suggestion`. Omitting the line entirely is equivalent to `Severity: unchanged` — that is the common case; include the field only when you want to move the item between sections.
- `Reason` must reference the validation question(s) that drove the decision, in plain text. Do not output JSON or bullet lists here. If `Severity` is not `unchanged`, also state in `Reason` why the original section was wrong.
- `Modified-text` MUST appear only with `Verdict: modify`. For `keep` and `drop` omit the line entirely.
- Process items in the same order as the input. Do not reorder, merge, or skip headings.
- Produce one block for every input heading, even if the verdict is `drop`. The parser matches by `### Item N` and considers a missing block a malformed response.
- Do not output anything before the first `### Item N` block or after the last one. No prologue, no summary, no closing remarks.
## Severity rules
{{SEVERITY_RULES}}
## Project context
{{PROJECT_CONTEXT}}
## Reviewed diff
{{REVIEWED_DIFF}}
## Items to validate
{{ITEMS}}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |