A streamlined, production-ready configuration for Claude Code based on Boris Cherny's (Claude Code creator) workflow.
- Quick Setup
- What You Get
- Daily Usage Guide
- Commands Reference
- Team Workflow
- Customization
- Troubleshooting
- Node.js v16 or higher
- Claude Code CLI installed (
npm install -g @anthropic-ai/claude-code) - GitHub CLI installed and authenticated (
gh auth login)
Option A: Global Setup (Recommended for individuals)
# Clone this repo
git clone <repo-url> claude-code-setup
cd claude-code-setup
# Run the installer
node scripts/setup.js --globalThis installs commands and settings to ~/.claude/ - available in ALL your projects.
Option B: Project Setup (Recommended for teams)
# From your project directory
cd /path/to/your/project
# Run the installer
node /path/to/claude-code-setup/scripts/setup.js --project
# Commit the configuration
git add .claude/ CLAUDE.md
git commit -m "Add Claude Code team configuration"
git pushThis installs to your project's .claude/ folder - shared with your team via git.
Option C: Both
node scripts/setup.js --both# Start Claude Code
claude
# Check commands are available
/helpYou should see the custom commands: /commit-push-pr, /complete-task, etc.
Spec & Planning:
| Command | What It Does |
|---|---|
/create-spec |
Create specification with user stories and prd.json |
/refine-spec |
Iterate on spec asking questions until complete |
/create-spec-tests |
Generate TDD tests from spec (Vitest + Playwright) |
Development:
| Command | What It Does |
|---|---|
/start-task |
Create new feature branch for a task |
/finish-task |
Verify, commit, PR, and merge current branch |
/tdd-loop |
Full TDD cycle: Red → Green → Refactor → PR |
/complete-task |
All-in-one: verify → test → commit → PR |
Autonomous (Ralph Loop):
| Command | What It Does |
|---|---|
/ralph-loop |
Start autonomous dev loop until all tasks complete |
/cancel-ralph |
Stop the active Ralph loop |
Quality:
| Command | What It Does |
|---|---|
/test-and-verify |
Runs lint, typecheck, tests, and build |
/create-tests |
Generates unit, integration, and UI tests |
/security-check |
Analyzes code for OWASP Top 10 vulnerabilities |
/commit-push-pr |
Quick commit and PR creation |
Documentation (Context Optimization):
| Command | What It Does |
|---|---|
/init-docs |
Create documentation structure (INDEX.md, AGENTS.md, etc.) |
/update-docs |
Update docs after completing a task |
/load-context |
Load minimal context from docs (~50% token savings) |
A hook automatically formats code with Prettier after every edit.
Common safe commands are pre-approved to reduce permission prompts:
- Git operations (status, diff, commit, push, pull, etc.)
- npm/pnpm/yarn commands
- Node, TypeScript, ESLint, Prettier
Dangerous commands are blocked:
git push --forcegit reset --hard--no-verifyflags- Commands containing sensitive keywords
Always start with /create-spec, then specify which task(s) to work on:
/create-spec # Claude asks questions, creates prd.json
/tdd-loop US-1 # Complete specific story
/tdd-loop US-1,US-2,US-3 # Complete multiple stories
/tdd-loop all # Complete ALL stories/create-spec # Claude asks questions, creates prd.json
/start-task US-1 # Complete specific story
/start-task US-2 # Complete next story/create-spec # Claude asks questions, creates prd.json
/ralph-loop # Runs unattended until ALL stories doneAll options automatically handle (per story):
- ✅ Branch creation
- ✅ Test creation (unit, integration, Playwright e2e)
- ✅ Implementation
- ✅ Verification (lint, typecheck, tests, build)
- ✅ Security scanning
- ✅ Documentation updates (INDEX.md, AGENTS.md, progress.txt)
- ✅ Commit & PR
- ✅ Merge to main
| Command | When to Use |
|---|---|
/cancel-ralph |
Stop autonomous loop |
/test-and-verify |
Run checks manually |
/commit-push-pr |
Quick commit without full workflow |
To generate tests for your recent changes:
/create-tests
Before merging sensitive changes:
/security-check
Purpose: Quick commit and PR creation
What it does:
- Reviews staged and unstaged changes
- Stages relevant files (specific files, not
git add .) - Creates commit with descriptive message
- Pushes to remote
- Creates PR with summary and test plan
- Returns PR URL
When to use: After implementing a small change that doesn't need new tests
Purpose: Full task completion workflow
What it does:
- Verifies code compiles (typecheck, build)
- Creates appropriate tests:
- Unit tests for new functions
- Integration tests for APIs
- UI tests for user-facing changes
- Runs full verification suite
- Commits and pushes
- Creates PR
When to use: After completing any feature or fix (recommended default)
Purpose: Run all quality checks
What it does:
- Lint check (
npm run lint) - Type check (
tsc --noEmit) - Unit tests (
npm test) - Integration tests (
npm run test:integration) - Build check (
npm run build)
When to use: Before committing, or to verify current state
Purpose: Generate tests for changed code
What it does:
- Identifies changed files
- Creates unit tests (same directory as source)
- Creates integration tests (
tests/integration/) - Creates UI tests (
tests/e2e/) - Runs new tests to verify they pass
When to use: When you need tests but aren't ready for full commit
Purpose: Security vulnerability analysis
What it does:
- Scans for accidentally committed secrets
- Reviews for OWASP Top 10 vulnerabilities:
- Injection (SQL, command, template)
- Broken authentication
- Sensitive data exposure
- XSS
- Broken access control
- Security misconfiguration
- Runs
npm audit - Provides categorized report (Critical/Warning/Info)
When to use: Before merging any PR, especially auth/data handling code
The .claude/ directory and CLAUDE.md are checked into git. When team members pull:
git pull
# Configuration is automatically available"Anytime we see Claude do something incorrectly we add it to the CLAUDE.md, so Claude knows not to do it next time." - Boris
When Claude makes a mistake:
- Fix the issue
- Add guidance to
CLAUDE.mdto prevent it recurring - Commit the update
Example addition:
## Project-Specific Notes
- Always use `pnpm` instead of `npm` in this project
- Database migrations must be run with `pnpm migrate` before testing
- The `/api/v2/` endpoints require authentication headersInstall the GitHub Action:
/install-github-action
Then tag @.claude in PR comments to have Claude help with reviews.
Boris runs 5+ Claude instances simultaneously. To do this:
# Create separate git checkouts
git clone <repo> project-1
git clone <repo> project-2
git clone <repo> project-3
# Run Claude in each
cd project-1 && claude # Terminal 1
cd project-2 && claude # Terminal 2
cd project-3 && claude # Terminal 3Each instance works on a different task without conflicts.
Edit CLAUDE.md in your project root:
## Project-Specific Notes
- Package manager: pnpm (not npm)
- Test command: `pnpm test:all`
- Requires Docker running for integration tests
- API docs: `/docs/api.md`
- Use `camelCase` for variables, `PascalCase` for componentsCreate .claude/commands/my-command.md:
# My Custom Command
Description of what this command does.
## Pre-computed Context
\`\`\`bash
# Commands to gather context (runs before Claude sees the prompt)
git status
cat package.json | grep version
\`\`\`
## Instructions
1. First step
2. Second step
3. Third stepEdit .claude/settings.json:
{
"permissions": {
"allow": [
"Bash(your-safe-command *)"
],
"deny": [
"Bash(dangerous-command *)"
]
}
}Edit .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": { "tool": "Write", "path": "*.py" },
"hooks": [
{ "type": "command", "command": "black \"$CLAUDE_FILE_PATH\"" }
]
}
]
}
}The documentation system reduces token usage by ~50% while maintaining full codebase understanding.
# Run once per project
/init-docsThis creates:
docs/
├── INDEX.md # Codebase map (READ FIRST)
├── AGENTS.md # Patterns, gotchas, conventions
├── ARCHITECTURE.md # Technical deep-dive
├── USAGE.md # User guide
└── progress.txt # Learnings log (append-only)
Instead of loading all source files (~10-50k tokens), Claude reads:
INDEX.md- File registry, structure, dependencies (~500 tokens)AGENTS.md- Patterns, gotchas, conventions (~500 tokens)
Result: ~50% token reduction while maintaining full context.
Documentation updates are automatic with task completion:
/finish-task # Includes doc updates
/complete-task # Includes doc updates
/update-docs # Manual updateINDEX.md - Codebase map:
| File | Purpose | Exports |
|------|---------|---------|
| `src/auth.ts` | Authentication | `login()`, `logout()` |AGENTS.md - Patterns and gotchas:
### Pattern: Repository
**When**: Data access
**Do**: Use repository pattern
**Example**: `src/repos/userRepo.ts`progress.txt - Append-only learnings:
## 2025-01-29 - Auth Feature
- Completed: JWT authentication
- Gotcha: Token refresh needs retry logicBased on 54% context reduction research:
- Keep CLAUDE.md under 500 lines - Link to docs instead
- Use trigger tables - "When X, load Y" format
- On-demand loading - Load detailed docs only when needed
- Layered memory - Different files for different purposes
# Check global installation
ls ~/.claude/commands/
# Check project installation
ls .claude/commands/
# Restart Claude Code
exit
claudeThe command might not match the allow pattern exactly. Check .claude/settings.json and adjust patterns.
- Verify the tool is installed (e.g.,
npx prettier --version) - Check hook syntax in
settings.json - Hooks run silently - check if file is actually formatted
Ensure your project has a test framework configured:
npm install --save-dev jest @types/jest ts-jest
# or
npm install --save-dev vitest# Verify GitHub CLI is authenticated
gh auth status
# Login if needed
gh auth loginThis setup follows Boris's key principles:
- Plan before implementing - Solid plans lead to one-shot implementations
- Verification loops are critical - Always give Claude a way to verify its work
- One task per Claude instance - Avoid scope creep
- Compound team knowledge - CLAUDE.md improves over time
- Stay vanilla - Simple configurations that work
MIT