Performs systematic code review with universal best practices and repo-specific standards. Auto-activates after significant code changes. Use when reviewing code, auditing files, checking PRs, examining staged changes, or when asked to "review", "check", "audit", or "examine" code. Enforces design principles (SOLID, DRY, KISS), security (OWASP), performance, concurrency safety, cross-platform compatibility, and codebase patterns.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
references/checklist.mdreferences/clean-code/code-smells.mdreferences/clean-code/naming-functions.mdreferences/clean-code/refactoring-patterns.mdreferences/tier-2/ai-ml-checks.mdreferences/tier-2/backend-checks.mdreferences/tier-2/config-checks.mdreferences/tier-2/database-checks.mdreferences/tier-2/frontend-checks.mdreferences/tier-2/infrastructure-checks.mdreferences/tier-2/mobile-checks.mdreferences/tier-3/api-patterns.mdreferences/tier-3/concurrency-patterns.mdreferences/tier-3/privacy-patterns.mdreferences/tier-3/security-patterns.mdreferences/tier-4/anti-duplication-rules.mdreferences/tier-4/claude-md-core.mdreferences/tier-4/documentation-rules.mdreferences/tier-4/memory-rules.mdreferences/tier-4/path-rules.mdSystematic code review skill based on industry best practices from Google Engineering, OWASP, and modern development standards. Designed to catch issues that casual review misses through structured, checklist-driven analysis.
Core Principle (Google): Approve code that improves overall code health, even if not perfect. Seek continuous improvement, not perfection. But NEVER approve code that degrades code health.
Auto-activation triggers:
Explicit activation triggers:
Code Review Progress:
- [ ] Step 1: Identify scope (files to review)
- [ ] Step 2: Load context (repo standards if available)
- [ ] Step 3: Run Universal Checks (Layer 1)
- [ ] Step 4: Run Repo-Specific Checks (Layer 2, if CLAUDE.md exists)
- [ ] Step 5: Report ALL findings with severity
- [ ] Step 6: Propose specific fixes with rationale
git diff --staged or git statusCheck for repo-specific standards. If found, load for Layer 2 checks.
This skill uses tiered progressive disclosure to optimize token usage. Only load what's relevant to the files being reviewed.
Tier 1 (Always Applied): Universal checks in this file (~4,000 tokens)
Tier 2 (File-Type Triggered): Load based on file extensions
| Files | Load Reference |
|---|---|
| .tsx, .jsx, .vue, .svelte | references/tier-2/frontend-checks.md |
| .py, .java, .cs, .go, .rb | references/tier-2/backend-checks.md |
| .swift, .kt, .dart | references/tier-2/mobile-checks.md |
| .sql, migrations/* | references/tier-2/database-checks.md |
| .yaml, .json, .env, .toml | references/tier-2/config-checks.md |
| Dockerfile, .tf, k8s/ | references/tier-2/infrastructure-checks.md |
| .ipynb, model/, ml/ | references/tier-2/ai-ml-checks.md |
Tier 3 (Content-Pattern Triggered): Load when code contains specific patterns
| Pattern Keywords | Load Reference |
|---|---|
| auth, crypto, password, secret, token, jwt | references/tier-3/security-patterns.md |
| async, await, thread, lock, mutex, concurrent | references/tier-3/concurrency-patterns.md |
| route, endpoint, @app, @Get, @Post, api/ | references/tier-3/api-patterns.md |
| PII, email, user, customer, gdpr, consent | references/tier-3/privacy-patterns.md |
Clean Code Deep-Dives: Load for detailed guidance
Tier 4 (Repository-Specific): Load when CLAUDE.md exists in repo root
| Context | Load Reference |
|---|---|
| CLAUDE.md exists (always) | references/tier-4/claude-md-core.md |
| *.md files | references/tier-4/documentation-rules.md |
| Duplication indicators | references/tier-4/anti-duplication-rules.md |
| Path patterns detected | references/tier-4/path-rules.md |
| *-{platform}.md files | references/tier-4/platform-rules.md |
| .claude/skills/** | references/tier-4/skill-rules.md |
| .claude/memory/** | references/tier-4/memory-rules.md |
| .claude/temp/** | references/tier-4/temp-file-rules.md |
Token Budget Estimates:
| Scenario | Tokens |
|---|---|
| Simple Python file | ~6,500 (Hub + backend) |
| React component | ~6,000 (Hub + frontend) |
| Auth service | ~8,000 (Hub + backend + security) |
| Full-stack PR | ~9,500 (Hub + frontend + backend + API) |
| Documentation file (CLAUDE.md repo) | ~6,500 (Hub + core-rules + documentation-rules) |
| Skill modification | ~6,000 (Hub + core-rules + skill-rules) |
| Memory file update | ~5,500 (Hub + core-rules + memory-rules) |
These checks apply to ANY codebase, ANY language.
SOLID Principles:
/mnt/c/Users/... (WSL)/c/Users/... (Git Bash)C:\Users\... (Windows)/home/username/... (Linux)/Users/username/... (macOS)command -v tool not path huntingPath(__file__).resolve(), $PSScriptRoot, ${BASH_SOURCE[0]}diff similar files to verifyalt="""Hello " + namecount + " items"accountList should actually be a list; avoid false cluesdata1, data2, dataInfo, theData// TODO: JIRA-123 - refactor after API v2// Constructor above a constructor is noise} // end if means function is too long// Added by Bob - use version control blameif (isValid) not if (!isInvalid)if (!notFound) should be if (found)if (shouldBeDeleted(timer)) not if (timer.hasExpired() && !timer.isRecurrent())if (buffer.shouldCompact()) not if (!buffer.shouldNotCompact())| Smell | Detection | Impact | Fix |
|---|---|---|---|
| Long Method | > 30 lines | Maintainability | Extract methods |
| Long Parameter List | > 4 parameters | Usability | Introduce parameter object |
| Deep Nesting | > 3-4 indent levels | Readability | Guard clauses, extract method |
| Magic Numbers | Hardcoded values | Maintainability | Named constants |
| God Class | Class does too much | Testability, coupling | Extract classes by responsibility |
| Feature Envy | Method uses other class's data | Coupling | Move method to data class |
| Duplicate Code | Same logic repeated | DRY violation | Extract to shared function |
| Dead Code | Unused code | Clutter, confusion | Delete it |
| Primitive Obsession | Overuse of primitives | Type safety | Value objects |
| Shotgun Surgery | One change touches many files | Fragility | Consolidate related code |
| Divergent Change | One class changed for many reasons | SRP violation | Split by reason for change |
| Data Clumps | Same data appears together | Missing abstraction | Create class for data group |
| Comments | Explaining bad code | Readability | Rewrite the code |
| Speculative Generality | Code for "future needs" | Complexity | Delete unused abstractions |
Only if CLAUDE.md or repo standards exist.
git-setup.md not 01-git-setup.md# HeaderOnly for repositories with CLAUDE.md in root. Load Tier 4 references based on file types being reviewed.
CLAUDE.md in repo root.claude/memory/ directory<repo-root>, <skill-name>)git-setup-windows.md -> # Git Setup Windowsgit-setup.md not 01-git-setup.mdLoad tier-4/documentation-rules.md for:
Load tier-4/platform-rules.md for:
-windows, -macos, -linux, -wslLoad tier-4/anti-duplication-rules.md when duplication indicators detected:
Load tier-4/path-rules.md when path patterns detected:
<repo-root>, <skill-name> over explicit pathsPath(__file__).resolve(), $PSScriptRootLoad tier-4/skill-rules.md for:
Load tier-4/memory-rules.md for:
@.claude/memory/file.mdLoad tier-4/temp-file-rules.md for:
.claude/temp/ allowedYYYY-MM-DD_HHmmss-{agent-type}-{topic}.md## Code Review Findings
### Critical Issues (Must Fix)
1. **[Issue Title]**
- **Location**: file:line
- **Problem**: What's wrong and why it matters
- **Fix**: Specific code change
- **Confidence**: High/Medium
### Warnings (Should Fix)
1. **[Issue Title]**
- **Location**: file:line
- **Problem**: What's wrong
- **Fix**: Specific change
### Suggestions (Nit)
1. [Suggestion with rationale]
Glob pattern="path/**/*.md" to verify rather than assuming based on what you haven't readALWAYS CHECK:
[ ] Security: inputs validated, outputs encoded, no secrets
[ ] Concurrency: shared state protected, no race conditions
[ ] Design: SOLID principles, appropriate complexity
[ ] Tests: present, correct, useful
[ ] Platform: no hardcoded paths, portable detection
[ ] Duplicates: diff similar files
[ ] Accessibility: alt text, contrast, keyboard nav, semantic HTML
[ ] i18n: no hardcoded strings, locale-aware formatting
[ ] Observability: structured logs, metrics, traces, health checks
[ ] Privacy: PII protected, no PII in logs, consent tracked
CLEAN CODE (Robert C. Martin):
[ ] Names: intention-revealing, pronounceable, searchable, no encodings
[ ] Functions: small (5-20 lines), do one thing, few args (0-2), no side effects
[ ] Comments: explain WHY not WHAT, no commented-out code, no redundancy
[ ] Conditionals: positive conditions, guard clauses, no double negatives
DOMAIN-SPECIFIC (when applicable):
[ ] API: versioning, backward compat, error format
[ ] Database: N+1 avoided, indexes, migrations safe
[ ] Config: secrets in vault, feature flags, 12-factor
[ ] Frontend: component design, bundle size, web vitals
[ ] Mobile: battery/memory/network efficient, offline-first
[ ] AI/ML: model versioning, reproducibility, bias detection
CODE SMELLS (watch for):
- Long methods (> 30 lines)
- Long parameter lists (> 4 params)
- Deep nesting (> 3-4 levels)
- God classes (too many responsibilities)
- Feature envy (method uses other class's data)
- Primitive obsession (should use value objects)
- Shotgun surgery (one change touches many files)
RED FLAGS:
- Long if/else chains (OCP violation)
- Explicit type casting (LSP violation)
- new keyword overuse (DIP violation)
- String concatenation in queries (injection)
- Shared state without locks (race condition)
- Catch-all exception handlers (error hiding)
- Magic numbers/strings (maintainability)
- Platform-specific paths (portability)
- Missing alt text on images (accessibility)
- Hardcoded user-facing strings (i18n)
- console.log instead of structured logging (observability)
- PII in log statements (privacy violation)
Date: 2025-11-28 Model: claude-opus-4-5-20251101