In the teams I've worked with so far, the hard part started after people got access to Claude Code, Anthropic's coding agent that runs in the terminal. When the rules never make it from someone's head into the repo, the agent makes a mistake on one person's machine today that someone else fixed yesterday. The same change also gets approved or sent back depending on who reads it.
Below are seven steps, and they start with a measure, because if nobody picks one up front, later everyone defends their own impression. Once they're all in place, the way the team works with the agent has moved out of people's habits and into the repo.
Write down a number before you start
When someone asks what the agent adds to the team, it's easy to answer with an impression. Pick one measure, for example how long it takes a task to become a PR or how many PRs come back from review, and write down today's value before you take the first step. Without a before, the number you get later has nothing to be compared with.
How many people use the agent is the easiest number to collect in the first weeks, and it shows well how far the agent has spread through the team. Whether the team is doing better work is what the change in the measure you picked tells you.
The rules live in the repo
CLAUDE.md is a plain text file Claude Code reads at the start of every session, which means every time you open the agent. Put it in the root of the repo and write the setup, the test command and the branch and commit rules in it, plus the folders the agent shouldn't touch. Anyone who wonders what the agent is working from finds the answer in this file.
The first mistake is keeping the file in the wrong place. Claude Code also reads each person's own ~/.claude/CLAUDE.md, and rules written there only work in that person's agent. The second mistake is a repo file that never changes after the first week. When the agent makes the same mistake twice, you have a candidate rule, and when that rule goes in through a PR the way code does, the team sees it.
Write down what the agent may touch
In versions before v2.1.283, Claude Code asks for permission before it runs a command. Newer versions open in auto mode, so write the rule down. In the repo's .claude/settings.json file you set which commands go through without asking and which never run at all. Because the file is committed, every agent on the team starts from the same base. Personal settings can extend the allow and ask lists but can't override a deny rule. An example:
{
"permissions": {
"allow": ["Bash(npm test *)", "Bash(npm run build *)"],
"ask": ["Bash(git push *)"],
"deny": [
"Bash(git push --force*)",
"Bash(gh pr merge *)",
"Bash(rm -rf *)",
"Read(**/.env*)"
]
}
}
The deny list comes before everything else, and a command on it doesn't run even if it's also on another list. Keeping the allow list narrow looks safer, but it often works out the other way. If the test command asks for permission on every run, after a while people approve the prompt without reading it, and a dangerous command gets through on the same habit. Put the commands the team runs every day and can undo on the allow list. Just keep in mind that a command like npm test will also run the scripts the agent wrote, without asking.
Don't rely on this file alone to keep the agent out of production. The agent runs on the developer's machine with the developer's permissions, so if a key on that machine reaches production, the agent has it too. A deny rule also only catches the pattern it was written as. The rm -rf * rule in the example lets rm -fr through, and git push -f doesn't hit the deny list at all. It only asks for approval. The .env rule shuts off Claude Code's file reading tool, but it won't always stop a command that reads the same file from the terminal. Keep production keys out of the terminal the agent runs in, and let the settings file be a second layer on top of that.
Keep the task small and approve the plan
When a task is explained to the agent in chat, it turns what it understood straight into code, and the part it got wrong first shows up in the diff, scattered through the code. Ask for a plan first, with the steps of the task and the acceptance criteria, the sentences that say when the task counts as done. In plan mode, which you turn on with Shift+Tab, the agent reads files but changes none of them until you approve. The plan is the cheapest place to catch what the agent misunderstood.
Keep the task small, between one and three files. It's hard to find someone who will read a big PR line by line, and a bug in a PR that was approved without being read usually gets found in production. Write the acceptance criteria as given/when/then: the starting state, the one thing that happens and the expected result. A criterion in that shape turns into a test easily.
The test comes before the code
On a team that writes tests after the code is done, if there's time left, the test the agent writes describes the code the agent wrote. If the code is wrong, the test counts the same mistake as correct.
Flip the order. Have the agent write the test first and run it. It goes red, because the behavior you asked for isn't in the code yet. Since the agent writes both the code and its test, the green that comes later doesn't say much on its own, and the red is where a person should look. Check whether that red measures the acceptance criterion, then let the agent write the code.
When the agent can't get a test to pass, it sometimes loosens the test or deletes it. If a test changed in the diff, ask why before you merge the PR.
Whoever wrote the PR doesn't merge it
If nothing written says what to look for in a PR the agent opened, everyone reads it with their own checklist, and the PR either sits in the queue or gets skimmed and approved. Write what to look for into the repo, inside CLAUDE.md or in a file next to it.
Decide up front who presses merge. In the example gh pr merge is on the deny list, so the agent can't run that command. The real safeguard is the merge setting on GitHub or GitLab. Set there who can merge and whether review is required. And if the person who shipped the change with the agent merges their own PR, no second person has looked at the code the agent wrote.
A diff only shows the files that changed, so a file the agent forgot to update never appears in it. The person who catches that gap is the one who knows which files this kind of work touches together.
A way that works becomes a skill
A skill is a short instruction that tells the agent how to do a job. Put it in the repo's .claude/skills/ folder and every agent on the team reads it whenever the skill's description fits the task at hand. When someone finds a good way to do a job with the agent, they explain it in a meeting or write it in a doc. The agent never reads that doc. If the person remembers, they explain it to their own agent again from scratch.
There's an open source Claude Code plugin for finding the jobs a team keeps repeating, called TeamHandbook. It pulls those jobs out of the repo's git history and writes a skill draft for the one you pick, and the draft isn't installed until someone approves it. Part of a job never enters git at all, like a check someone runs by hand before merging. Only the person who knows the job can write that part of the skill.
The formats I suggest for setting this up with a team in its own repo, and how the 2-hour live session runs, are on Work with me.
If you want to set this up together in your company, the AI-native company page explains how it goes.