← All guides

Claude Code for Teams: Self-Hosting, Shared Config, and Enterprise Setup

How to deploy Claude Code for a development team — shared CLAUDE.md conventions, API key management, model routing for cost control, VS Code + CLI setup.

Claude Code for Teams: Self-Hosting, Shared Config, and Enterprise Setup

There is no "self-hosted" Claude Code in the traditional sense — the model runs on Anthropic's API, not your servers. "Team setup" means: shared CLAUDE.md conventions in the repo, centralized API key management, model routing to control costs, and consistent tooling across developers' machines. This guide covers what it takes to run Claude Code effectively across a team of 2–50 developers.


What "Team Claude Code" Actually Means

Three things to get right:

  1. Shared context — every developer's Claude session knows the project conventions (CLAUDE.md in the repo)
  2. Centralized API access — one billing account, keys distributed securely, usage visible
  3. Consistent tooling — same Claude Code version and settings across machines

What it does NOT mean:


Step 1: Shared CLAUDE.md in the Repository

The most important team setup is CLAUDE.md committed to the repo. Every developer who runs Claude Code in the project directory gets the same context automatically.

# ProjectName — Claude Code Team Config

## Stack
- Node.js 20, TypeScript strict
- Next.js 15 App Router
- Prisma + PostgreSQL (Neon)
- Clerk auth
- Bun as package manager

## Architecture Rules
1. Every DB query must include organizationId filter (multi-tenant)
2. No direct Prisma calls in components — use server actions or API routes
3. All API routes: validate auth first, then DB access
4. Errors: throw AppError from @/lib/errors, never plain Error

## Testing
- Unit tests: vitest
- Integration: tests/integration/ (run with bun run test:integration)
- Pre-commit: bun run typecheck && bun run lint

## Naming
- Files: kebab-case
- Components: PascalCase
- DB columns: snake_case

## What NOT to do
- No any type (use unknown or specific types)
- No console.log in production code (use @/lib/logger)
- No hardcoded strings for user-facing copy (use i18n keys)

## Commands
- dev: bun run dev
- typecheck: bun run typecheck
- test: bun run test
- lint: bun run lint

Commit this file to the repo root:

git add CLAUDE.md
git commit -m "docs: add Claude Code team configuration"

Every team member benefits automatically — no manual setup needed on their machine.


Step 2: API Key Management

Option A: Individual API keys (small teams, < 5 developers)

Each developer gets their own Anthropic API key. Simple, no shared cost visibility.

# Each developer sets their own key
export ANTHROPIC_API_KEY="sk-ant-..."
# Or add to ~/.zshrc / ~/.bashrc

Downside: no centralized billing, no usage visibility per developer.

Option B: Shared key via secrets manager (recommended for 5+ developers)

Use a secrets manager (1Password, AWS Secrets Manager, Doppler) to distribute a shared key:

# With Doppler
doppler setup
export ANTHROPIC_API_KEY=$(doppler secrets get ANTHROPIC_API_KEY --plain)

# With AWS SSM
export ANTHROPIC_API_KEY=$(aws ssm get-parameter --name /team/anthropic-api-key --with-decryption --query Parameter.Value --output text)

Advantage: rotate the key in one place, everyone gets the update.

Option C: Enterprise Anthropic agreement

For teams > 20 developers or regulated industries, Anthropic offers enterprise agreements with:

Contact Anthropic sales: anthropic.com/enterprise


Step 3: Model Routing for Cost Control

Different tasks need different models. Setting defaults prevents developers from accidentally using Opus for trivial tasks.

In each developer's ~/.claude/CLAUDE.md (global config):

# Global Claude Config

## Model Routing
- Default: claude-sonnet-4-5 (best cost/quality for most tasks)
- Complex architecture decisions: claude-opus-4-5 (ask me first)
- Simple tasks (rename, format, explain): claude-haiku-4-5

## Budget Awareness
- Opus = ~15x more expensive than Haiku
- If a task takes < 2 minutes to do manually, consider if LLM is worth it

For automated CI/CD agents, force a specific model:

# In CI scripts
ANTHROPIC_MODEL=claude-haiku-4-5 claude "Run typecheck and summarize errors"

Step 4: Team Onboarding Script

Create an onboarding script for new developers:

#!/bin/bash
# scripts/setup-claude-code.sh

echo "Setting up Claude Code for team development..."

# Check if Claude Code is installed
if ! command -v claude &> /dev/null; then
    echo "Installing Claude Code..."
    npm install -g @anthropic-ai/claude-code
fi

# Check API key
if [ -z "$ANTHROPIC_API_KEY" ]; then
    echo "ERROR: ANTHROPIC_API_KEY not set"
    echo "Get your key from: console.anthropic.com"
    echo "Set it in your ~/.zshrc: export ANTHROPIC_API_KEY='sk-ant-...'"
    exit 1
fi

# Create global CLAUDE.md if it doesn't exist
if [ ! -f ~/.claude/CLAUDE.md ]; then
    mkdir -p ~/.claude
    cat > ~/.claude/CLAUDE.md << 'EOF'
# Global Developer Config

## Response Style
- Code first, explanation after
- Concise — I'll ask if I want more detail
- Don't explain what you changed unless it's non-obvious

## Workflow
- Always run typecheck after code changes
- Commit messages: conventional commits format
EOF
    echo "Created ~/.claude/CLAUDE.md with default preferences"
fi

# Verify CLAUDE.md exists in project
if [ -f "CLAUDE.md" ]; then
    echo "✓ Project CLAUDE.md found"
else
    echo "WARN: No CLAUDE.md in project root — run from project directory"
fi

echo ""
echo "Claude Code setup complete. Test with: claude 'what files are in this project?'"
chmod +x scripts/setup-claude-code.sh

Step 5: Shared Custom Skills

Team-specific slash commands live in .claude/skills/ and are committed to the repo:

.claude/
├── skills/
│   ├── deploy/
│   │   └── SKILL.md    → /deploy
│   ├── review/
│   │   └── SKILL.md    → /review
│   └── new-feature/
│       └── SKILL.md    → /new-feature
└── settings.json

Example team deploy skill:

<!-- .claude/skills/deploy/SKILL.md -->
# Deploy to Staging

## Steps
1. Run: bun run typecheck (fix errors before continuing)
2. Run: bun run test (fix failures before continuing)  
3. Run: bun run build
4. Confirm: git status (no uncommitted changes)
5. Deploy: vercel --env staging --yes
6. Smoke test: curl https://staging.yourapp.com/api/health

## Blockers
- If typecheck fails: stop and fix, do not deploy
- If tests fail: stop and fix, do not deploy

Commit .claude/skills/ to the repo. Every developer gets the same skills.

.gitignore for Claude Code — exclude personal settings, include team config:

# Claude Code — exclude personal settings
.claude/settings.local.json

# Claude Code — commit these (team shared)
# .claude/skills/    ← DON'T ignore, commit it
# CLAUDE.md          ← DON'T ignore, commit it

Step 6: Usage Monitoring (Optional)

If you want cost visibility across the team:

# scripts/monitor-claude-usage.py
# Reads Anthropic usage API to report per-key costs

import anthropic
import os

client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_ADMIN_KEY"])

# Anthropic usage API (check docs for current endpoints)
# usage = client.usage.list(...)
# Report by date, model, and key prefix

For teams on Anthropic's enterprise plan, usage reporting is available through the admin dashboard.


Frequently Asked Questions

Can multiple developers share a single Claude Code session? No — Claude Code runs locally on each developer's machine. Each session is independent. "Sharing" happens through CLAUDE.md and shared skills in the repo.

What rate limits apply for team use? By default, Anthropic API rate limits apply per API key. If multiple developers share one key, they share the rate limit. Enterprise plans offer higher limits. See: docs.anthropic.com/api/rate-limits.

Can we self-host the Claude model? Not currently. Anthropic's API is the only way to access Claude models. If data residency is a requirement, discuss with Anthropic enterprise sales — they offer region-specific deployments for qualifying customers.

How do we prevent developers from using expensive models accidentally? Two approaches: (1) set model routing defaults in the shared CLAUDE.md, (2) create a wrapper script that enforces model selection based on context. The Claude Code CLI respects ANTHROPIC_MODEL environment variable.

Should CLAUDE.md be in .gitignore? No — the opposite. Commit CLAUDE.md to version control. It's project documentation that should be reviewed, updated, and consistent across the team. Personal preferences go in ~/.claude/CLAUDE.md (global, not committed).


Related Guides


Go Deeper

Power Prompts 300 — $29 — Team CLAUDE.md templates for 5 project types, onboarding checklist, and cost-control setup guide for teams scaling from 5 to 50 developers.

→ Get Power Prompts 300 — $29

30-day money-back guarantee. Instant download.

AI Disclosure: Written with Claude Code.

Tools and references