Claude Code Team Collaboration Guide

🤖 Agents 2026-07-18 · Updated 2026-11-21 4 min read

Solo, Claude Code is a productivity win. With three people it turns messy: separate CLAUDE.md files, copy-pasted MCP config, no boundaries on what the agent may run. Here is the team setup - layered memory, project MCP, permission guardrails, automated PR review.

📜 Table of Contents

📖 Keep reading

Claude Code Team Collaboration: Shared CLAUDE.md, Project MCP, Auto Review

Solo, Claude Code is a productivity tool. With three people it becomes a collaboration problem: three private CLAUDE.md files producing three code styles, MCP config passed by word of mouth, and an agent allowed to run any bash command until something breaks.

Three layers of memory

Layer Contents Owner In git
./CLAUDE.md Stack, layout, build commands, prohibitions Team review Yes
src/api/CLAUDE.md Module conventions Module owner Yes
~/.claude/CLAUDE.md Personal preferences, local paths You No

Mixing them has concrete costs: personal habits leak into the repo, and project rules living only on one laptop never reach a colleague's agent.

What belongs in the project file

Not a README copy. An operating manual, heavy on how-to:

## Stack
- Python 3.11 + FastAPI, Next.js 15, uv and pnpm (not pip/npm)
- Postgres 16, migrations via Alembic

## Commands
- dev: `uv run uvicorn app.main:app --reload`
- test: `uv run pytest -q` (required before commit)

## Layout
- `app/api/` routes only; logic in `app/services/`
- New tables need a migration and `tests/test_<table>.py`

## Never
- Do not change defaults in `app/core/config.py`; use env vars
- No `print` in business code; use `app.core.logger`
- No `git push --force`, never touch `main`

Rules that hold up:

  1. Commands, not adjectives. "Keep it clean" is unenforceable; "type annotations required" is not.
  2. List prohibitions. The most common failure is an agent helpfully editing something off-limits.
  3. Keep it under ~200 lines. Attention dilutes; put the important rules first.
  4. Split with @ imports. Move detail into .claude/rules/*.md and reference it.

Run /init on a new repo for a first draft, then cut it in half - it writes too much to be useful.

Shared MCP config

Scope Stored in Use
local This machine, this project Experiments
project .mcp.json (committed) Team tooling
user User config Personal, cross-project
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": { "DATABASE_URL": "${DEV_DATABASE_URL}" }
    }
  }
}

Two rules: secrets go through environment expansion, never literal JSON, so the file is safe to commit; and paths stay repo-relative, so a colleague's clone does not break. Register with claude mcp add --scope project <name> -- <command> instead of hand-editing.

Guardrails

{
  "permissions": {
    "allow": ["Bash(uv run pytest:*)", "Bash(git diff:*)", "Read(./**)"],
    "deny": ["Bash(git push:*)", "Bash(rm -rf:*)", "Read(./.env)", "Read(./secrets/**)"]
  }
}

Allowlist what the agent needs to iterate - tests, type checks, read-only git - and denylist anything destructive. Then add a PreToolUse hook that inspects the command and exits non-zero to block it. Blocking before execution beats reviewing after.

PR review

git diff origin/main...HEAD > pr.diff
claude -p "Review pr.diff: report only problems that cause bugs or violate CLAUDE.md,
graded P0/P1/P2, with file and line. Do not summarize the changes." --output-format json

"Do not summarize" matters - otherwise half the output is restating the diff. Let the agent report, never approve. Set a timeout so one large PR cannot burn the budget.

One-week rollout

Day Task Check
1 Draft project CLAUDE.md, team review A new hire runs tests unaided
2 Move MCP into .mcp.json, env-var secrets Everyone's claude mcp list matches
3 Add deny rules, watch false blocks Nobody disables permissions
4 PreToolUse hook protecting main Push attempt is blocked
5 CI review, P0 only at first One real issue caught in week one

FAQ

Anyone can edit CLAUDE.md - does it drift? Manage it like code: PRs, and review for necessity plus personal-preference leakage. Delete stale rules; a long file stops being read.

Different models still produce different styles? Put style in tooling - formatter, lint config, test command - not in prose.

Should MCP reach production data? No. Read replica or local copy, separate credentials. Query access means accidental full scans.

Three agents, one repo - conflicts? Same as humans: one branch per task, no direct commits to main.

Config fields, hook event names and scope names evolve; see the Claude Code docs.

Related

❓ FAQ

Anyone can edit CLAUDE.md - does it drift?

Treat it like code: changes go through PRs, review for necessity and personal-preference leakage, and prune it regularly.

Can MCP servers connect to production?

No. Use a read replica or test database with separate credentials.

Should the agent approve PRs?

No. It reports graded problems with line numbers; humans decide merges.

Related Articles
2026-08-06
Temporal (22,126 Stars) 2026: Durable Execution for Reliable Workflows - The Complete Guide
2026-07-14
Top 10 Open Source AI Agent Frameworks in 2026: Complete Comparison
2026-08-01
Multi-Agent System vs Agentic AI in 2026: What Is the Difference?
2026-07-26
AI Code Review Agents for PRs
2026-07-23
LangChain RAG Pipeline Tutorial: Build Production RAG in 30 Minutes
2026-08-23
Best AI Floor Plan Generator for Real Estate Agents in 2026: 6 Tools That Turn Photos into Floor Plans

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.

💬 Comments (0)

No comments yet. Be the first!

Login to comment