Sub topic 1
Why a team needs an AI-assisted code policy
Prerequisites
This chapter assumes you know the basic Git and pull request workflow. It also assumes you have taken part in code review on a team, have used an AI coding assistant or chat tool at least a few times, and know roughly what a CI pipeline does. You do not need to have written a policy before.
The problem: individual choices add up
On most teams, AI tools arrive one developer at a time. One person pastes a stack trace into a chat tool. Another lets an assistant edit files in the repository. A third installs a plugin nobody else knows about. Each choice looks small. Together they create a team that has no shared answer to basic questions:
- Which tools may we use, and with which settings?
- What may we paste into them?
- Who is responsible when generated code breaks something?
- Does a reviewer need to know that a tool wrote part of a change?
Without answers, each developer guesses. Guesses differ, and the differences show up later as inconsistent reviews, surprise security findings, and arguments after an incident.
What a policy does
A policy is a short, written agreement about how the team uses AI tools. It does three things.
- It sets limits. It names allowed, restricted, and prohibited uses, so nobody has to decide alone whether something is acceptable.
- It assigns responsibility. It states that the human who submits a change owns it, whatever tool produced it.
- It makes the rules checkable. Where possible, tools enforce a rule instead of relying on memory.
A policy is not a ban, and it is not a promise that AI output is good. Its goal is to let the team use the tools with known limits, so speed gains do not come at the cost of quality, security, or trust.
Why existing practices are not enough
Your team probably already has code review, tests, and a security process. These still apply to AI-assisted code. But AI tools change the situation in ways that existing habits do not cover.
| Change | Why existing habits fall short |
|---|---|
| Code is produced faster than it is read | Review capacity becomes the bottleneck, and reviewers may skim large diffs |
| Output looks confident and polished | Wrong code is harder to spot by style alone |
| Input leaves your environment | Prompts may carry source code, secrets, or customer data to an outside service |
| Authorship is blurred | Nobody is sure whether "the tool wrote it" changes who must answer for it |
| Agentic tools act, not just suggest | They can run commands and edit files without a person typing each step |
Each row maps to a later chapter. For now, notice the pattern: the old rules assume a human wrote and understood every line. A policy restates those rules for a world where that is no longer guaranteed.
How the pieces fit together
A good policy has layers. Written rules come first. Review and disclosure habits support them. Automated checks enforce what can be enforced.
The loop at the end matters. Tools and risks change quickly, so a policy that is never revised becomes either irrelevant or ignored.
A first taste of enforcement
Some rules can be written down once and enforced by the repository. A CODEOWNERS file, for example, requires named reviewers for sensitive paths, whoever wrote the code.
# .github/CODEOWNERS
# Changes to these paths always need review from the named owners,
# no matter how the code was written.
/auth/ @example-org/security-team
/payments/ @example-org/payments-team
/.github/ @example-org/platform-team
/docs/policies/ @example-org/engineering-leadsNothing in this file mentions AI. That is the point: the strongest rules often apply to all changes equally, so the policy does not depend on anyone noticing how a change was made.
Common mistakes
- Writing only a ban. People keep using the tools, but now they hide it. You lose visibility and the chance to set safe defaults.
- Writing only encouragement. "Use good judgment" gives no guidance on data, review, or accountability.
- Relying on memory. Rules that no check enforces drift as the team gets busy.
- Treating the policy as finished. Without a revision process, the document ages.
Exercise
A teammate says, "We already have code review, so we don't need an AI policy." Give two reasons that answer is incomplete.
Show answer
Any two of these: AI tools send input (code, secrets, customer data) outside your environment, and code review cannot see that. Generated code arrives faster and looks polished, so reviewers may skim it. Authorship and responsibility become unclear unless the team states that the author owns the change. Agentic tools can run commands and edit files, which review of the final diff does not govern.
Exercise
Why does the chapter say the strongest rules often do not mention AI at all? Name one example from this chapter.
Show answer
Rules that apply to every change, such as a CODEOWNERS file requiring named reviewers for sensitive paths, work whether or not anyone notices or reports that a tool was used. They do not depend on honest or accurate disclosure.