一键导入
code-review
Security and quality review of uncommitted changes. Checks for vulnerabilities, code smells, and best practice violations. Use before committing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Security and quality review of uncommitted changes. Checks for vulnerabilities, code smells, and best practice violations. Use before committing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | code-review |
| updated | "2026-02-20T00:00:00.000Z" |
| description | Security and quality review of uncommitted changes. Checks for vulnerabilities, code smells, and best practice violations. Use before committing. |
| argument-hint | ["--staged|--all"] |
| (default | --all uncommitted) |
| allowed-tools | Bash, Read, Grep, Glob, TodoWrite |
Systematic security and quality review of uncommitted changes. Groups findings by severity.
git diff --name-only HEAD
git diff --name-only --cached
Combine staged and unstaged changes. Filter to source files. If --staged argument, only review staged files.
For each changed file, get the full diff:
git diff HEAD -- <file>
Read the diff carefully. Focus on ADDED and MODIFIED lines (lines starting with +).
Review each changed file against three severity tiers.
| Check | Pattern | Why |
|---|---|---|
| Hardcoded secrets | API keys, passwords, tokens in source | Credential exposure |
| SQL injection | String concatenation in SQL queries | Data breach |
| XSS vulnerability | Unescaped user input rendered as HTML | Script injection |
| Missing input validation | API handlers without validation | Injection attacks |
| Path traversal | User input in file paths without sanitization | File system access |
| Exposed server secrets | Server-only env vars in client code | Key leakage |
| Command injection | User input in shell commands without sanitization | Remote code execution |
| Check | Pattern | Why |
|---|---|---|
| Functions > 80 lines | Count lines in new/modified functions | Maintainability |
| Nesting > 4 levels | Deeply nested if/for/try blocks | Readability |
| Missing error handling | Async calls without try-catch or error handling | Runtime crashes |
| Debug statements | console.log, print(), dbg!() in production code | Debug noise |
| TODO/FIXME/HACK comments | Temporary markers being committed | Technical debt |
| Unused imports | Imports not referenced in changed code | Dead code |
| Any/unknown type usage | as any, : any, # type: ignore | Type safety loss |
| Hardcoded URLs/ports | http://localhost:3000 or similar | Environment coupling |
| Check | Pattern | Why |
|---|---|---|
| Direct state mutation | Mutating objects/arrays instead of copies | Bugs in reactive frameworks |
| Missing loading states | Async data fetching without loading/error UI | UX |
| Missing accessibility | Interactive elements without aria labels | a11y |
| Magic numbers | Unexplained numeric constants | Readability |
| Missing types | Implicit any from missing type annotations | Type safety |
| Large file additions | New files > 300 lines | Consider splitting |
CODE REVIEW: <file count> files reviewed
═══════════════════════════════════════
CRITICAL (X issues) — Must fix before commit
[C1] src/api/foo.ts:42 — Hardcoded API key in source
[C2] src/components/Bar.tsx:18 — Unescaped user input in HTML
HIGH (X issues) — Should fix
[H1] src/store/slice.ts:100-180 — Function exceeds 80 lines (80 lines)
[H2] src/api/bar.ts:25 — Missing try-catch on async operation
MEDIUM (X issues) — Nice to fix
[M1] src/components/Baz.tsx:55 — Hardcoded string (consider i18n)
[M2] src/utils/calc.ts:12 — Magic number 86400 (add named constant)
═══════════════════════════════════════
VERDICT: [COMMIT OK / FIX REQUIRED]
FIX REQUIRED, do not commitFIX REQUIREDCOMMIT OK with suggestionsCOMMIT OKRun the build and intelligently fix errors with guardrails. Stops if fixes introduce more errors or the same error persists after 3 attempts.
Context window conservation rules. Invoke when approaching context limits or before large tasks.
Create session learning logs that persist institutional memory across Claude Code sessions.
Deep reflection on the skill learning system itself. Analyzes what's working, what's stale, and proposes structural improvements. The meta-skill.
Deep security audit for web applications. Checks secrets, input validation, XSS, API security, and dependency vulnerabilities.
Pre-PR verification loop. Runs build, type check, lint, security audit, and debug statement scan. Use before creating PRs or merging.