review
Run comprehensive code review before commits, PRs, or releases. Uses code-reviewer agent with tiered security, performance, and quality checks.
What this skill does
# Code Review Command
Run comprehensive code review on specified files or staged changes.
## Instructions
### Pre-Flight: Research Phase + File Count (MANDATORY)
**CRITICAL: The code-reviewer agent runs a MANDATORY Research Phase (Step 0) before analysis:**
1. **Technology Detection** - Agent scans file extensions, imports, and package manifests
2. **MCP Research** - Agent queries MCP servers for current best practices
3. **Build Truth Context** - Agent builds validated context before reviewing code
This research phase ensures ALL findings are validated against current documentation, not stale training data.
**Before invoking agents, count files to ensure accurate reporting and determine review mode:**
```bash
# For staged changes
FILE_COUNT=$(git diff --staged --name-only | wc -l)
# For PR changes
FILE_COUNT=$(git diff --name-only main...HEAD | wc -l)
# For specific paths - use Glob and count results
```
**Report this count and apply thresholds:**
- **1-49 files**: Standard single-agent review (unless `--consensus` specified)
- **50+ files**: Auto-enable consensus mode (unless `--no-consensus` specified)
- **100+ files**: Warn user and suggest breaking into smaller chunks
**Use the code-reviewer agent to perform systematic code quality analysis.**
The code-reviewer agent provides:
- **Tiered progressive disclosure** for token optimization
- **Security analysis** (OWASP top 10, secrets detection)
- **Performance review** (N+1 queries, resource leaks)
- **Code quality** (SOLID, DRY, clean code principles)
- **CLAUDE.md compliance** for Claude Code ecosystem files
- **Severity levels** (CRITICAL/MAJOR/MINOR)
- **MCP validation** for current best practices and version accuracy (perplexity, context7, microsoft-learn)
**Invoke the agent based on the arguments provided:**
```text
$ARGUMENTS
Based on the arguments, determine the review scope:
If 'staged' or no arguments:
- Review currently staged files (git diff --staged)
- Good for pre-commit review
If 'pr' or 'pull-request':
- Review all changes in the current PR/branch vs main
- Good for PR review
If specific file paths provided:
- Review those specific files
- Can be globs like "src/**/*.ts"
If '--parallel':
- Run multiple code-reviewer agents in parallel (one per file/module)
- Good for large changesets
- ⚠️ CAUTION: Limit to 2-3 Opus agents at a time to prevent context exhaustion
If '--sequential':
- Run single code-reviewer agent reviewing all files
- Good for smaller changesets or when context between files matters
If '--batched':
- Run agents in batches of 2-3, waiting for completion between batches
- Good for very large changesets (50+ files) or multi-type audits
- Prevents context exhaustion on large workloads
If '--consensus':
- Force multi-agent consensus mode (even for small changesets)
- Launches 3 specialized agents: code-reviewer, security-reviewer, quality-reviewer
- Consolidates findings based on agreement level
- Good for critical code paths requiring extra validation
If '--no-consensus':
- Disable auto-consensus mode (even for 50+ files)
- Forces single code-reviewer agent
- Good when you want faster review over higher accuracy
If '--show-rules':
- Display active rules without running review
- Shows: config source, tech stack, excluded rules, severity overrides, custom checks
- Good for verifying configuration before review
If '--ignore-repo-config':
- Skip .claude/code-review.md and CLAUDE.md configuration
- Use default rules only (Tier 1 universal checks)
- Good for comparing with/without repo-specific rules
If '--baseline <branch>' (e.g., '--baseline main', '--baseline develop'):
- Compare changes against specified branch to identify NEW vs PRE-EXISTING issues
- Run `git diff <baseline>...HEAD` to get changed line ranges
- Tag each finding as "new" (line added/modified in this changeset) or "pre-existing"
- Output separates new issues (prominent) from pre-existing debt (collapsed)
- Default baseline: 'main' when 'pr' scope is used, none for 'staged'
- GAME CHANGER for adoption: Teams only see issues THEY introduced, not inherited debt
- Quality gates (--fail-on-new-critical) apply only to NEW issues
If '--profile <name>':
- Run focused review using predefined check subsets
- Profiles:
- security: OWASP, secrets, auth checks only (fast security scan)
- quick: Style, obvious issues only (pre-commit fast check)
- thorough: All checks (default - full review)
- performance: N+1, complexity, memory, concurrency checks
- strict: thorough + pattern compliance, module boundaries, dependency migration
- Good for focused reviews or faster pre-commit checks
- See SKILL.md profiles section for tier mappings
If '--profile strict':
- Runs all 'thorough' checks PLUS additional strictness:
- Pattern compliance: architectural patterns, DI patterns, naming conventions
- Import hygiene: module boundary violations, barrel file pollution
- Test correlation: orphaned tests detection
- Dependency safety: migration verification for major version bumps
- Higher token cost (~17,000 tokens) but catches more subtle issues
- Good for critical codebases, library releases, or comprehensive audits
If '--history':
- Force git history analysis even for profiles that skip it (e.g., quick)
- Analyzes:
- Coupling: Files that typically change together
- Hot spots: High-churn files that need extra scrutiny
- Author context: Ownership patterns and bus factor
- Recent patterns: Bug fix history indicating fragile areas
- Good for investigating unfamiliar code areas or deep reviews
- Adds ~1,500 tokens for history context analysis
If '--no-history':
- Skip git history analysis even for profiles that include it (thorough, strict)
- Saves time when history context isn't needed
- Good for quick reviews of isolated, well-understood changes
- Saves ~1,500 tokens
Default: staged changes, sequential mode, auto-consensus for 50+ files, history per profile
```
### Repository Configuration
The review command automatically loads repository-specific rules from:
1. **`.claude/code-review.md`** (primary) - Dedicated config file in .claude folder
2. **CLAUDE.md + @imports** (fallback) - Extracts rules from existing project instructions
**Configuration Priority Chain:**
```text
1. .claude/code-review.md exists?
└── Yes: Parse config, apply rules
└── No: Continue to fallback
2. CLAUDE.md exists?
└── Yes: Read + follow @imports, extract rules
└── No: Continue to defaults
3. No config found (interactive mode):
└── AskUserQuestion: "No review configuration found. Review with default rules?"
└── User can confirm or provide guidance
```
**What Gets Configured:**
| Section | Effect |
| --- | --- |
| `## Tech Stack` | Override auto-detected tech, improve MCP query accuracy |
| `## Exclude Rules` | Skip specific rules (e.g., `sql-injection` for non-DB projects) |
| `## Severity Overrides` | Change default severity (CRITICAL→MAJOR, MAJOR→MINOR) |
| `## Custom Checks` | Add project-specific validation (file patterns, content rules) |
See [repo-config.md](../skills/code-reviewing/references/tier-4/repo-config.md) for full schema documentation.
## Claude Code Component Validation (MANDATORY)
**CRITICAL: When Claude Code files are detected in the review scope, specialized validation via auditor agents is MANDATORY. This is NOT optional - if validation cannot run, the review FAILS.**
Claude Code components (skills, agents, commands, hooks, memory files, plugins, etc.) require validation against official documentation via the `docs-management` skill. The code-reviewer agent performs only basic syntax checks - comprehensive validation requires specialized auditor agents.
### Why Auditors Are Required
The code-reviewer agent:
- Lacks `Task` tool access (cannot spawn subagents)
- Can only perform basic syntax validation (YAML/JSON structure)
- Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.