skills/code-review/SKILL.md
Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.
npx skillsauth add ashaykubal/essential-agents-skills code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive code review with four independently-referenceable sections. Runs static tools first (fail fast), then applies LLM judgment for patterns tools cannot catch.
Load this skill when the user request matches ANY of these patterns:
| Trigger Pattern | Example User Request | |-----------------|---------------------| | Code review | "Review this code", "Check my changes", "Code review for PR" | | Security review | "Check for security issues", "Find vulnerabilities", "OWASP audit" | | Type safety check | "Find any usage", "Check type safety", "Null handling issues?" | | Quality check | "Is this code clean?", "Check code quality", "Standards compliance" |
DO NOT use for:
npx jest (or your project test runner))test-audit skill)issue-debugging skill)This skill references supporting files. Understanding what's required vs optional ensures consistent execution.
| Category | Files | Requirement | When to Load |
|----------|-------|-------------|--------------|
| Pattern references | references/{section}-patterns.md | REQUIRED | Always load for each enabled section |
| Framework patterns | frameworks/{detected}.md | CONDITIONALLY REQUIRED | If framework detected → MUST load; if not detected → skip |
| Examples | examples/anti-patterns/*.ts, examples/recommended/*.ts | OPTIONAL | For calibration on ambiguous cases; kept for model portability |
Fallback behavior:
frameworks/{name}.md is REQUIREDgeneric.md)/code-review [path] [flags]
Arguments:
path - File or directory to review (default: files in recent context)Flags:
--quick - Tiered review by change size (Security-only for <50 lines)--framework=<name> - Override auto-detected framework (react|express|django|generic)--include-git-context - Include git history for complexity findings--section=<name> - Run single section only (security|type-safety|linting|standards)Examples:
/code-review src/auth/ - Full review of auth directory/code-review src/api.ts --quick - Quick review (tiered by lines)/code-review src/ --section=security - Security section onlyCRITICAL: All three phases are REQUIRED. Do not skip any phase.
Phase 1: Static Analysis (Deterministic)
├── Run: npx tsc --noEmit → capture output
├── Run: your project lint command → capture output
└── If failures: STOP, return to user (fail fast)
Phase 2: LLM Review (Judgment-Based)
├── Load references/{section}-patterns.md for each enabled section (REQUIRED)
├── If framework detected: Load frameworks/{detected}.md (REQUIRED)
├── If no framework detected: Skip framework patterns
├── Apply each enabled section using loaded patterns
└── Output findings to user
Phase 3: Write Diagnostic Log (REQUIRED)
├── Write to: logs/diagnostics/code-review-{timestamp}.yaml
├── Include: invocation details, static analysis results, findings summary
└── This phase is MANDATORY - do not return to user without completing it
Why Phase 1 First:
Why Phase 3 is Required:
Each section is independently referenceable by pipeline agents via --section=<name>.
| Section | Boundary | Key Patterns | Severity Range |
|---------|----------|--------------|----------------|
| Security | Threats & exploits | OWASP Top 10, injection, auth | Critical-Important |
| Type Safety | Type system holes | any, null, unsafe assertions | Critical-Important |
| Linting | Style requiring judgment | Complexity, naming, structure | Important-Suggestion |
| Coding Standards | Conventions & architecture | Patterns, documentation | Important-Suggestion |
Identify security vulnerabilities that static analysis cannot catch.
Threats and exploits: authentication/authorization logic, injection patterns, secrets exposure, CSRF, CORS misconfigurations.
Does NOT cover: Type errors (→ Type Safety), code style (→ Linting).
npx tsc --noEmit (or your project typecheck command) passedLoad references/security-patterns.md for:
frameworks/{detected}.md if framework detected)Reference when encountering ambiguous cases:
examples/anti-patterns/security.tsexamples/recommended/security.tsIdentify type system holes that bypass compile-time safety.
Type system integrity: explicit any, implicit any from missing types, unsafe type assertions, null/undefined handling gaps.
Does NOT cover: Runtime errors from logic bugs (→ tests), security issues (→ Security).
npx tsc --noEmit (or your project typecheck command) passed (confirms type-correct, looking for holes)Load references/type-safety-patterns.md for:
any usage patterns (explicit, implicit, from libraries)Reference when encountering ambiguous cases:
examples/anti-patterns/type-safety.tsexamples/recommended/type-safety.tsany in test fixtures for flexibilityany in JSON parsing with immediate validationanyas const assertionsIdentify code quality issues requiring human judgment beyond what automated linters catch.
Style and structure requiring judgment: cyclomatic complexity, semantic naming, deep nesting, code duplication, unclear control flow.
Does NOT cover: Formatting (automated), syntax (compiler), security (→ Security).
Load references/linting-patterns.md for:
Reference when encountering ambiguous cases:
examples/anti-patterns/linting.tsexamples/recommended/linting.tsi, j, k)When --include-git-context is enabled, include for complexity findings:
git_context:
last_modified: "2025-08-15 by @alice"
commit_message: "Workaround for #1234"
note: "Complexity may be intentional - verify before refactoring"
Verify adherence to project conventions and architectural patterns.
Conventions and architecture: atomic principles (single responsibility, explicit I/O), documentation quality, pattern adherence, consistency with codebase.
Does NOT cover: Style formatting (→ linters), security patterns (→ Security).
Load references/standards-patterns.md for:
Reference when encountering ambiguous cases:
examples/anti-patterns/standards.tsexamples/recommended/standards.tsAuto-detect framework from project files. If detected, loading framework patterns is REQUIRED.
package.json dependencies → Framework
─────────────────────────────────────
react, next, gatsby → react
express, fastify, koa → express
@angular/core → angular
vue, nuxt → vue
requirements.txt / pyproject.toml:
django → django
flask → flask
fastapi → fastapi
(none of above) → (no framework)
Use --framework=<name> to override detection.
If no framework is detected:
generic.md - skip framework patterns entirelyreferences/*.md files (which are REQUIRED)When --quick flag is specified, sections are tiered by lines changed:
| Lines Changed | Sections Run | |---------------|--------------| | <50 lines | Security only | | 50-500 lines | Security + Type Safety | | >500 lines | All sections |
Default (no flag): All sections (comprehensive review).
| Tier | Label | Criteria | Action | |------|-------|----------|--------| | CRITICAL | Must fix before merge | Security vulnerabilities, type safety holes causing runtime errors | Block merge | | IMPORTANT | Should fix | Anti-patterns, missing tests, significant quality issues | Address before or after merge | | SUGGESTION | Optional | Style improvements, naming clarity, minor refactoring | Consider for future |
| Level | Label | Criteria | |-------|-------|----------| | Verified | Data flow traced, exploit path confirmed | "User input from req.query.id flows to db.query at line 45 without sanitization" | | Suspected | Pattern matches but context unclear | "String concatenation in SQL-like context - verify if this is actually a query" |
Output templates follow the subagent-output-templating skill (P0.2) structure with skill-specific extensions for code review findings.
Use template from templates/output-direct.yaml:
Use template from templates/output-pipeline.yaml:
bulwark-code-auditor
├── context: fork (isolated review)
├── skills: code-review
└── Runs all 4 sections, never fixes
SecurityReviewer (--section=security)
|> TypeSafetyReviewer (--section=type-safety)
|> LintReviewer (--section=linting)
|> StandardsReviewer (--section=standards)
|> ReviewSynthesizer (consolidate)
MANDATORY: You MUST write diagnostic output after every review. This is Phase 3 of the workflow and cannot be skipped.
Standard: Follows subagent-output-templating (P0.2) diagnostic format.
Write diagnostic output to:
logs/diagnostics/code-review-{timestamp}.yaml
Format:
diagnostic:
skill: code-review
timestamp: 2026-01-31T12:00:00Z
invocation:
mode: comprehensive | quick
sections_run: [security, type_safety, linting, standards]
framework_detected: react
framework_override: null
files_count: 5
lines_total: 450
static_analysis:
typecheck: passed | failed | skipped
lint: passed | failed | skipped
findings_summary:
critical: 1
important: 3
suggestion: 5
duration_ms: 1200
IMPORTANT: Before returning to the user, verify ALL items are complete:
npx tsc --noEmit (or your project typecheck command), your project lint command)logs/diagnostics/code-review-{timestamp}.yamlDo NOT return to user until all checkboxes can be marked complete.
testing
Prompt template for test classification stage in Test Audit pipeline
testing
--- name: test-audit description: Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail. user-invocable: true argument-hint: [path] [--threshold=N] skills: - test-classification - mock-detection - assertion-patterns - component-pattern
development
Template for structured sub-agent invocation using 4-part prompting (GOAL/CONSTRAINTS/CONTEXT/OUTPUT) and F# pipeline notation. Use when orchestrating sub-agents or designing multi-agent workflows.
development
Template for structured sub-agent output including YAML log format, task completion reports (WHY/WHAT/TRADE-OFFS/RISKS), and summary constraints. Use when defining how sub-agents should report results.