aif-review
Skill264 starsChanged 2 months agoBSD-3-ClauseView on GitHub
Perform 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.
5 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- letuhao/lore-weaveword for word, first seen Oct 17, 2026
- lee-to/ai-factoryedited, first seen Sep 22, 2026
- maister-dev/maisteredited, first seen May 27, 2026
- evergonlabs/aiframeworktheir own version, first seen Apr 17, 2026
- hightemp/go_computer_use_mcp_serveredited, first seen Mar 21, 2026
Used with
Projects with it also use aif-distillation and aif-reference.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
maister-devSkillaif-distillation
Distill books, documents, folders, or URLs into compact, practical Agent Skills. Use when source material should become either one reusable skill package or a split set of focused skills, each with a concise SKILL.md plus detailed references and examples.
Also in 3 projects that use this
maister-devSkillaif-reference
Create knowledge references from URLs, documents, or files for use by AI agents. Fetch, process, and store structured references in the configured references directory (default: .ai-factory/references/).
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 1
- letuhao/lore-weave★ 35100% same
Edited · 3
- lee-to/ai-factory★ 1.2k37% same
- maister-dev/maister★ 1089% same
- hightemp/go_computer_use_mcp_server★ 285% same
Wrote their own version · 1
- evergonlabs/aiframework★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- aif-architectureSkill
- aif-archiveSkill
- aif-best-practicesSkill
- aif-build-automationSkill
- aif-ciSkill
- aif-commitSkill
- aif-docsSkill
- aif-evolveSkill
- aif-exploreSkill
- aif-fixSkill
- aif-groundedSkill
- aif-implementSkill
- aif-improveSkill
- aif-loopSkill
- aif-planSkill
- aif-qa-checkSkill
- aif-qaSkill
- aif-roadmapSkill
- aif-rules-checkSkill
- aif-rulesSkill
- aif-security-checklistSkill
- aif-skill-generatorSkill
- aifSkill
- aif-verifySkill
- golang-code-styleSkill
- golang-concurrencySkill
- golang-contextSkill
- golang-databaseSkill
- golang-design-patternsSkill
- golang-documentationSkill
- golang-error-handlingSkill
- golang-namingSkill
- golang-performanceSkill
- golang-securitySkill
- golang-testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. 2 are common, 12 are distinctive, and 12 are very specific to this project.
2
Common
Most of the 4 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
- Very specific: line 20
If config.yaml doesn't exist, use defaults:
- Distinctive: line 29
Before routing the argument string into one of the modes below, extract any standalone tokens that flag optional behavior.
- Very specific: line 33
If the leftover argument string is empty, fall back to the empty-argument mode (staged review).
- Common: line 39
Run git diff --cached to get staged changes
- Common: line 40
If nothing staged, run git diff for unstaged changes
- Very specific: line 45
Use gh pr view <number> --json to get PR details
- Very specific: line 46
Use gh pr diff <number> to get the diff
- Very specific: line 85
If no commits found (HEAD is at or behind <ref>), inform the user and stop.
- Distinctive: line 88
If more than 20 commits, ask the user before proceeding:
- Distinctive: line 118
Before finalizing review findings, run read-only context gates:
- Distinctive: line 120
Check the resolved architecture artifact (if present) for boundary/dependency alignment issues.
- Distinctive: line 121
Check the resolved RULES.md artifact (if present) for explicit convention violations.
- Very specific: line 122
Check the resolved roadmap artifact (if present) for milestone alignment and mention missing linkage for likely feat/fix/perf work.
- Very specific: line 128
If the user wants a standalone rules-only pass, suggest /aif-rules-check.
- Distinctive: line 154
Treat them as project-level overrides for this skill's general instructions
- Very specific: line 155
When a skill-context rule conflicts with a general rule written in this SKILL.md,
- Very specific: line 157
When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
- Distinctive: line 158
Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults — they exist because the project's experience …
- Distinctive: line 165
Enforcement: After generating any output artifact, verify it against all skill-context rules.
- Distinctive: line 166
If any rule is violated — fix the output before presenting it to the user.
- Very specific: line 238
When +check reclassifies an item, a short [+check: …] suffix is appended to the item text.
- Very specific: line 257
When the +check flag is set, the aif-gate-result block is assembled after validator filtering — status, blockers, affected_files, and …
- Distinctive: line 266
Ask questions instead of making assumptions
- Distinctive: line 296
If GitHub MCP is configured, can:
- Distinctive: line 299
Add labels based on review outcome
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Review Assistant
Perform thorough code reviews focusing on correctness, security, performance, and maintainability.
Step 0: Load Config
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
- Paths:
paths.description,paths.architecture,paths.rules_file,paths.roadmap, andpaths.rules - Language:
language.uifor review summary language - Git:
git.base_branchfor branch comparison guidance
If config.yaml doesn't exist, use defaults:
- Paths:
.ai-factory/for all artifacts - Language:
en(English) - Git:
base_branch: main
Behavior
Argument flags
Before routing the argument string into one of the modes below, extract any standalone tokens that flag optional behavior. Strip them from the argument string and route the remainder normally.
+check— runs the optional findings validator after the review is produced. The full procedure (when to run, failure modes, output additions, gate-result recomputation) lives inreferences/CHECK-MODE.md. Default is OFF; the validator runs only when this token is present. The token may appear before or after the main argument (e.g./aif-review +check,/aif-review 123 +check,/aif-review main +check).
If the leftover argument string is empty, fall back to the empty-argument mode (staged review). Unknown +-prefixed tokens are passed through as part of the main argument so they are not silently consumed.
Edge case: a git ref literally named
+checkwill be consumed by the flag stripper — acceptable compromise.
Without Arguments (Review Staged Changes)
- Run
git diff --cachedto get staged changes - If nothing staged, run
git difffor unstaged changes - Analyze each file's changes
With PR Number/URL
- Use
gh pr view <number> --jsonto get PR details - Use
gh pr diff <number>to get the diff - Review all changes in the PR
With Git Ref (Commits Mode)
Argument routing chain:
- Empty → staged review (see above)
- Digits or
#N→ PR mode (see above) - Everything else → validate via
git rev-parse --verify→ commits mode or ask user
Validation:
git rev-parse --verify <argument> 2>/dev/null- Valid ref → enter commits mode (steps below)
Invalid ref → do NOT fall back to staged review silently. Ask the user to clarify:
AskUserQuestion: `<argument>` is not a valid git ref. What did you mean? Options: 1. Review staged changes instead 2. CancelBased on choice:
- "Review staged changes" → run staged review (default mode)
- "Cancel" → inform the user that review was cancelled → STOP
- "Other" → user provides corrected ref → re-validate via
rev-parse
Edge case: a branch with a purely numeric name (e.g.
123) will be interpreted as a PR number — acceptable compromise.
Steps:
- Get commit list between the ref and HEAD:
If no commits found (HEAD is at or behindgit log --oneline --reverse <ref>..HEAD<ref>), inform the user and stop. Check commit count: If more than 20 commits, ask the user before proceeding:
AskUserQuestion: Found <N> commits to review. Reviewing all of them will be slow and consume significant context. How to proceed? Options: 1. Review all <N> commits 2. Review only the last 20 3. CancelBased on choice:
- "Review all" → continue with the full commit list
- "Review only the last 20" → truncate the list to the 20 most recent commits (keep chronological order)
- "Cancel" → inform the user that review was cancelled → STOP
- Review each commit:
For each commit check:git show <commit-hash> --stat git show <commit-hash>- Does the commit message match the actual changes?
- Are changes atomic (single logical unit per commit)?
- Are there any issues introduced in this specific commit?
- Provide combined summary with per-commit notes
Context Gates (Read-Only)
Before finalizing review findings, run read-only context gates:
- Check the resolved architecture artifact (if present) for boundary/dependency alignment issues.
- Check the resolved RULES.md artifact (if present) for explicit convention violations.
- Check the resolved roadmap artifact (if present) for milestone alignment and mention missing linkage for likely
feat/fix/perfwork.
Human gate result severity:
WARNfor non-blocking inconsistencies or missing optional files.ERRORonly for explicit blocking criteria requested by the user/review policy.
If the user wants a standalone rules-only pass, suggest /aif-rules-check. Keep human /aif-review gate labels at WARN / ERROR, then append the standard machine-readable gate result with pass|warn|fail status.
Machine-readable gate result
This section is the single owner of aif-gate-result computation:
- Append one final fenced
aif-gate-resultJSON block after the human-readable review. - Use
"gate": "review". "status": "pass|warn|fail"— the more severe (fail>warn>pass) of two independent inputs:- findings input —
failwhen any "Critical Issues" item remains (critical correctness, security, data-loss, performance, downstream regression — seereferences/SEVERITY.mdfor the authoritative critical/suggestion definitions);warnwhen only "Suggestions", missing optional context, or review uncertainty remain;passwhen nothing material remains. - context-gate input —
failfor a blocking (ERROR) gate finding;warnfor a non-blocking (WARN) one;passwhen none. - A failing context gate keeps
"status"atfaileven with zero Critical Issues — a clean findings list must never mask a failed gate.
- findings input —
"blocking": true|false—trueonly when"status"isfail."blockers"— merge-blocking findings only: every "Critical Issues" item and every blocking context-gate finding, nothing else."affected_files"— reviewed or implicated paths."suggested_next.command"follows"status":fail→/aif-fixby default, but if every blocker came from a single context gate point at that gate's command instead (rules gate →/aif-rules, architecture gate →/aif-architecture, roadmap gate →/aif-roadmap);warn/pass→/aif-commit;nullonly when no command fits.
/aif-review is read-only for context artifacts by default. Do not modify context files unless user explicitly asks.
Project Context
Read .ai-factory/skill-context/aif-review/SKILL.md — MANDATORY if the file exists.
This file contains project-specific rules accumulated by /aif-evolve from patches,
codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
How to apply skill-context rules:
- Treat them as project-level overrides for this skill's general instructions
- When a skill-context rule conflicts with a general rule written in this SKILL.md, the skill-context rule wins (more specific context takes priority — same principle as nested CLAUDE.md files)
- When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
- Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults — they exist because the project's experience proved the default insufficient
- CRITICAL: skill-context rules apply to ALL outputs of this skill — including the review summary format and the checklist criteria. If a skill-context rule says "review MUST check X" or "summary MUST include section Y" — you MUST augment the output accordingly. Producing a review that ignores skill-context rules is a bug.
Enforcement: After generating any output artifact, verify it against all skill-context rules. If any rule is violated — fix the output before presenting it to the user.
Review Checklist
Correctness
- Logic errors or bugs
- Edge cases handling
- Null/undefined checks
- Error handling completeness
- Type safety (if applicable)
Security
- SQL injection vulnerabilities
- XSS vulnerabilities
- Command injection
- Sensitive data exposure
- Authentication/authorization issues
- CSRF protection
- Input validation
Performance
- N+1 query problems
- Unnecessary re-renders (React)
- Memory leaks
- Inefficient algorithms
- Missing indexes (database)
- Large payload sizes
Best Practices
- Code duplication
- Dead code
- Magic numbers/strings
- Proper naming conventions
- SOLID principles
- DRY principle
Testing
- Test coverage for new code
- Edge cases tested
- Mocking appropriateness
Output Format
## Code Review Summary
**Files Reviewed:** [count]
**Risk Level:** 🟢 Low / 🟡 Medium / 🔴 High
### Context Gates
[Architecture / Rules / Roadmap gate results with WARN/ERROR labels]
### Critical Issues
[Each item is a short paragraph in prose, not a labeled record. Order inside the paragraph:
1. Behavioral impact — what breaks for the user or downstream code.
2. Optional note — a code citation, a consequence, or extra context. Include only if it adds signal; skip otherwise.
3. Path — file:line of the affected location (or the closest anchor).
4. Suggested fix — concrete edit that addresses the behavior above.
Example:
> Two clients buying the last item both get a confirmation and stock goes negative — the order creation and stock reservation run in separate transactions. `src/services/order.ts:42`. Wrap `OrderService.create` and `InventoryService.reserve` in a shared transaction so the second buyer fails fast with "out of stock".]
### Suggestions
[Same item shape as Critical Issues. The behavioral impact describes a non-blocking improvement (clarity, performance budget, missing log), not a bug.]
### Questions
[Free-form clarifications. Path optional, fix optional — these are open questions for the author, not findings.]
### Positive Notes
[Free-form acknowledgements of good patterns. No path/fix required.]When +check reclassifies an item, a short [+check: …] suffix is appended to the item text; see references/CHECK-MODE.md for the exact wording.
Append the final machine-readable result after the markdown summary:
{
"schema_version": 1,
"gate": "review",
"status": "pass",
"blocking": false,
"blockers": [],
"affected_files": [],
"suggested_next": {
"command": "/aif-commit",
"reason": "Review found no blocking issues."
}
}When the +check flag is set, the aif-gate-result block is assembled after validator filtering — status, blockers, affected_files, and suggested_next are recomputed accordingly. Exception: the whole-dispatch failure path keeps the unfiltered original list and does NOT recompute these fields. See references/CHECK-MODE.md for the full procedure.
Review Style
- Be constructive, not critical
- Explain the "why" behind suggestions
- Provide code examples when helpful
- Acknowledge good code
- Prioritize feedback by importance
- Ask questions instead of making assumptions
Examples
User: /aif-review
Review staged changes in current repository.
User: /aif-review 123
Review PR #123 using GitHub CLI.
User: /aif-review https://github.com/org/repo/pull/123
Review PR from URL.
User: /aif-review 2.x
Review all commits on the current branch compared to branch 2.x.
User: /aif-review main
Review all commits on the current branch compared to main (or to whatever branch is configured as git.base_branch in this repository).
User: /aif-review v1.0.0
Review all commits on the current branch compared to tag v1.0.0.
User: /aif-review +check
Review staged changes, then run the +check validator over Critical Issues and Suggestions before rendering. The validator can drop invented items, rewrite partially-correct ones, and reclassify items between the two severity levels (promote a suggestion to critical or demote a critical to suggestion — see references/SEVERITY.md for the rules). It adds a filtering-summary line and rebuilds the gate result from the surviving findings; see references/CHECK-MODE.md for the exact line format.
User: /aif-review 123 +check
Review PR #123 with +check validation enabled.
Integration
If GitHub MCP is configured, can:
- Post review comments directly to PR
- Request changes or approve
- Add labels based on review outcome
Tip: Context is heavy after code review. Consider
/clearor/compactbefore continuing with other tasks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

