Agent skill
code-review
Systematic code review covering security, performance, architecture, and style
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/coding-andreibesleaga-gabbe-13
SKILL.md
Code Review Skill
Goal
Produce a structured, actionable code review covering: security vulnerabilities, performance issues, architectural violations, and code style — in that priority order.
Steps
-
Gather diff
- Run
git diff main...HEAD(or the target branch) to see all changes - Note the files changed and their layers (domain, application, infrastructure, etc.)
- Run
-
Security review (highest priority)
- Scan for: SQL injection, XSS, CSRF, path traversal, command injection
- Check: secrets or API keys hardcoded in code
- Check: authentication/authorization logic bypasses
- Check: input validation at system boundaries (HTTP, file upload, CLI)
- Check:
npm audit/composer auditoutput for new vulnerable deps - Flag severity: CRITICAL | HIGH | MEDIUM | LOW
-
Architecture review
- Verify layer imports: does any inner layer import from an outer layer?
- Check for circular dependencies (run
madge --circular srcordeptrac) - Check: are new classes/functions in the correct layer?
- Check: does any new code violate AGENTS.md architecture rules?
-
Performance review
- Identify N+1 query patterns in any database access code
- Check: are expensive operations cached where appropriate?
- Check: are there unnecessary synchronous operations that could be async?
- Check: unbounded loops over large datasets without pagination
-
Code quality review
- Check: Cyclomatic complexity (functions > 10 → flag for refactor)
- Check: function/class length (functions > 30 lines, files > 300 lines → flag)
- Check: code duplication (same logic > 3 occurrences → suggest abstraction)
- Check: naming (variables, functions, classes follow project conventions)
- Check: dead code (unused variables, unreachable branches, unused exports)
-
Test coverage review
- Check: are new public functions covered by tests?
- Check: are new edge cases covered (null inputs, error paths, boundaries)?
- Check: no test bypasses (
.skip,.onlyleft in production branch)
-
Produce structured report
markdown## Code Review Report ### Security Findings - [CRITICAL/HIGH/MEDIUM/LOW] file.ts:42 — Description + fix recommendation ### Architecture Violations - file.ts:15 imports from infrastructure layer — violates Clean Architecture ### Performance Concerns - N+1 query pattern in UserService.getAll() — add eager loading ### Code Quality - getUserData() has complexity 14 — extract validation into separate function ### Tests - Missing test for null email edge case in UserValidator ### Approved Changes - [list of changes that look good] ### Summary MERGE: [YES/NO/WITH_CHANGES] Blocking issues: [count]
Constraints
- Security findings are always blocking (must be fixed before merge)
- Architecture violations are always blocking
- Performance and quality findings may be non-blocking based on severity
- Never approve a PR with hardcoded secrets or critical CVEs
Output Format
Structured markdown report with severity-tagged findings and specific file:line references.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?