code-review
Systematic code review: security checks, performance analysis, complexity assessment, best practice validation, and review checklists.
What this skill does
# Code Review
Systematic code review covering security, performance, maintainability, and correctness.
## Review a PR
```bash
# View PR diff
gh pr diff <PR_NUMBER>
# View specific file changes
gh pr diff <PR_NUMBER> -- src/specific-file.ts
# View PR details and checks
gh pr view <PR_NUMBER> --json title,body,additions,deletions,changedFiles,reviews | jq .
# List changed files
gh pr diff <PR_NUMBER> --name-only
```
## Review Checklist
When reviewing code, check each category:
### Correctness
- Does the code do what the PR description says?
- Are edge cases handled (null, empty, overflow, concurrency)?
- Are error paths handled, not just happy paths?
- Do new functions have clear input/output contracts?
### Security
- User input validated and sanitized before use?
- No SQL concatenation (use parameterized queries)?
- No secrets/credentials hardcoded?
- Auth checks on new endpoints?
- File paths validated (no path traversal)?
- HTML output escaped (no XSS)?
### Performance
- No N+1 queries or unbounded loops?
- Large data sets paginated?
- Database queries use indexes?
- No unnecessary re-renders (React) or recomputation?
- Caching considered where appropriate?
### Maintainability
- Functions do one thing?
- Names are descriptive (no `data`, `temp`, `result` without context)?
- No dead code or commented-out blocks?
- Complex logic has comments explaining *why* (not *what*)?
- Consistent with existing codebase patterns?
### Testing
- New code has tests?
- Tests cover edge cases, not just happy path?
- Tests are deterministic (no flaky timing, random data)?
- Mocks are reasonable (not mocking everything)?
## Complexity Analysis
```bash
# JavaScript/TypeScript — count function lengths
grep -rn "function\|=>" src/ | wc -l
# Find long functions (crude but useful)
awk '/function.*\{/{name=$0; count=0} /\{/{count++} /\}/{count--; if(count==0 && NR-start>50) print start": "name}' src/**/*.ts
# Python — check cyclomatic complexity
# Install: pip install radon
radon cc src/ -a -nb
# Show maintainability index
radon mi src/ -nb
```
## Leaving Review Comments
```bash
# Approve
gh pr review <PR_NUMBER> --approve --body "Looks good. Clean implementation."
# Request changes
gh pr review <PR_NUMBER> --request-changes --body "See inline comments — security concern in auth middleware."
# Comment without approve/reject
gh pr review <PR_NUMBER> --comment --body "A few suggestions, nothing blocking."
# Add inline comment on specific line
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments \
-f body="This should use parameterized queries to prevent SQL injection." \
-f path="src/db.ts" \
-F line=42 \
-f commit_id="$(gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid)"
```
## Notes
- Review the *intent* first (PR description), then the *implementation* (diff).
- Prioritize: security issues > correctness bugs > performance > style.
- Be specific in feedback — "this is wrong" is unhelpful; "this allows SQL injection because..." is actionable.
- Check the test coverage — untested code is unreviewed code.
- Look at what's *not* in the diff — was something important missed?
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.