Engineering guide

How to Roll Out Claude Code Across Multiple Repos With Security Rules and Code Review Gates

Engineering guide to multi-repo Claude Code rollouts: managed-settings.json deny rules, OS sandboxing, PreToolUse hooks, CLAUDE.md, and CI review gates.

Rolling out Claude Code across multiple repositories requires two separate control planes: org-wide managed settings and hooks on developer machines to restrict what the agent can read or execute, and standard repository branch protection and CI review gates to control what can merge. Never rely on local prompt instructions to protect production branches — enforce security rules in config and code review rules in Git.

1. Enforce org-wide policy with managed-settings.json

Deploy organization-wide managed settings via the Claude admin console or MDM (managed-settings.json) so individual user or repository configs cannot weaken your baseline:

  • Deny sensitive paths and exfiltration tools: Block Read(./.env*), Read(**/secrets/**), Read(~/.ssh/**), and arbitrary network commands (Bash(curl:*), Bash(wget:*)).
  • Disable bypass mode: Set "disableBypassPermissionsMode": "disable" so developers cannot run --dangerously-skip-permissions.
  • Enable OS sandboxing: Turn on Claude Code’s built-in filesystem and network sandbox and set "allowUnsandboxedCommands": false.
  • Restrict MCP servers and plugins: Use explicit MCP server allowlists and internal plugin marketplaces (strictKnownMarketplaces) to prevent untrusted tool-spoofing or prompt injection.
{
  "permissions": {
    "deny": [
      "Read(./.env*)",
      "Read(**/secrets/**)",
      "Read(~/.ssh/**)",
      "Bash(curl:*)",
      "Bash(wget:*)"
    ],
    "disableBypassPermissionsMode": "disable"
  },
  "sandbox": {
    "enabled": true,
    "allowUnsandboxedCommands": false
  }
}

2. Add PreToolUse hooks for rules deny lists cannot express

Use PreToolUse hooks (configured to fail closed) to block high-risk actions before execution — such as direct pushes to main, edits inside infra/prod/** or database migration folders, or secret patterns detected on write. Pair hooks with explicit Read deny rules because @-referenced files can bypass tool hooks.

3. Standardize multi-repo context (CLAUDE.md + shared skills)

Keep context clean and predictable across repositories:

  • Global engineering rules: Security baseline, logging conventions, and testing requirements.
  • Per-repo CLAUDE.md (short and maintained like code): Exact build, test, and lint commands, folder ownership, forbidden edits, and cross-repo API or schema contracts.
  • Shared internal plugin: Distribute team slash commands, Agent Skills, and repo templates from one versioned repository instead of copy-pasting prompts across 30 repositories.

4. Keep human-grade code review gates on every PR

Agent-written code must clear the exact same merge gates as human-written code — plus a scope check:

  1. Branch protection and CODEOWNERS: No direct pushes to protected branches; the developer who prompted the agent is the accountable PR author and cannot self-approve.
  2. Deterministic CI first: Build, typecheck, unit and integration tests, secret scanning (Gitleaks or TruffleHog), SAST, and dependency/SCA checks to catch hallucinated packages.
  3. Diff-scope check: Flag PRs that modify files outside the ticket scope or weaken or delete existing tests.
  4. Independent AI review (advisory, not auto-merge): Run an automated security and logic reviewer (such as claude-code-action or a separate review agent with fresh context) to surface bugs before human review. Keep human sign-off mandatory for auth, payments, migrations, and infrastructure.

5. Measure adoption and cost with telemetry

Enable OpenTelemetry export (CLAUDE_CODE_ENABLE_TELEMETRY=1) to track token cost, tool calls, and hook denials by team. Track three delivery metrics before and after rollout: PR cycle time, review rework and defect rate, and weekly active developers using tested workflows (not raw lines of code generated).

6. Phased 6-to-12-week rollout schedule

Phase Timeline Scope Deliverable
Phase 0: Policy & Security Weeks 1–2 Security, Platform, Legal Provider choice (Anthropic direct, Bedrock, Vertex, or Foundry), ZDR and data rules, managed-settings.json, sandbox verification
Phase 1: Pilot Repos Weeks 2–4 1–2 engineering teams (15–25 devs), 3–5 well-tested repos Per-repo CLAUDE.md, PreToolUse hooks, hands-on workshop, baseline cycle-time and defect metrics
Phase 2: Standardize & Expand Weeks 5–8 Standard product and service repos Internal skills plugin, repo template, CI review bot in advisory mode, internal champions network
Phase 3: High-Risk Repos Weeks 9–12 Auth, payments, infra, legacy monoliths Stricter overrides, two required human reviewers, 30-day adoption and cost report

Want help running this rollout?

Nina Labs runs Claude Code, Claude Enterprise, ChatGPT Enterprise, and Codex rollouts for engineering and business teams — from admin and security setup and CLAUDE.md repository preparation to hands-on cohorts (15–25 developers per cohort; 2 cohorts for 50 engineers) and 30-day adoption tracking. Engagements are fixed fee / scoped upfront after a free 30-minute engineering call. See our Claude Code, Claude Enterprise & ChatGPT team training and rollout service, review Pricing & Engagement Models, or talk to an engineer.

Planning a multi-repo Claude Code rollout?

Start with a free 30-minute engineering call. We review your repositories, security controls, and rollout scope.