Using an AI coding agent alone is one thing. Rolling it out across a team is another — because the safety model changes underneath you. This is the operations-layer playbook: what to put in place so you can hand the agent to a whole team and still sleep at night.
On your own machine, you configure your own guardrails and you live with the results. Across a team, one fact dominates everything:
.env, or drops a production table doesn't know which laptop it's on.
These aren't hypotheticals. A few that have been reported publicly on the Claude Code tracker:
CLAUDE.md instructions and committed API keys to version control (#2142).The lesson from all three is the same: they weren't prevented by asking the agent to be careful. Instructions in a doc are advisory; the agent can ignore them. What stops these is a guardrail that runs at the moment of the action, the same way for everyone, whether they remembered to set it up or not. That's the operations layer, and at team scale it's the only layer that actually holds.
Don't ask each developer to configure hooks by hand — versions drift and new hires forget. Commit the configuration to the repo so everyone who clones it inherits the same baseline.
// .claude/settings.json (committed to the repo)
{
"hooks": {
"PreToolUse": [
{ "matcher": "Bash",
"hooks": [{ "type": "command", "command": "bash .claude/hooks/rm-safety-net.sh" }] },
{ "matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "bash .claude/hooks/destructive-migration-write-guard.sh" }] }
]
}
}
The fastest way to get a vetted set of hooks into .claude/ is the free, MIT tool:
npx cc-safe-setup --team # writes project-level hooks under .claude/ for git sharing
git add .claude/ && git commit -m "chore: shared Claude Code safety baseline"
A small, boring, non-negotiable set beats a large one nobody agrees on. A good starting baseline:
| Guard | Stops |
|---|---|
| recursive-delete guard | rm-style recursive deletes of home / absolute / parent paths |
secret / .env guard | committing .env and credential files (even via git add -f) |
| destructive-DB guard (run time + write time) | DROP/TRUNCATE/unqualified DELETE — both when run, and when written into a migration or script that a tool runs later |
| force-push / history-rewrite guard | git push --force, filter-repo, history rewrites that lose work |
| subagent write guard | subagent-originated writes to high-blast files (migrations, IaC, prod config) |
cc-safe-setup ships all of these as examples; pick the ones that match your stack and leave the rest. The point isn't "install everything" — it's that the same agreed minimum is on every machine.
Local hooks only protect local machines. Add one more gate at the point where changes ship, so a weakened or removed safety config is caught on the pull request:
# .github/workflows/safety.yml
name: safety
on: [pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx cc-safe-setup --audit --json
This is free and works per repo today. (Enforcing one policy centrally across every repo, so a new repo can't silently skip it, is the one piece that doesn't fit a per-developer tool — see the note at the bottom.)
Onboarding is where team safety quietly fails: the new person is productive on day one and configured on day thirty. Because the baseline lives in the repo (step 1), cloning it is the configuration — there's no separate "set up your hooks" step to forget. Add a one-line SessionStart note stating the team's safety assumptions so the agent and the new developer both start from the same place.
The failure surface moves: new model versions, new tool behaviors, new billing rules. Re-pull the hook set periodically and skim what's breaking next. cc-safe-setup tracks recurring failure clusters publicly so you can update the baseline when something new lands rather than after an incident.
Copy this into your team wiki or a tracking issue:
.claude/settings.json is committed to the repo (not configured per-machine).env, destructive-DB, and force-push guards are in the baseline.env that dev/test tooling readsIf you need sign-off, don't argue from abstract fear — argue from reported incidents and the cost of the alternative. The framing that lands:
cc-safe-setup on GitHub (free, MIT) The free CI Action