Code Review
Review changed files and report issues by severity.
Workflow
- Run
git diff --name-only HEAD~1to collect changed files - For each file, read the content and diff
- Apply rules in order (stop-on-error for security):
rules/security.md— MUST pass, any error blocks deploymentrules/performance.md— warnings and errorsrules/style.md— warnings only
- Generate structured report (see output format below)
- Log metrics: run
scripts/append-log.tswith the results
Output Format
# Review: [branch-name]
## Summary
- Files: X | Issues: Y (E errors, W warnings)
## Security (rules/security.md)
| File | Line | Issue |
|------|------|-------|
## Performance (rules/performance.md)
| File | Line | Issue |
|------|------|-------|
## Style (rules/style.md)
| File | Line | Issue |
|------|------|-------|
Configuration
Skip patterns: *.test.ts, *.spec.ts, *.d.ts, *.min.js
Max file size: 10000 lines (skip larger files)
Constraints
- Do NOT auto-fix code — only report issues
- Do NOT send notifications — that is the CI pipeline's job
- Do NOT generate trend reports inline — use
scripts/trend-report.tsseparately - Keep the report under 200 lines; link to files instead of quoting large blocks
Rules
Rules are loaded from rules/ directory:
rules/security.md— injection, XSS, secrets, auth bypassrules/performance.md— N+1, bundle size, memory leaks, framework-specificrules/style.md— naming, complexity, dead code, formatting
References
Loaded conditionally based on file types in the changeset:
references/react.md— when .tsx/.jsx files are presentreferences/vue.md— when .vue files are presentreferences/typescript-strict.md— when tsconfig strict mode is enabledreferences/api-design.md— when files in src/api/ or src/routes/ are changed
Scripts
scripts/collect-metrics.ts— extract metrics from review resultsscripts/append-log.ts— append metrics to data/review-log.jsonlscripts/trend-report.ts— generate trend report (run separately)scripts/score.ts— calculate review score from issues
What Was Removed (vs the bloated version)
The original 300+ line SKILL.md included:
- Inline security rules (→ moved to
rules/security.md) - Inline performance rules (→ moved to
rules/performance.md) - Inline style rules (→ moved to
rules/style.md) - Auto-fix logic (→ removed; separate skill responsibility)
- Deploy notification (→ removed; CI pipeline responsibility)
- Trend report generation (→ moved to
scripts/trend-report.ts) - Detailed code examples for every rule (→ moved to
references/)
Result: 300+ lines → ~150 lines. Each concern in its own file.