Claude Code Setup Guide for Team Projects: Shared CLAUDE.md, Git Hooks, Permissions & Slash Commands

Claude Code Setup Guide for Team Projects

Claude Code is Anthropic’s agentic coding tool that lives in your terminal, understands your codebase, and accelerates development workflows. Setting it up properly for a team ensures consistent AI-assisted development across all contributors. This guide walks through configuring shared conventions, git hook integration, permission modes, and custom slash commands.

Step 1: Install Claude Code

Claude Code requires Node.js 18+ and runs on macOS, Linux, and Windows (via WSL or Git Bash). # Install globally via npm npm install -g @anthropic-ai/claude-code

Verify installation

claude —version

Authenticate with your Anthropic account

claude auth login

Each team member needs their own Anthropic API key or an organization-managed account. Set it as an environment variable or authenticate interactively. # Option A: Environment variable export ANTHROPIC_API_KEY=YOUR_API_KEY

Option B: Interactive login (opens browser)

claude auth login

Step 2: Create a Shared CLAUDE.md Convention File

The CLAUDE.md file is how your team encodes project-specific instructions that Claude Code follows in every session. Place it at the project root and commit it to version control. # Create the project-level CLAUDE.md touch CLAUDE.md

Here is a practical template for team projects: # Project: Acme Web Platform

Tech Stack

  • Backend: Python 3.12, FastAPI, SQLAlchemy
  • Frontend: React 18, TypeScript, Tailwind CSS
  • Database: PostgreSQL 16
  • Testing: pytest (backend), Vitest (frontend)

Code Conventions

  • Use snake_case for Python, camelCase for TypeScript
  • All API endpoints must include OpenAPI docstrings
  • Never use print() for logging — use structlog
  • Prefer composition over inheritance

Testing Rules

  • All new functions require unit tests
  • Integration tests must hit a real database, never mocks
  • Run make test before suggesting a task is complete

Security

  • Never hardcode secrets or API keys
  • Use parameterized queries only — no string interpolation for SQL
  • Validate all user input at API boundaries

Git Workflow

  • Branch naming: feature/, bugfix/, hotfix/
  • Commit messages follow Conventional Commits
  • Always rebase onto main before opening a PR

    Claude Code supports a hierarchy of instruction files:

File LocationScopeUse Case
~/.claude/CLAUDE.mdGlobal (all projects)Personal preferences, auth info
PROJECT_ROOT/CLAUDE.mdProject-wideTeam conventions, committed to git
any_subdirectory/CLAUDE.mdDirectory-scopedModule-specific rules
## Step 3: Configure Git Hook Integration Git hooks let Claude Code run automated checks before commits and pushes. Configure hooks in your project to enforce standards. # .claude/settings.json — project-level settings { "hooks": { "PreToolUse": [ { "matcher": "Bash(git commit.*)", "hook": "bash -c 'npm run lint && npm run test:unit'" } ], "PostToolUse": [ { "matcher": "Edit", "hook": "bash -c 'echo Reminder: run tests after edits'" } ] } }

You can also use standard git hooks that Claude Code respects: # .git/hooks/pre-commit #!/bin/sh npx lint-staged python -m pytest tests/unit -q --tb=short

Claude Code will not bypass --no-verify by default. If a hook blocks a commit, it investigates the root cause rather than skipping it.

Step 4: Set Up Permission Modes

Permission modes control what Claude Code can do without asking. Choose the right mode for your team’s risk tolerance.

ModeBehaviorBest For
**default**Prompts before risky actions (file writes, shell commands)Most teams
**plan**Read-only analysis, no file modificationsCode review, exploration
**trust**Auto-approves most local actionsSolo work, CI environments
# Start Claude Code in plan mode (read-only) claude --mode plan

Start in default mode (recommended for teams)

claude —mode default

Configure allowed tools in settings

.claude/settings.json

{ “permissions”: { “allow”: [ “Read”, “Glob”, “Grep”, “Edit” ], “deny”: [ “Bash(rm -rf*)”, “Bash(git push —force*)” ] } }

Commit the .claude/settings.json file to your repository so all team members share the same permission boundaries.

Step 5: Create Custom Slash Commands

Slash commands let your team define reusable prompts for common workflows. Store them in the .claude/commands/ directory. # Create the commands directory mkdir -p .claude/commands

Create a command file for each workflow: # .claude/commands/review.md Review the current git diff for:

  1. Security vulnerabilities (OWASP Top 10)
  2. Performance issues
  3. Missing error handling
  4. Test coverage gaps Provide actionable feedback with file:line references.
    # .claude/commands/fix-tests.md
    Run the test suite with make test. For each failing test:
  5. Read the test and the code under test
  6. Identify the root cause
  7. Fix the code (not the test) unless the test is wrong
  8. Re-run to confirm the fix
    # .claude/commands/document.md
    For each public function in $ARGUMENTS:
  9. Add a docstring following project conventions
  10. Include parameter types, return types, and examples
  11. Do not modify any logic or formatting

    Use these commands in any Claude Code session: # Run the review command /review

Run fix-tests

/fix-tests

Document a specific file

/document src/api/handlers.py

Pro Tips for Power Users

  • Use /compact regularly — In long sessions, run /compact to summarize context and free up the context window without losing important state.- Chain commands in CI — Run claude -p “run all tests and fix failures” —mode trust in your CI pipeline for automated fix-and-retry loops.- Scope CLAUDE.md per module — Place a CLAUDE.md in subdirectories like services/auth/CLAUDE.md to give module-specific instructions that only activate when working in that directory.- Use the memory system — Ask Claude to /memory to store team decisions, architectural choices, or recurring feedback that persists across sessions.- Parallel tool calls — Claude Code makes independent tool calls in parallel. Structure your requests to enable this by asking for multiple independent tasks at once.

Troubleshooting Common Issues

ProblemCauseSolution
CLAUDE.md not picked upFile not in project root or not named exactlyEnsure the file is CLAUDE.md (case-sensitive) at repository root
Permission denied on tool usePermission mode too restrictiveCheck .claude/settings.json allow/deny lists and adjust
Slash command not foundFile not in .claude/commands/Verify path is .claude/commands/command-name.md
Hook blocks every commitLinter or tests failingFix underlying issues; Claude Code won't skip hooks by design
Context window exhaustedLong session with many filesRun /compact or start a new session with focused scope
## Frequently Asked Questions

Can multiple team members use different CLAUDE.md settings?

Yes. The global ~/.claude/CLAUDE.md file is personal to each developer and is never committed to the repository. The project-level CLAUDE.md at the repo root is shared by all team members via version control. Personal preferences go in the global file, while team conventions go in the project file. When both exist, instructions from both are combined, with project-level instructions taking precedence for project-specific rules.

How do I prevent Claude Code from running destructive commands?

Use the .claude/settings.json file to explicitly deny dangerous patterns. Add entries like Bash(rm -rf*), Bash(git push —force*), and Bash(DROP TABLE*) to the deny list. Commit this file to your repository so the restrictions apply to every team member. Additionally, use —mode plan for read-only sessions where no modifications should occur.

Do custom slash commands support arguments and variables?

Yes. Use the $ARGUMENTS placeholder in your command markdown files. When a team member runs /your-command some arguments here, the text after the command name replaces $ARGUMENTS in the template. This lets you build reusable, parameterized workflows like /document src/models/user.py or /review —focus security.

Explore More Tools

Antigravity AI Content Pipeline Automation Guide: Google Docs to WordPress Publishing Workflow Guide Bolt.new Case Study: Marketing Agency Built 5 Client Dashboards in One Day Case Study Bolt.new Best Practices: Rapid Full-Stack App Generation from Natural Language Prompts Best Practices ChatGPT Advanced Data Analysis (Code Interpreter) Complete Guide: Upload, Analyze, Visualize Guide ChatGPT Custom GPTs Advanced Guide: Actions, API Integration, and Knowledge Base Configuration Guide ChatGPT Voice Mode Guide: Build Voice-First Customer Service and Internal Workflows Guide Claude API Production Chatbot Guide: System Prompt Architecture for Reliable AI Assistants Guide Claude Artifacts Best Practices: Create Interactive Dashboards, Documents, and Code Previews Best Practices Claude Code Hooks Guide: Automate Custom Workflows with Pre and Post Execution Hooks Guide Claude MCP Server Setup Guide: Build Custom Tool Integrations for Claude Code and Claude Desktop Guide Cursor Composer Complete Guide: Multi-File Editing, Inline Diffs, and Agent Mode Guide Cursor Case Study: Solo Founder Built a Next.js SaaS MVP in 2 Weeks with AI-Assisted Development Case Study Cursor Rules Advanced Guide: Project-Specific AI Configuration and Team Coding Standards Guide Devin AI Team Workflow Integration Best Practices: Slack, GitHub, and Code Review Automation Best Practices Devin Case Study: Automated Dependency Upgrade Across 500-Package Python Monorepo Case Study ElevenLabs Case Study: EdTech Startup Localized 200 Course Hours to 8 Languages in 6 Weeks Case Study ElevenLabs Multilingual Dubbing Guide: Automated Video Localization Workflow for Global Content Guide ElevenLabs Voice Design Complete Guide: Create Consistent Character Voices for Games, Podcasts, and Apps Guide Gemini 2.5 Pro vs Claude Sonnet 4 vs GPT-4o: AI Code Generation Comparison 2026 Comparison Gemini API Multimodal Developer Guide: Image, Video, and Document Analysis with Code Examples Guide