Sub topic 1
Why a Team Needs an AI-Assisted Code Policy
Prerequisites
Assume you know basic Git, pull requests, code review, and continuous integration (CI). You should also have used an AI coding assistant or chat tool.
Why a Policy Matters
An AI-assisted code policy defines how a team may use AI tools while keeping humans responsible for the result. Without a shared policy, developers make inconsistent decisions about sensitive data, testing, review, and tool permissions.
The policy should make three things clear:
- Which uses are allowed.
- Which uses require extra approval or safeguards.
- Which uses are prohibited.
A policy should support useful work without treating AI output as trusted code.
Main Risks
AI-generated code can look reasonable while containing incorrect logic, insecure defaults, missing error handling, or outdated dependencies. The human author must understand and test every line before merging it.
AI tools can also expose data through prompts, uploaded files, logs, or retained conversation history. A prompt containing a credential, customer record, or private source file may create a confidentiality incident.
Licensing and intellectual property (IP) create another risk. Generated code may resemble material from training data or include dependencies with incompatible licenses. Teams should review provenance, dependency licenses, and repository policies before distributing the result.
Allowed, Restricted, and Prohibited Uses
| Category | Example | Required control |
|---|---|---|
| Allowed | Explain public documentation or draft tests for non-sensitive code | Normal review and testing |
| Restricted | Modify authentication code or use an approved tool with private repository context | Security review and approved configuration |
| Prohibited | Send secrets or customer data to an unapproved tool | Do not perform the action |
Restricted work should name the approver and required checks. Prohibited work should be unambiguous so that delivery pressure cannot redefine the rule.
Data Sharing Rules
Share only the minimum data needed for the task. Use an organization-approved tool with suitable retention and training settings. Remove credentials, tokens, personal data, customer content, and unrelated proprietary code. Prefer synthetic examples, small excerpts, and local tools when confidentiality is uncertain.
The policy should define who approves exceptions and how a suspected disclosure is reported.
Exercise
A developer wants an AI assistant to debug a production error and plans to paste logs containing email addresses and an access token. What should they do?
Show answer
Stop, remove the token and personal data, and use an approved workflow with sanitized or synthetic logs. Report the exposure if the data was already sent.