Team CLAUDE.md Best Practices
- Document agreed-upon patterns
- Include architecture decisions
- Specify code review focus areas
- List common commands and workflows
- Update based on retrospectives
One teammate gets brilliant results from Claude Code. The next one copies a config off Slack, the MCP servers silently fail to load, and they conclude “it doesn’t really work.” The gap is never the model — it’s that nothing about your setup is shared, versioned, or safe by default. The fix is to treat your CLAUDE.md, .mcp.json, custom commands, and permission rules as team infrastructure that lives in git.
CLAUDE.md + .mcp.json layout so a fresh clone is productive on day one.mcp.json schema (the one Claude Code actually reads)permissions allow/ask/deny policy instead of unsafe blanket flagsCreate a shared knowledge base that benefits everyone:
Structure for Team Use
project/├── CLAUDE.md # Team standards├── CLAUDE.local.md # Personal preferences (git-ignored)├── docs/│ └── claude/│ ├── onboarding.md # New member guide│ ├── patterns.md # Common patterns│ └── troubleshooting.md # Known issuesVersion Control Integration
# Add team files to gitgit add CLAUDE.mdgit add .claude/commands/git add .claude/settings.jsongit add .mcp.json
# Ignore personal filesecho "CLAUDE.local.md" >> .gitignoreecho ".claude/personal/" >> .gitignoreRegular Updates — run a retrospective on CLAUDE.md after each sprint so it tracks how the codebase actually evolved.
Team CLAUDE.md Best Practices
Example team CLAUDE.md sections:
# Team Coding Standards
## TypeScript- ALWAYS use strict mode- PREFER interfaces over types for objects- REQUIRE explicit return types- USE branded types for IDs
## Testing- MINIMUM 80% coverage for new code- ALWAYS test error paths- USE data-testid for E2E tests- MOCK external services# Architecture Decisions
## API Design (illustrative ADR snippet)- REST over GraphQL for public endpoints- Versioning via URL path (/v1/, /v2/)- Standard error format (RFC 7807)- Rate limiting on all endpoints
## Database- PostgreSQL for primary data- Redis for caching only- No direct SQL, use Prisma- Soft deletes for audit trailStandardize common workflows with shared commands:
Start a new feature following team process:
Feature: $ARGUMENTS
1. Create branch from latest main2. Update project board3. Create feature flag (if needed)4. Set up monitoring5. Create initial tests6. Draft PR description
Follow our feature development checklist.More team command examples:
# .claude/commands/hotfix.md# .claude/commands/release.md# .claude/commands/incident-response.md# .claude/commands/performance-check.mdClaude Code reads permissions from a permissions object in .claude/settings.json with three arrays — allow, ask, and deny — plus an optional defaultMode. Rules use the Tool or Tool(specifier) form, and Bash specifiers are space-globs (Bash(git diff *)), never colon-separated. Rules evaluate deny first, then ask, then allow. There is no allowedTools/autoAllow/requireApproval/blocked key, and the tools are Read/Edit/Write/Bash — not View/Create/Delete.
{ "permissions": { "defaultMode": "acceptEdits", "allow": [ "Read", "Edit", "Write", "Bash(git status)", "Bash(git diff *)", "Bash(npm run test *)", "Bash(npm run lint)" ], "ask": [ "Bash(git push *)", "Bash(npm install *)" ], "deny": [ "Bash(rm -rf *)", "Read(./.env)", "Read(./.env.*)" ] }}{ "permissions": { "defaultMode": "default", "allow": [ "Read", "Bash(git status)", "Bash(git diff *)", "Bash(npm run test *)" ], "ask": [ "Edit", "Write", "Bash(git push *)" ], "deny": [ "Bash(npm run deploy *)", "Bash(rm -rf *)", "Read(./.env)" ] }}{ "permissions": { "defaultMode": "default", "allow": [ "Read", "Bash(git status)", "Bash(git log *)" ], "ask": [], "deny": [ "Edit", "Write", "Bash(git push *)", "Bash(rm -rf *)", "Read(./.env)", "Read(./secrets/**)" ] }}Document permission rationale:
# Permission Guidelines
## Development Environment- Full permissions for rapid development- Auto-allow safe read operations- Manual approval for destructive operations
## Staging Environment- Limited to testing and debugging- No direct database modifications- Deployment requires approval
## Production Environment- Read-only access only- All changes through CI/CD- Emergency access requires two approvalsUse CLAUDE.md to enforce consistency:
# Team Coding Standards
## Naming Conventions- Components: PascalCase (UserProfile, LoginForm)- Utilities: camelCase (formatDate, validateEmail)- Constants: UPPER_SNAKE_CASE (MAX_RETRIES)- Files: kebab-case (user-service.ts)
## Code Organization\`\`\`src/├── components/ # UI components├── services/ # Business logic├── utils/ # Shared utilities├── types/ # TypeScript types└── constants/ # App constants\`\`\`
## Error Handling\`\`\`typescript// ALWAYS use custom error classesclass ValidationError extends AppError { constructor(field: string, message: string) { super(`Validation failed for ${field}: ${message}`); }}
// ALWAYS handle errors explicitlytry { await riskyOperation();} catch (error) { logger.error('Operation failed', { error, context }); throw new OperationError('User-friendly message');}\`\`\`
## Testing Standards- Test file naming: *.test.ts or *.spec.ts- Describe blocks for class/module- It blocks for specific behaviors- AAA pattern: Arrange, Act, AssertStandardize tool access across the team:
// .mcp.json (checked into git){ "mcpServers": { "github": { "command": "npx", "args": ["@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } }, "atlassian": { "url": "https://mcp.atlassian.com/v1/mcp", "headers": { "Authorization": "Bearer ${ATLASSIAN_API_TOKEN}" } }, "slack": { "command": "npx", "args": ["@modelcontextprotocol/server-slack"], "env": { "SLACK_TOKEN": "${SLACK_TOKEN}" } } }}Team MCP Benefits
Help new team members get productive quickly:
# Claude Code Onboarding Guide
## Initial Setup (30 minutes)1. Install Claude Code: `npm install -g @anthropic-ai/claude-code`2. Configure authentication: launch `claude` and use `/login` in the REPL3. Clone team repository4. Run setup script: `./scripts/claude-setup.sh`
## First Day Tasks1. Read team CLAUDE.md file2. Try example commands: - `/feature-start my-first-feature` - `/team-standards`3. Pair with team member on real task4. Join #claude-code Slack channel
## Best Practices- Use the team permissions allowlist in .claude/settings.json (allow/ask/deny)- Reserve --dangerously-skip-permissions for sandboxed/throwaway environments only, never a shared dev machine or anything touching prod- Clear context between unrelated tasks- Check /cost daily to understand usage- Use team commands from .claude/commands/
## Common Issues- Too many permission prompts: extend the allow list in settings.json, do not skip- MCP not working: run `claude mcp list`, then check the env vars in .mcp.json- New .mcp.json server keeps prompting: `claude mcp reset-project-choices`- High costs: use Sonnet 4.6 for routine tasks, Opus 4.8 for hard ones, Fable 5 (`/model fable`) only when peak intelligence justifies the cost (see [model comparison](/en/appendices/model-comparison/))
## Resources- Team knowledge base: /docs/claude/- Video tutorials: /onboarding/claude-code/- Slack channel: #claude-codeIntegrate Claude Code into your review process:
The official action is anthropics/claude-code-action@v1 (repo: github.com/anthropics/claude-code-action). Drive review scope through the prompt input and pass any CLI options via claude_args. There is no claude-code-review action and no focus:/ignore: inputs.
name: Claude Code Review
on: pull_request: types: [opened, synchronize]
jobs: review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | Review this PR for security vulnerabilities, logic errors, performance issues, and missing tests. Be specific and suggest fixes. Ignore style, naming, and documentation — linting owns those. claude_args: "--max-turns 10 --model claude-opus-4-8"Store a reusable review command at .claude/commands/review-pr.md and run it as /review-pr 1234 inside the REPL:
Review the PR at $ARGUMENTS focusing on:
1. Business logic correctness2. Security vulnerabilities3. Performance implications4. Test coverage5. Error handling
Ignore style issues - those are handled by linting.Be specific about issues and suggest fixes.Treat automated review as a first pass, not a gate: Claude Code reliably catches missing-test and error-handling gaps, while humans still own architectural and product judgment.
Create a culture of continuous improvement:
Weekly Tips Session
# Weekly Claude Code Tips- 15-minute team standup- One person shares a discovered technique- Document in team knowledge base- Try the technique togetherWorkflow Show-and-Tell — inside the REPL, run /export session.md to write the conversation to a file (omit the filename to copy it to the clipboard), then drop it in your team knowledge base. Note that /export is an in-REPL slash command, so it takes a filename argument rather than a shell redirect.
Cost Optimization Reviews — review usage with /cost in the REPL and your org’s analytics dashboard, then right-size models per task.
Pattern Mining — run a quarterly pass to fold recurring patterns into CLAUDE.md.
Use multiple team members with Claude Code for large projects:
# Microservices Migration Plan
## Team Assignment- Alice: User Service (Terminal 1)- Bob: Order Service (Terminal 2)- Carol: Payment Service (Terminal 3)- Dan: Integration Tests (Terminal 4)
## Coordination1. Morning sync to assign services2. Shared interface definitions in .claude/shared/3. Hourly check-ins on Slack4. End-of-day integration test
## Claude Code Setup\`\`\`bash# Each developerclaude --add-dir ./services/[assigned-service]\`\`\`
## Shared Resources- API contracts: .claude/shared/api/- Test utilities: .claude/shared/testing/- Migration guide: .claude/shared/migration.mdCoordination Tools
Develop commands that match your team’s workflow. Save this as .claude/commands/team/standup.md, then run /team:standup in the REPL to generate your daily update from real git history.
More team commands:
# Sprint planning.claude/commands/team/sprint-plan.md
# Incident response.claude/commands/team/incident.md
# Release notes.claude/commands/team/release-notes.md
# Technical debt tracking.claude/commands/team/tech-debt.mdSuccessful team adoption requires more than just technical setup:
Week 1: Individual explorationWeek 2: Share discoveriesWeek 3: Standardize workflowsWeek 4: Full team adoption
Focus: Rapid experimentationMonth 1: Pilot with early adoptersMonth 2: Develop team standardsMonth 3: Gradual rolloutMonth 4: Full adoption
Focus: StandardizationQuarter 1: Pilot teamsQuarter 2: Department rolloutQuarter 3: Organization-wideQuarter 4: Optimization
Focus: Governance and scaleTrack these indicators of successful team adoption:
Shared configuration fails in a handful of predictable ways. Here is how to recognize and recover from each.
Teammate’s .mcp.json servers don’t load. Almost always the wrong top-level key — Claude Code reads mcpServers, not servers. Confirm the running servers with claude mcp list. If the key is right but a server is missing, an unexpanded env var (${GITHUB_TOKEN}) is usually the cause — see the next item.
A new project-scoped server keeps prompting for approval, or you approved it once and want to re-decide. Claude Code asks before trusting servers from a project .mcp.json. Run claude mcp reset-project-choices to clear those decisions, then re-open the project and approve intentionally.
.mcp.json works on one machine but not another. The config references env vars (${GITHUB_TOKEN}, ${SLACK_TOKEN}) that exist in one shell profile and not the other. Document the required vars in onboarding and have each developer export them in their shell rc; never hardcode secrets into the committed .mcp.json.
CLAUDE.md merge conflicts on every PR. Split it: keep stable, rarely-changing standards in the committed CLAUDE.md, and move personal or fast-moving notes into git-ignored CLAUDE.local.md. Resolve conflicts by section, not line — the file is prose, so prefer keeping both rules unless they contradict.
A teammate is on --dangerously-skip-permissions and edited something they shouldn’t have. Stop recommending the flag for shared machines. Ship the permissions allow/ask/deny policy from Tip 88 in .claude/settings.json, and set disableBypassPermissionsMode to "disable" in managed settings for anything near prod.
With team collaboration mastered, you’re ready for the final set of tips. Continue to Troubleshooting and Best Practices for common issues and proven patterns for long-term success.