Code Review
Objective
Find high-impact defects in changed code with evidence. Prioritize security, correctness, and regressions over style nits.
Arguments
--fix: After reporting findings, apply all suggested fixes automatically in severity order (CRITICAL -> HIGH -> MEDIUM -> LOW), then rerun targeted checks and report exactly what changed.
--skip-profile <name>: Skip an optional domain profile by stem or filename. Repeatable. Example: --skip-profile naming.
- Default: Report findings and wait for confirmation before editing.
Scope Resolution
- Verify repository context:
git rev-parse --git-dir. If this fails, stop and tell the user to run from a git repository.
- If user provides file paths/patterns, a commit/range, or a
Resolved scope fenced block with one repo-relative path per line, scope is exactly those targets.
- Otherwise, scope is only session-modified files. Do not include other uncommitted changes.
- If there are no session-modified files, fall back to all uncommitted tracked + untracked files:
- tracked:
git diff --name-only --diff-filter=ACMR
- untracked:
git ls-files --others --exclude-standard
- combine both lists and de-duplicate.
- Exclude generated/low-signal files unless requested: lockfiles, minified bundles, build outputs, vendored code.
- If scope still resolves to zero files, report and stop.
Workflow
- Resolve scope and read diffs plus minimal surrounding context.
- Classify files by domain/risk.
- Apply the core checks below plus only the domain profiles that match the current diff. Honor any
--skip-profile exclusions.
- Generate findings with: location, impact, evidence, confidence, and concrete fix.
- Assign severity with the model below.
- Default behavior: report and wait.
- With
--fix: apply all suggested fixes in severity order, then run targeted verification.
- Report using the output schema below.
Core Review Checks
Apply on every run.
Checks
CORE-001 Behavior regression (HIGH): changed branch/state transition alters external behavior.
CORE-002 Error-path safety (HIGH): failures can cascade, crash, or return unsafe defaults.
CORE-003 Boundary handling (HIGH): null/empty/overflow/edge inputs are not handled.
CORE-004 Resource hygiene (MEDIUM): leaked timers/listeners/handles/connections.
CORE-005 Complexity hotspot (MEDIUM): change introduces avoidable coupling or hidden side effects.
CORE-006 Test gap (MEDIUM): changed behavior has no targeted test coverage.
Evidence Expectations
- Show the concrete input/state that triggers failure.
- Point to changed lines or nearby guards that caused the risk.
Profile Dispatch
references/profiles/security.md: auth, external input, secrets, crypto, public network surfaces, unsafe parsing.
references/profiles/configuration.md: env/config, timeouts, retries, pools, limits, resource tuning, rollout controls.
references/profiles/typescript-react.md: TypeScript/JavaScript/React/Node files.
references/profiles/python.md: Python services, scripts, async workloads.
references/profiles/shell.md: shell scripts, CI command blocks, deployment scripts.
references/profiles/smart-contracts.md: Solidity/Solana/on-chain protocol code.
references/profiles/data-formats.md: CSV/JSON/YAML/binary ingestion/export/parsing.
references/profiles/naming.md: naming/intent clarity after correctness and security issues are handled. This profile is optional and can be skipped explicitly.
Load only profiles relevant to touched files. Prefer no more than three domain profiles per pass unless the user requests a deep audit.
Severity Model
- CRITICAL: exploitable security flaw, data loss path, or outage risk on critical paths.
- HIGH: logic defect or performance failure that can break core behavior.
- MEDIUM: maintainability/reliability issue likely to cause near-term defects.
- LOW: localized clarity/style/documentation improvements.
Output Schema
Use this structure and order for every review result.
1. Scope
List reviewed files and any excluded patterns.
2. Findings (ordered)
Order by severity: CRITICAL -> HIGH -> MEDIUM -> LOW.
For each finding, use this shape:
[SEVERITY] Title — path/to/file.ext:line
- Impact: concrete user/system impact.
- Evidence: exact code behavior or diff evidence.
- Fix: smallest practical remediation.
- Confidence:
high | medium | low.
3. Suggested Fixes
Include when not using --fix.
4. Applied Fixes
Include only when --fix is used. List each change with file references.
5. Verification
List commands run and outcomes. Explicitly list skipped checks.
6. Residual Risks / Open Questions
Capture unresolved assumptions and follow-ups.
Rules
- Do not fabricate locations.
- Merge duplicate findings.
- Keep style-only issues at LOW unless they create operational risk.
Evidence Rules
- Never fabricate line numbers.
- Tie each finding to concrete code evidence.
- Explain blast radius and failure mode succinctly.
- Prefer targeted fixes over broad rewrites.
Verification
Run the narrowest checks that validate touched behavior:
- formatter/lint on touched files,
- targeted tests for impacted modules,
- typecheck when relevant.
If checks cannot run, state exactly what was skipped and why.
Stop Conditions
Stop and ask for direction when:
- fixes require API/contract redesign,
- behavior intent is too ambiguous to classify severity,
- required validation tooling is unavailable and risk is high.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: code-review-1833description: This skill should be used when the user asks to "review code", "review PR", "code review", "audit code", "check for bugs", "security review", "review my changes", "find issues in this code", "review the diff", or asks for pull request review or code audit. Use when this capability is needed.4---56# Code Review78## Objective910Find high-impact defects in changed code with evidence. Prioritize security, correctness, and regressions over style nits.1112## Arguments1314- `--fix`: After reporting findings, apply all suggested fixes automatically in severity order (`CRITICAL -> HIGH -> MEDIUM -> LOW`), then rerun targeted checks and report exactly what changed.15- `--skip-profile <name>`: Skip an optional domain profile by stem or filename. Repeatable. Example: `--skip-profile naming`.16- Default: Report findings and wait for confirmation before editing.1718## Scope Resolution19201. Verify repository context: `git rev-parse --git-dir`. If this fails, stop and tell the user to run from a git repository.212. If user provides file paths/patterns, a commit/range, or a `Resolved scope` fenced block with one repo-relative path per line, scope is exactly those targets.223. Otherwise, scope is **only** session-modified files. Do not include other uncommitted changes.234. If there are no session-modified files, fall back to all uncommitted tracked + untracked files:24 - tracked: `git diff --name-only --diff-filter=ACMR`25 - untracked: `git ls-files --others --exclude-standard`26 - combine both lists and de-duplicate.275. Exclude generated/low-signal files unless requested: lockfiles, minified bundles, build outputs, vendored code.286. If scope still resolves to zero files, report and stop.2930## Workflow31321. Resolve scope and read diffs plus minimal surrounding context.332. Classify files by domain/risk.343. Apply the core checks below plus only the domain profiles that match the current diff. Honor any `--skip-profile` exclusions.354. Generate findings with: location, impact, evidence, confidence, and concrete fix.365. Assign severity with the model below.376. Default behavior: report and wait.387. With `--fix`: apply all suggested fixes in severity order, then run targeted verification.398. Report using the output schema below.4041## Core Review Checks4243Apply on every run.4445### Checks4647- `CORE-001` Behavior regression (`HIGH`): changed branch/state transition alters external behavior.48- `CORE-002` Error-path safety (`HIGH`): failures can cascade, crash, or return unsafe defaults.49- `CORE-003` Boundary handling (`HIGH`): null/empty/overflow/edge inputs are not handled.50- `CORE-004` Resource hygiene (`MEDIUM`): leaked timers/listeners/handles/connections.51- `CORE-005` Complexity hotspot (`MEDIUM`): change introduces avoidable coupling or hidden side effects.52- `CORE-006` Test gap (`MEDIUM`): changed behavior has no targeted test coverage.5354### Evidence Expectations5556- Show the concrete input/state that triggers failure.57- Point to changed lines or nearby guards that caused the risk.5859## Profile Dispatch6061- `references/profiles/security.md`: auth, external input, secrets, crypto, public network surfaces, unsafe parsing.62- `references/profiles/configuration.md`: env/config, timeouts, retries, pools, limits, resource tuning, rollout controls.63- `references/profiles/typescript-react.md`: TypeScript/JavaScript/React/Node files.64- `references/profiles/python.md`: Python services, scripts, async workloads.65- `references/profiles/shell.md`: shell scripts, CI command blocks, deployment scripts.66- `references/profiles/smart-contracts.md`: Solidity/Solana/on-chain protocol code.67- `references/profiles/data-formats.md`: CSV/JSON/YAML/binary ingestion/export/parsing.68- `references/profiles/naming.md`: naming/intent clarity after correctness and security issues are handled. This profile is optional and can be skipped explicitly.6970Load only profiles relevant to touched files. Prefer no more than three domain profiles per pass unless the user requests a deep audit.7172## Severity Model7374- **CRITICAL**: exploitable security flaw, data loss path, or outage risk on critical paths.75- **HIGH**: logic defect or performance failure that can break core behavior.76- **MEDIUM**: maintainability/reliability issue likely to cause near-term defects.77- **LOW**: localized clarity/style/documentation improvements.7879## Output Schema8081Use this structure and order for every review result.8283### 1. Scope8485List reviewed files and any excluded patterns.8687### 2. Findings (ordered)8889Order by severity: `CRITICAL -> HIGH -> MEDIUM -> LOW`.9091For each finding, use this shape:9293- `[SEVERITY] Title — path/to/file.ext:line`94- Impact: concrete user/system impact.95- Evidence: exact code behavior or diff evidence.96- Fix: smallest practical remediation.97- Confidence: `high | medium | low`.9899### 3. Suggested Fixes100101Include when not using `--fix`.102103### 4. Applied Fixes104105Include only when `--fix` is used. List each change with file references.106107### 5. Verification108109List commands run and outcomes. Explicitly list skipped checks.110111### 6. Residual Risks / Open Questions112113Capture unresolved assumptions and follow-ups.114115### Rules116117- Do not fabricate locations.118- Merge duplicate findings.119- Keep style-only issues at LOW unless they create operational risk.120121## Evidence Rules122123- Never fabricate line numbers.124- Tie each finding to concrete code evidence.125- Explain blast radius and failure mode succinctly.126- Prefer targeted fixes over broad rewrites.127128## Verification129130Run the narrowest checks that validate touched behavior:131132- formatter/lint on touched files,133- targeted tests for impacted modules,134- typecheck when relevant.135136If checks cannot run, state exactly what was skipped and why.137138## Stop Conditions139140Stop and ask for direction when:141142- fixes require API/contract redesign,143- behavior intent is too ambiguous to classify severity,144- required validation tooling is unavailable and risk is high.145146---147> Converted and distributed by [TomeVault](https://tomevault.io/claim/paulrberg) — claim your Tome and manage your conversions.148<!-- tomevault:4.0:skill_md:2026-04-11 -->