Code Review Skill for Claude Code
A comprehensive code review skill combining automated tooling with LLM analysis for thorough, actionable feedback.
Loading actions...
Skill content
Main instructions and any bundled files for this skill.
Code Review Skill for Claude Code
A comprehensive code review skill combining automated tooling with LLM analysis for thorough, actionable feedback.
Features
- Multi-phase review: automated tools, test quality, micro/macrostructure, general quality
- Language support: PHP, TypeScript/JavaScript, and Python projects
- Docker execution: Run tools in isolated containers for consistency
- Project setup: Generate coding standards and tool configs automatically
- GitLab CI integration: Automated reviews on merge requests with inline comments
- Configurable: Custom thresholds, focus areas, and exclusions
Installation
Copy the skill/ folder contents to your Claude Code skills directory:
mkdir -p ~/.claude/skills/code-review
cp -r skill/* ~/.claude/skills/code-review/
Or clone and link:
git clone https://gitlab.com/hfietz/claude-code-review.git
ln -s "$(pwd)/claude-code-review/skill" ~/.claude/skills/code-review
Usage
Code Review
/code-review [options]
Options:
--scope=full|diff|files What to review (default: auto-detect)
--base=<branch> Base branch for diff (default: main/master)
--output=human|json Output format (default: human)
--focus=all|style|tests|arch|quality What to emphasize
--files=<glob> Specific files to review
--skip-tools Skip automated tools, LLM-only analysis
--docker / --no-docker Force Docker execution mode
Project Setup
Prepare a project with coding standards and tool configurations:
/code-review --setup [options]
Options:
--language=php|python|typescript|auto Target language
--strict Use stricter thresholds
--dry-run Preview changes
This generates:
- Coding conventions section in
CLAUDE.md - Tool configs (
phpstan.neon,eslint.config.js,ruff.toml) - Project-specific
.code-review.yaml
GitLab CI Setup
Set up automated code review in GitLab pipelines:
/code-review --setup-gitlab
This generates:
.gitlab-ci.ymlwith lint, test, and review stages- Scripts for Claude API integration
- Instructions for CI variables
Docker Images
Pre-built containers with all review tools:
# Pull images
docker pull registry.gitlab.com/hfietz/claude-code-review/review-php:latest
docker pull registry.gitlab.com/hfietz/claude-code-review/review-python:latest
docker pull registry.gitlab.com/hfietz/claude-code-review/review-typescript:latest
| Image | Tools |
|---|---|
review-php | PHPStan, PHPCS, PHPMD, PHPUnit, Deptrac |
review-python | Ruff, mypy, Pyright, pytest, Bandit, Radon |
review-typescript | ESLint, TypeScript, Vitest, madge, dependency-cruiser |
GitLab CI Integration
The skill can set up automated code review in your GitLab pipelines:
- Run
/code-review --setup-gitlabin your project - Set CI variables in GitLab:
ANTHROPIC_API_KEY- Claude API key (protected, masked)GITLAB_TOKEN- Token withapiscope for posting comments
- Push to trigger pipeline
On merge requests, Claude will:
- Review the diff for bugs, security issues, and code quality
- Post inline comments on specific lines
- Add a summary comment with findings
Configuration
Create .code-review.yaml in your project root:
version: 1
thresholds:
function_length: 40
class_length: 300
complexity: 10
coverage:
target: 80
focus:
security: high
performance: medium
style: medium
exclude:
paths:
- vendor/
- node_modules/
- "*.generated.*"
docker:
enabled: auto # auto, always, never
License
MIT
Related Skills
Frontend Typescript Linting.mdc
TypeScript and ESLint rules that MUST be followed when creating, modifying, or reviewing any file under apps/frontend/, including .ts, .tsx, .js, and .jsx files. Also apply when discussing frontend li...
2. Apply Deepthink Protocol (reason about dependencies
risks