Writing down how the team uses agents
The lessons of this part each gave the team one agreement. The lesson on attribution and review agreed how a change says what the agent did. The lesson on hooks and CI made two rules run by themselves, and the lesson on parallel sessions kept sessions away from what they share. This last lesson of the course doesn’t add a new idea. We write those agreements down as the team’s practice for agent use, starting from the mistakes the team has seen. Then we decide which of them a check enforces.
Why the practice is written down
Section titled “Why the practice is written down”Ask five engineers how the team uses agents, and when nothing is written down you get five answers. Each person follows the habits they built in their own sessions. The agents follow none of them, because an agent knows only what is in its context. A habit in someone’s head never gets there. A file that the agent loads at the start of every session does.
That file is the project instructions file from the
lesson on project instructions,
AGENTS.md or CLAUDE.md at the root of the repository. The Claude Code
documentation says that the agent reads the project’s file at the start of
every session. The file reaches the whole team through the repository, and
the documentation advises keeping personal preferences out of it
[1]. A change to the practice is then a change to a
file, and it gets a diff and a review like any other change.
The practice section of that file says:
- what agents may do, and what every change must pass before it merges,
- how agent work is attributed in commits and pull requests,
- how agent work is reviewed, and what the author does before asking,
- which directories and commands are off limits to agents.
This course’s repository is a worked example. Its AGENTS.md says that
the full check must pass before a push, that no agent pushes to main,
and that every commit message an agent writes ends with a
Co-Authored-By line and an Assisted-by line and carries no
Signed-off-by [2]. The AI-native software development
playbook on Claude Academy has a lesson on the CLAUDE.md file, and its
course page describes that file and the team’s skills as knowledge the
team keeps in versioned files that the agents read
[3].
Where does the answer go?
Section titled “Where does the answer go?”A team of five engineers uses coding agents on one repository, and nothing about how they use the agents is written down yet.
A new engineer asks whether an agent may push to a shared branch, and the other four engineers give three different answers. Where does the team write the answer, so that every person and every agent session works from the same one?
Which of these places do the agents load, and which of them can the whole team read and change?
Start from the mistakes you have seen
Section titled “Start from the mistakes you have seen”A few lines of the practice are decisions the team makes once, at the start: the check every change passes, and the form of the attribution trailer. The other lines come from incidents. An incident is a change the team had to take back or repair, and each one shows a mistake that happened on this project, with these people and these agents. A rule written from an incident guards against a mistake the team knows it makes. Write the incident next to the rule. A reader then knows why the rule is there and can tell when the reason is gone.
The fixture for this lesson is a small invoice project in the course
repository under site/examples/coding-with-agents/team-practice/. Its
AGENTS.md has a practice section that the team wrote before any of the
incidents in its history:
## Working with agents
- Be careful with dependencies.- Don't lose other people's work.- Say when an agent helped with a commit.- Agents never edit the database migrations in `migrations/`.The invoice project's history
Section titled “The invoice project's history”The course’s script builds the project’s git history with fixed dates and
prints each commit, oldest first, with its message body indented under
it. Run it from site/examples/coding-with-agents/team-practice/ in your
clone of the course repository, and compare what you see with the output
below.
python3 history.py2026-05-04 chore: the invoice service
2026-05-11 feat: export invoices as CSV
Assisted-by: Claude:claude-sonnet-4-6
2026-05-12 Revert "feat: export invoices as CSV"
The agent ran the lock command while it added the export,
and requirements.lock upgraded both dependencies. The review
read invoices.py and skipped the lockfile, and the release
failed its smoke test.
2026-05-13 feat: export invoices as CSV, lockfile unchanged
Assisted-by: Claude:claude-sonnet-4-6
2026-05-18 feat: a due date on each invoice
2026-05-27 feat: discount for early payment
Assisted-by: Claude:claude-sonnet-4-6
2026-06-02 fix: cap the early-payment discount at five days again
Two agent sessions ran in two worktrees of one clone. The
invoice session stashed its cap on the discount, and the
report session popped that stash into its own worktree and
discarded it with its other changes. The discount shipped
without the cap.
2026-06-08 docs: list the invoice rules
2026-06-16 feat: late fee on overdue invoices
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Coding Agent <agent@example.com>
2026-06-17 Revert "feat: late fee on overdue invoices"
The commit ends with a sign-off in the agent's name. Our
sign-off certifies the Developer Certificate of Origin, and
only a person can give that.
2026-06-18 feat: late fee on overdue invoices
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Robin <robin@example.com>Output verified in CI from site/examples/coding-with-agents/team-practice/history.py.
This example isn’t graded. Three of the commits take back or repair an earlier one, and their messages say what went wrong. You write the practice from them in the exercise at the end of the lesson.
The practice also changes when the mistakes change. When a review finds the same kind of mistake a second time, it gets a line, as the lesson on hooks and CI said. A rule whose reason is gone comes out, for example because the thing it guarded no longer exists. The Claude Code documentation advises reading the instructions files again from time to time to take out rules that are old or contradict each other. It adds that a longer file uses more context and the agent follows it less well [1].
This course’s repository keeps some of its rules for the agents that write lessons in its authoring guide, and several of them name the incident behind them. The rule that every number in the prose that a fixture can produce is pasted from its output has its reason next to it: in one group of agent branches, several had a number worked out by hand that the fixture contradicted. The rule to check every invented name comes from a made-up freight company that turned out to be real [4].
A year of practice
Section titled “A year of practice”A team's practice section has had the rule that agents never edit migrations/ for a year, and the project has no database and no migrations folder. This month, two agent pull requests edited the CI workflow file to skip a failing job.
The practice section has a rule that agents never edit migrations/,
written in the first week. The project has no database. This month two
agent pull requests changed the CI workflow file to skip a failing job.
What do you change in the practice?
Which rule has an incident behind it, and which one guards a folder the project doesn't have?
Say it in the file, check it where a script can
Section titled “Say it in the file, check it where a script can”The practice section draws together what this part of the course taught. Parallel sessions run in worktrees, each on its own branch, and leave alone what the clone and the machine have only once. CI integration makes one check the gate for every change, whoever wrote it. Team hooks stop an agent’s step before it happens. Review norms say what the author does before asking for a review and what the pull request says. Attribution names the agent in a trailer, and only a person signs off.
Each of these agreements goes in the file with its reason, so the people
and the agents know it. The file doesn’t enforce anything. The Claude
Code documentation says that the agent reads its instructions files as
guidance and that nothing in them is enforced. For an action that must
never happen, it recommends a PreToolUse hook, which runs before the
tool call and can stop it [1]. So an agreement that
must hold every time also gets a hook or a CI check, as the lesson on
hooks and CI showed. An agreement that needs a person’s judgment, such
as whether the author read every line, stays in the file and in the
review.
This course’s repository does both for the stash. Its page on
orchestration says that agents never run git stash in any worktree and
gives the reason, the one stash that all worktrees of a clone share. A
hook in the repository rejects the command [5].
Which rule does each incident support?
Section titled “Which rule does each incident support?”A team reads its last quarter of history and finds three incidents with coding agents. It has four candidate rules for its practice section, and wants each rule it keeps to have an incident behind it.
Match each incident to the rule it supports.
For each incident, which rule would have stopped that exact mistake? Is there a rule that no incident needs?
Does a check enforce it too?
Section titled “Does a check enforce it too?”A team is writing the practice section of its project instructions file. Every agreement goes in the file with its reason, and the team decides which of them also get a hook on agent commands or a CI check on every pull request.
Can a script decide the rule from the command the agent runs or from the files and messages in the pull request?
What a rule in the file has
Section titled “What a rule in the file has”A team adds rules to the practice section of its project instructions file, the file every agent session loads, after incidents with coding agents.
Which of these should a rule in the practice section have?
For each property, does it help a reader know why the rule is there and whether a change breaks it?
The agent pushed to main
Section titled “The agent pushed to main”A team agreed in a meeting that agents open a pull request for every change and never push to main. The agreement is written nowhere, and last week an agent session pushed a change straight to main.
What does the team change so that no agent session pushes to main again?
Which fix reaches every session, whoever starts it, and still holds when an agent ignores an instruction?
Forty rules from another team
Section titled “Forty rules from another team”A team is starting to use coding agents on its repository and has no written practice yet. Another team offers its practice section of forty rules, written for a different project.
The team has no written practice yet. What does it write?
Which lines can the team decide today, and where do the other lines come from?
Keep it or take it out?
Section titled “Keep it or take it out?”A team reviews the practice section of its project instructions file. Each item is a rule in that section, with what the team knows about it.
Does the rule still have a reason on this project today?
Exercise
Build the invoice project where you can read it with git. From
site/examples/coding-with-agents/team-practice/ in your clone of the
course repository, run this, with a folder name that doesn’t exist yet:
python3 history.py ~/invoicesIn ~/invoices, read the history with git log and each incident with
git show. Then rewrite the “Working with agents” section of AGENTS.md
there. Write one rule for each of the three incidents, precise enough
that a reviewer can tell whether a change breaks it, and give the date of
the commit it came from. Say after each rule whether a hook or a CI check
should also enforce it, and which one. Drop the rule that no incident
supports. Delete ~/invoices when you are done, and run the script again
to start over.
A good result has three rules, each tied to one of the two reverts or the fix, and none of them as vague as the draft’s lines. The rule with no incident behind it is gone, and the section is shorter than a screen. A colleague who reads only the section could say why each rule is there. Then answer one question: which rule of your own team’s practice could nobody tie to an incident or a decision, and what would happen if you took it out?
Stretch: Do the same for a repository your team uses with agents: read the last three months of history for reverts and fixes of agent work, and compare what you find with the practice section of its instructions file.
Recap
- Write the team’s practice for agent use in the project instructions file, where every person and every agent session reads it [1]. It says what agents may do and what every change passes, how agent work is attributed and reviewed, and which directories and commands are off limits.
- Make the gate and the attribution form decisions at the start. Write every other rule from an incident the team has seen, and name the incident next to the rule.
- Add a rule when a mistake comes back. Read the file again from time to time [1], and remove a rule when its reason is gone or no incident or day-one decision is behind it.
- The file states each agreement and its reason. An agreement that must hold every time also gets a hook or a CI check, and one that needs a person’s judgment stays with the review.
You can now
- Sets the team's practice for agent use
References
Section titled “References”- Anthropic. How Claude remembers your project. Claude Code documentation. Reference.
Claude Code memory - The AI Training contributors. Agent Instructions for ai-training. AI Training repository, AGENTS.md. Reference.
AI Training AGENTS - Anthropic. The AI-native SDLC playbook. Claude Academy. Course.
Academy ai-native-sdlc-playbook - The AI Training contributors. Writing a lesson. AI Training repository, docs/agents/writing-a-lesson.md. Reference.
AI Training writing-a-lesson - The AI Training contributors. Orchestrating agents. AI Training repository, docs/agents/orchestration.md. Reference.
AI Training orchestration