.agents/skills/staged-changes-review/SKILL.md
Checklist-driven review of staged Git changes with deterministic rule scanning and semantic analysis. Use when the user wants to review staged changes, check for errors before commit, or validate code quality before committing.
npx skillsauth add adonis0123/adonis-skills staged-changes-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Checklist-driven, deterministic review of Git staged changes. Produces reproducible findings by combining grep-based scanning with closed-question semantic analysis.
重要:本技能必须使用中文输出所有分析结果和建议。
Execute steps in strict order: 0 → 0.5 → 1 → 2 → 2.5 → 3 → 4 → 5. Do not skip or reorder any step.
git diff --cached
git diff --cached --stat
git diff --cached --name-status
If no staged changes exist, output "无暂存变更,审查终止。" and stop.
Detect the project type once to determine which rule categories to activate.
# Detect framework
python3 -c "
import json, sys
try:
with open('package.json') as f:
d = json.load(f)
deps = {**d.get('dependencies', {}), **d.get('devDependencies', {})}
if 'next' in deps:
print('react-nextjs')
elif 'react' in deps:
print('react-app')
else:
print('generic')
except:
print('generic')
" 2>/dev/null || echo "generic"
# Count staged file types
git diff --cached --name-only | grep -cE '\.(tsx|jsx)$' || echo 0
git diff --cached --name-only | grep -cE '\.py$' || echo 0
Record the detected profile — it determines active rule categories:
| Profile | Condition | Active Rule Categories |
|---------|-----------|----------------------|
| react-nextjs | next in dependencies | SEC + REACT + PERF + ASYNC + STR + LOGIC/BREAK |
| react-app | react but no next | SEC + REACT + ASYNC + STR + LOGIC/BREAK |
| python-generic | Python files majority, no package.json | SEC + STR + LOGIC/BREAK |
| generic | No package.json or detection failed | SEC + STR + LOGIC/BREAK |
REACT-* and PERF-* rules are skipped entirely for python-generic or generic profiles. If detection fails, default to generic.
Classify every staged file into priority tiers using the rules in references/review-rules.md §1.
For each file (P0 → P3 order), execute every applicable deterministic rule from references/review-rules.md §2.
Execution method:
references/language-patterns.md matching the file's language.git diff --cached -- <file>) or the file itself.references/review-rules.md §4 — do NOT modify severity.MANDATORY: Every rule × file combination must be executed or explicitly marked N/A (wrong file type or inactive profile). Do not skip rules because "they seem unlikely."
For P0/P1 files, run a one-time impact scope assessment and record results for the "影响范围" section.
# 1. New/modified exported symbols in staged diff
git diff --cached -U0 -- "*.ts" "*.tsx" | grep -E "^\+export (function|const|class|interface|type)"
# 2. API route changes
git diff --cached --name-only | grep -E "app/api/|pages/api/"
# 3. Server Action changes (security impact)
git diff --cached -- "*.ts" "*.tsx" | grep -E '^[+-].*("use server"|'"'"'use server'"'"')'
# 4. Environment variable changes
git diff --cached -- ".env*" 2>/dev/null | grep -E "^[+-][A-Z_]+" | head -10
For each exported symbol found (up to 5 symbols), check reference count:
# Replace SYMBOL_NAME with actual symbol
grep -rl "SYMBOL_NAME" --include="*.ts" --include="*.tsx" src/ 2>/dev/null | wc -l
If no impact scope items are detected, note "无显著影响范围变更" in the report.
For each file (P0 → P3 order), answer every applicable semantic question from references/review-rules.md §3.
Execution method:
Read tool for full file when needed).MANDATORY: Answer every question. Do not skip questions because context seems insufficient — answer N/A with a brief reason instead.
{ruleId}:{file}:{line}.references/report-template.md §3.Output the report using the exact structure from references/report-template.md §2.
references/review-rules.md §5 based on highest severity found.references/report-template.md §1 format, grouped by severity.These constraints are non-negotiable. Violating any constraint invalidates the review.
{ruleId}:{file}:{line} format.When staged changes are large (>500 lines or >15 files):
REACT/ASYNC rule sampling limit: For rules that require Read tool for semantic verification (REACT-001, REACT-003, ASYNC-001, ASYNC-002), if grep returns more than 5 matches, take the first 5 matches only and note "N 处未验证(采样限制)". This prevents excessive Read tool calls.
This skill's output is consumed by staged-review-validator. The following fields are required for compatibility:
[ruleId] prefix (e.g., [SEC-003] SQL 拼接风险)指纹 (Fingerprint) fieldreferences/report-template.md §2references/review-rules.md — Rule definitions, file classification, severity mappingreferences/report-template.md — Finding format, report structure, output budgetreferences/language-patterns.md — Language-specific grep patterns by rule IDdevelopment
Use this skill when the user wants to set, write, or use a goal or /goal that makes a coding agent keep working until a verifiable done condition is met. This skill configures the autonomy and stopping contract for Codex, Claude Code, or portable agent prompts; it does not perform the underlying task. Trigger on requests like 'should I set a goal?', 'set up a durable goal', 'give me a /goal prompt', 'keep refactoring until tests pass', 'I am stepping away, have the agent finish this', or goal prompts for migrations, refactors, ports, spec implementations, eval loops, backlog cleanup, or multi-checkpoint work. Do not use for single quick edits, running tests once, OKR/scrum goal questions, recurring reminders, or token-budget settings.
testing
Create safe Git feature or hotfix branches with concise names. Use this whenever the user asks to create a branch, start work on a new feature or fix, wants a `feat/...` or `hotfix/...` branch name, asks for a short branch slug from a task description, or wants help before beginning local Git work. Default to recommending the branch name and command first, then create only after user confirmation. Do not push, commit, rebase, or create PRs.
tools
Use when the user's pain is "adding/removing one more X means editing N files" and X is a recurring variant kind: popup, banner, modal, ad slot, payment method, AI model/tool, form field type, connector, sub-site, command, menu item, agent, extension point, or data source. Use when they want to design, refactor, review, name, or explain a pluggable mechanism using registry, interface/trait contract, runtime core, and convention folders; mention pluginize, pluggable, plugin architecture, extension point, registry pattern, or extensibility. Use when explaining the first-principles rationale, DDD/SOLID/OCP mapping, or industry analogies behind that structure. Use for cross-stack mapping to VSCode contributes, Webpack/Vite plugins, Rust/Tauri connectors, Python entry_points, or cargo features. Skip one variant's internals/styles/hooks/copy/bugs, and skip register/registry meaning DI container, user signup, or package registry.
development
Use BEFORE heavier workflow skills when route choice matters. Route creative work without a design doc/spec to Brainstorm; destructive or hard-to-reverse work to Discuss; unresolved decisions, Plan/Full fan-out, ship checks, unclear bugs, and fresh-eyes fix-then-re-review need this gate. Skip single-line read-only lookups, pure typo/formatting edits, trivial safe one-line fixes, and clearly safe named-skill requests. Outputs Route, Runtime skill, Fallback alias, and Execution path.