一键导入
local-review
Review local code changes (or full codebase) and produce a structured review summary with P0-P3 severity findings from 5 specialized agents.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review local code changes (or full codebase) and produce a structured review summary with P0-P3 severity findings from 5 specialized agents.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | local-review |
| description | Review local code changes (or full codebase) and produce a structured review summary with P0-P3 severity findings from 5 specialized agents. |
| disable-model-invocation | true |
Review local code — either changes from the main branch or the full codebase — using 5 specialized review agents in parallel. Produces a structured markdown report at /tmp/local-review.md with P0-P3 severity findings.
This skill uses the same agents, severity system, and confidence threshold as github-pr-review, but targets local code instead of a GitHub PR.
/local-review [path] [--all [path]]
Parse $ARGUMENTS as follows:
src/auth.ts, src/**)--all — review ALL tracked code in the repository, not just the diff--all <path> — review all tracked code under the given directory (e.g. --all ./roles/base)If --all is present, extract it and any path that follows it. Everything else is ignored.
Otherwise, any remaining text is treated as a path/glob scope for the diff.
REQUIRED STEPS (do not skip):
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
If that fails, fall back to checking for main then master:
git rev-parse --verify main 2>/dev/null && echo main || echo master
Store the result as $MAIN_BRANCH.
Default mode (diff from main branch):
# Changes on this branch compared to main
git diff $MAIN_BRANCH...HEAD
If $ARGUMENTS contains a path/glob (but not --all), limit the diff:
git diff $MAIN_BRANCH...HEAD -- $PATH
If the diff is empty, check for uncommitted changes (git diff HEAD). If still empty, tell the user there are no changes to review and stop.
If there are untracked files the user likely cares about, note them but don't review their full contents unless they appear related to the changed files.
--all mode (full codebase):
--all ./roles/base), identify all tracked files under that path:
git ls-files -- <path>
git ls-files
Default mode:
git diff $MAIN_BRANCH...HEAD --name-only
--all mode:
Use the file list from step 2.
Each agent analyzes the changeset (or full files in --all mode) for their specialty:
| Agent | Focus Area | Examples |
|---|---|---|
| SOLID + Architecture | SRP violations, god classes, coupling | OCP violations, hidden dependencies |
| Security | Injection, auth issues, hardcoded secrets | Data exposure, IDOR, XSS |
| Performance | N+1 queries, inefficient algorithms | Missing caching, O(n^2) |
| Error Handling | Swallowed exceptions, missing boundaries | Async error issues, unchecked returns |
| Boundary Conditions | Null dereference, empty collections | Off-by-one, overflow, race conditions |
Each agent uses the same P0-P3 severity system and >= 80% confidence threshold as github-pr-review.
Agents should read the actual source files (not just the diff) to understand context.
When launching each agent, provide:
--all mode)Each agent produces structured findings:
## [Agent Name] Review
### Critical (P0) - Must Fix
- **[file:line]** Issue description
- Confidence: 95%
- Fix: [Suggestion or explanation]
### High (P1) - Should Fix
- **[file:line]** Issue description
- Confidence: 85%
- Fix: [Suggestion]
### Medium (P2) - Consider Fixing
...
### Low (P3) - Optional
...
When a concrete code fix is available, agents MUST include a GitHub-style suggestion block:
```suggestion
// the corrected code
```
All agents use a consistent P0-P3 severity system:
| Level | Name | Action |
|---|---|---|
| P0 | Critical | Must fix — security vulnerability, data loss, crash |
| P1 | High | Should fix — correctness issue, significant maintainability problem |
| P2 | Medium | Consider fixing — code smell, minor performance issue |
| P3 | Low | Optional improvement — style, naming, minor clarity |
All agents use 80+ confidence threshold:
| Score | Meaning | Reported? |
|---|---|---|
| 0-49 | Not confident (false positive) | No |
| 50-79 | Somewhat confident (nitpick) | No |
| 80-89 | Confident (real issue) | Yes |
| 90-100 | Very confident (critical) | Yes |
Write a single markdown file to /tmp/local-review.md:
# Local Review
**Branch:** <current branch>
**Mode:** <"Changes from <main branch>" or "Full review" or "Full review (./path)">
**Files reviewed:** <count>
**Review date:** <date>
## Summary
<1-3 sentence overview of the changeset and overall quality>
| Severity | Count |
|----------|-------|
| P0 Critical | N |
| P1 High | N |
| P2 Medium | N |
| P3 Low | N |
## Critical (P0) — Must Fix
### <file:line> — <title>
**Agent:** <which reviewer> | **Confidence:** <N>%
<description>
```suggestion
// fix if available
...
...
...
**Omit severity sections that have no findings.**
### 6. Open the review file
- If `mcp__ide__openFile` tool is available, use it to open `/tmp/local-review.md` in the IDE.
- Otherwise, run: `idea <current_project_dir> /tmp/local-review.md` (falls back to `open /tmp/local-review.md` if `idea` is not available). The project dir ensures IntelliJ opens the file in the correct window.
### 7. Tell the user
Review written to /tmp/local-review.md with findings.
<severity summary, e.g.: 1 Critical (P0), 3 High (P1), 2 Medium (P2)>
## When to Use
- Reviewing local changes before committing or opening a PR
- Full codebase audits (`--all`)
- Scoped audits on a subdirectory (`--all ./src/auth`)
- Pre-PR quality checks on the current branch
## Common Mistakes
| Mistake | Fix |
|---------|-----|
| Reviewing only the diff without reading source for context | Agents must read full source files to understand context |
| Skipping empty-diff check | Always check for empty diff and stop early |
| Not checking uncommitted changes when branch diff is empty | Fall back to `git diff HEAD` |
| Reporting findings below 80% confidence | Only report >= 80% confidence |
| Missing severity sections in output | Omit empty sections, don't show "None" |
## Red Flags - You're About to Violate the Pattern
Stop if you're thinking:
- **"The diff is enough context"** — No. Agents must read full source files for context.
- **"I'll skip the confidence threshold"** — No. Only report >= 80%.
- **"I'll just review without agents"** — No. Launch all 5 agents in parallel.
- **"I'll post this to GitHub"** — No. This is local-only. Use `/github-pr-review` for PRs.