Appearance
Getting Started
By the end of this page you'll have Caliper enforcing your conventions after every Claude Code turn — in about 30 seconds.
Install
bash
npm install --save-dev @caliperai/caliperUsing pnpm
bash
pnpm add -D @caliperai/caliperInstall globally instead
bash
npm install -g @caliperai/caliper
# then use caliper instead of npx caliperYou'll need Node.js 20+. That's the only prerequisite for convention enforcement.
Step 1: Initialize
bash
npx caliper initRequires ANTHROPIC_API_KEY to be set. This single command does everything automatically — zero prompts:
- Auto-detects your framework (TypeScript, Python, Go, Ruby, Rust, Java) and creates
.caliper/with your project configuration and review policy - Compiles your CLAUDE.md conventions into deterministic checks
- Installs all three hooks — Claude Code stop hook, git pre-commit hook (
npx caliper gate), and git pre-push hook (npx caliper review --pre-push) - Adds a
preparescript topackage.jsonso teammates get hooks automatically onpnpm install - Generates a GitHub Actions workflow (if a GitHub remote is detected) for automated PR review
- Runs your first convention checks — shows what Caliper found right away
bash
export ANTHROPIC_API_KEY="sk-ant-..."Add the key to your shell profile (.zshrc, .bashrc) so it persists across sessions.
For interactive setup with full control over preferences, model selection, and project standards:
bash
npx caliper init --interactiveWhat happens under the hood: Caliper reads your CLAUDE.md and turns prose rules into checks:
| Your CLAUDE.md says | Compiled check |
|---|---|
| "No classes — use functions and plain objects" | grep — flags class declarations |
| "Keep functions under ~30 lines" | AST — measures each function's length |
| "Never use execSync with template strings" | grep — flags execSync( calls |
| "Every migration needs a test file" | file-exists — ensures .test.ts companion |
| "Catch blocks must not swallow errors silently" | ai-check — AI evaluates each catch match |
Rules that need judgment but have a locatable code anchor become ai-check checks — a regex finds the candidate code, then a focused AI question evaluates each match. Rules with no code anchor at all ("use meaningful error messages") become conventions for the AI review layers. Nothing is dropped.
That's it. From now on, every time Claude Code finishes a turn, Caliper runs your compiled checks. Violations exit with code 2, which tells Claude to fix them before continuing. Sub-second, no AI calls, zero false positives.
What's next
Convention enforcement catches mechanical violations with no AI calls. AI review catches the bugs that matter most — missing awaits, race conditions, security holes, and code that's drifted from your repo's established patterns.
Local AI review
Review staged changes before you commit. Catches logic errors, security issues, design problems, and code out of compliance with your repo's patterns — things deterministic checks can't catch.
bash
npx caliper reviewRequires ANTHROPIC_API_KEY.
Auto-apply fixes:
bash
npx caliper review --fixBlock bad commits with a git hook:
bash
npx caliper gatePR review
Full multi-phase pipeline that posts findings as inline GitHub comments. Runs specialized lenses for security, data integrity, API contracts, concurrency, and design.
bash
npx caliper 42 # interactive — review each finding before posting
npx caliper 42 --ci # CI mode — auto-approve and postRequires ANTHROPIC_API_KEY + GitHub CLI (gh).
Installing and authenticating GitHub CLI
bash
# macOS
brew install gh
# Then authenticate
gh auth loginSee cli.github.com for other platforms.
Review history
As you use npx caliper review and PR reviews, your approval/skip decisions are recorded. Analyze patterns over time:
bash
npx caliper statsShows approval rates by category, false positive patterns, and emerging conventions. See feedback configuration.
Customizing your setup
npx caliper init uses auto-detected defaults. For full control over every setting:
bash
npx caliper init --interactiveThis walks you through framework presets, source directories, toolchain commands (format, lint, test), AI model selection, review preferences (tone, strictness, nit policy), and project standards (testing, error handling, complexity thresholds).
All configuration lives in .caliper/config.yaml. See the configuration reference for every option.
Re-generating checks
Whenever your CLAUDE.md conventions change, re-run:
bash
npx caliper refreshCaliper also checks for staleness automatically at the start of each PR review and re-generates if needed.
Badge
Add a badge to your README to show your repo uses Caliper for convention enforcement.
md
[](https://getcaliper.dev)