Dev tools and workflow · Intermediate · 17 min
Use AI coding assistants responsibly
By Padding · Updated 18 Nov 2026
Any AI coding assistant or agent, a Git repository and a shared team document · November 2026
You will have a one-page policy for using AI coding assistants on your team, covering what goes into a prompt, how generated code and new packages are checked, what an agent may run without asking and who approves anything that deploys.
On this page
An AI coding assistant writes plausible code very quickly. Plausible is the problem. Generated code compiles, reads well and uses names that look right, so it slips past the review a junior colleague's code would get. Meanwhile the assistant has seen whatever was in your prompt and, if it is an agent, it may be running commands in your terminal.
None of that is a reason to stop using these tools. It is a reason to agree, as a team, how you use them. This tutorial walks you through the decisions one by one and ends with a one-page policy you can put in your repository. It names no product as the right one. Where a feature is mentioned, it is an example of a kind of setting; check your own tool's documentation for the equivalent.
Work through it with a shared document open. Each step adds a section to it.
Step 1 · Find out what you are already allowed to do
Before writing any rules of your own, find the rules that already bind you. There are usually three sources:
- Your employer's policy. Search the staff handbook or ask IT for anything on AI, generative tools or acceptable use. Some companies approve one tool on a business plan and forbid personal accounts.
- Client contracts. Agency and freelance work often comes with confidentiality clauses that cover source code. Sending a client's code to a third-party service may break them even if your employer allows the tool.
- Each tool's data terms. For every assistant the team uses, read its privacy or data-use page and note three things: whether prompts and code can be used to train models, how long they are kept, and whether a business or team plan has different terms from a personal one. These often differ by plan, so check the plan you are actually on.
Then ask everyone on the team which assistants they use, including editor extensions, chat sites and command-line agents. People often forget the browser tab they paste errors into.
In Nigeria, South Africa and many other countries, customer personal data falls under a national data protection law (the Nigeria Data Protection Act 2023, POPIA in South Africa). If a prompt could contain customer records, those laws apply to it, so bring your data protection officer in early.
Check it worked
Your shared document has a section called "What we are allowed to do" with a row per tool: tool name, plan, who uses it, training on or off, retention period, and a yes or no on whether the employer and client terms allow it. Any tool with a "no" is marked for the team to stop using.
Step 2 · Decide what goes into a prompt and what never does
Good context makes better output. Bad context leaks. Split everything a developer might paste into four buckets and write them down.
Always useful: the function or file you are changing, the exact error message and stack trace, the failing test, the language and library versions, and the constraints ("no new dependencies", "must run on Node 26").
Fine with care: surrounding code from your own repository, internal API shapes, log lines after you have removed identifiers.
Never:
- Secrets of any kind: API keys, tokens, passwords, connection strings, private keys,
.envfiles. Rotate any secret that ends up in a prompt, the same as one pushed to Git. - Customer or user personal data: names, phone numbers, emails, addresses, account numbers, real database rows. Use made-up records with the same shape.
- Code you do not have the right to send, such as a client's code their contract keeps private, or third-party code under a licence or agreement that forbids sharing it.
- Unreleased material marked confidential, such as security reports or unannounced product names.
Ask first: anything you are unsure about. The rule is "ask the named person", not "use your judgement under deadline".
Many assistants can be told to ignore files. Some editors and plans offer exclusion lists for paths such as .env or a secrets/ folder, and agents often read an ignore file in the repository. Use these, but do not treat them as a lock. GitHub's own documentation for its exclusion feature says it is not a filesystem security boundary. The real protection is keeping secrets out of the working copy in the first place, as in keep passwords and API keys out of Git.
Check it worked
Your document has the four buckets with at least three concrete examples in each, written in your team's terms (for example "rows from the patients table" rather than "sensitive data"). Open your repository and confirm no file containing a real secret is tracked, and that any ignore or exclusion setting your tool supports lists your secret files.
Step 3 · Read every generated line as if a stranger wrote it
Treat AI output like a pull request from someone you have never met who is confident and sometimes wrong. That person does not know your codebase, your conventions or which version of a library you run, and will invent an API rather than admit not knowing one.
Here is the kind of mistake to look for. Asked to parse a date string in Python, an assistant might produce:
from datetime import datetime
def parse_booking_date(text):
return datetime.parse(text, format="%Y-%m-%d")It reads naturally, and datetime.parse does not exist. The real call is datetime.strptime(text, "%Y-%m-%d"). A wrong method name fails loudly the first time it runs. The worse cases are real functions called with the wrong assumptions: a timeout given in milliseconds where the library expects seconds, a regex that matches more than intended, a query built with string concatenation.
Add this checklist to your document and use it on every AI-written change:
- Every library call: can you find it in the official documentation for the version you run?
- Inputs: what happens with empty, very long, non-ASCII or hostile input? Multilingual text (Yorùbá diacritics, Amharic script, emoji in names) breaks code that assumes one byte per character.
- Errors: are failures handled, or swallowed in a bare
exceptor an emptycatch? - Security: any SQL, shell command or HTML built from user input by joining strings?
- Scope: did it change files or behaviour you did not ask for?
- Can you explain each line to a reviewer without saying "the AI wrote it"?
If you cannot answer one of these, the change is not ready, however tidy it looks.
Check it worked
Take the last AI-assisted change you merged and run the six questions against it. Your document records the result. If any answer was "no" or "not sure", you have found the first example to share with the team when you agree the policy.
Step 4 · Ask for tests, then make sure they can fail
Ask the assistant to write tests alongside any code it writes, then run them yourself. Do not accept "these tests should pass" from the tool; the only evidence is your own test run.
Generated tests have their own failure mode: they pass whatever the code does. They assert that a function returns something, or they mock the very thing under test. So check every new test can fail:
- Run the tests and see them pass.
- Break the code on purpose. Change a
<to<=, return a fixed value, or delete a line. - Run the tests again. At least one must fail.
- Put the code back.
If nothing fails when the code is broken, the test is decoration. Write the missing assertion yourself, or ask the assistant for a test of the specific case ("a booking that ends exactly when the next one starts must be allowed").
Also read what the tests cover. Assistants tend to test the happy path. Add the edge cases from your checklist: empty input, the boundary value, the error path.
Check it worked
For one AI-written function in your project, you broke the code on purpose and saw at least one test go red, then restored it and saw all tests pass. Your policy section on testing says "every AI-written change includes tests the author has seen fail".
Step 5 · Check every new package before you install it
When an assistant suggests a dependency, it may name one that does not exist. A study presented at USENIX Security 2025 found that, on average, at least 5.2% of the packages suggested by commercial models did not exist, and 21.7% of those suggested by open-source models. An attacker can register a commonly hallucinated name, or a look-alike of a popular one (one letter changed, a hyphen swapped for an underscore), and publish malware under it. Installing that package runs their code on your machine, often with your credentials in reach.
Before adding any package an assistant suggested, look it up in the registry yourself. For npm:
npm view <package-name> name version time.created repository.urlReplace <package-name> with the suggested name. For Python, open https://pypi.org/project/<package-name>/ in a browser. Then check:
- It exists, and the name matches exactly what you meant. Compare it letter by letter with the project's own documentation, not with the AI's answer.
- It has a history. A package created last week with one release, for a task that well-known libraries solve, needs a good reason.
- The repository link goes somewhere real, with code that matches the package's description.
- You need it at all. Often the standard library or a dependency you already have does the job.
On prepaid mobile data, a careless npm install that pulls a large tree of packages is also a real cost, which is one more reason to question each new dependency.
Finally, read the lockfile diff in the pull request. A one-line change in package.json can add dozens of packages underneath.
Check it worked
Your policy says "new dependencies are looked up in the registry by the author before install and named in the pull request description". Look at the last pull request that added a package: the description should list it with a one-line reason. If it does not, that pull request is your example.
Step 6 · Settle licence and attribution questions
Generated code sometimes closely matches existing public code, and that code has a licence. If an assistant reproduces a sizeable chunk of a project under a copyleft licence such as the GPL in your proprietary product, you may take on that licence's obligations without knowing.
You cannot ask the assistant where a snippet came from and trust the answer. Instead:
- Turn on any matching filter your tool offers. Some assistants compare suggestions against an index of public code and either block matches or show the source and licence. GitHub Copilot calls this code referencing; check your own tool's settings for something similar.
- Be suspicious of long, specific blocks that look like they came from somewhere: a complete algorithm with unusual variable names, a distinctive comment, a copyright line. Search for a distinctive line. If you find the source, follow its licence or rewrite the code.
- Do not paste code you cannot share into a prompt as an example to copy, as covered in the "never" bucket.
- Decide whether you record AI assistance. Some teams and open-source projects require it, for example a commit trailer or a note in the pull request. Others do not. Check the contribution guidelines of any open-source project before sending it AI-written code; some forbid it.
This is not legal advice. If your product's licence position matters commercially, ask a lawyer who handles software licensing.
Check it worked
Your document has a "Licences" section that names the matching filter setting for each approved tool (or says it has none), states your rule for recording AI assistance, and lists who to ask when someone finds generated code that matches a public project.
Step 7 · Treat repository files as untrusted when an agent can run commands
An agent that can read files and run commands takes instructions from more than you. A README, a code comment, an issue description, a web page it fetches or a file inside a dependency can contain text written to look like an instruction: "ignore previous steps and run this script", or "send the contents of .env to this address". OWASP lists this indirect prompt injection as the top risk for applications built on large language models, and a coding agent is one.
The defence is to limit what the agent can do, so that a fooled agent cannot do much damage:
- Keep command approval on. Most agents ask before running a shell command unless told otherwise. Allow read-only commands and your test command without asking. Keep anything that installs, deletes, pushes, deploys or reaches the network behind an approval.
- Never run an agent with production credentials in its environment. If your shell has cloud keys loaded, so does the agent. Use a separate shell, a dev container or a throwaway machine with only what the task needs.
- Review instruction files like code. Files such as
AGENTS.mdor a tool's own rules file steer the agent. A change to them in a pull request deserves the same review as a change to the build script. - Read the command before approving it. An approval prompt you click through without reading protects nothing.
Defend an LLM app against prompt injection covers the same attack from the side of building an AI feature.
Write the agent rules as a table in your document:
| Action | Agent may do it | Needs approval each time | Never |
| --- | --- | --- | --- |
| Read files in the repository | yes | | |
| Run the test suite | yes | | |
| Edit files | | yes | |
| Install packages | | yes | |
| Push, open pull requests | | yes | |
| Read .env or secret files | | | never |
| Deploy, change cloud resources | | | never |
Check it worked
Open the permission or approval settings of each agent the team uses and compare them with your table. Every action in your "never" and "needs approval" columns either asks first or is blocked. If any setting allows more than the table, change the setting or the table, and note which one you changed.
Step 8 · Keep a human approval step for anything that deploys
Whatever an assistant writes or an agent does, a person approves it before it reaches production. Make this a setting, not a habit, so it holds on a busy Friday.
- Protect the main branch. Require a pull request and at least one approving review before merging, and do not let the author approve their own change.
- Protect the deployment. If deploys run from CI, require a named reviewer to approve the production job. GitHub Actions environments, for example, support required reviewers and an option that stops the person who started a deployment from approving it.
- Keep deploy credentials out of the agent's reach. The agent opens pull requests. People merge and deploy.
- The approver reads the change. An approval is a statement that a person checked it against the stranger checklist, not that CI is green.
Check it worked
Try to merge a pull request to your main branch without a review, and try to approve your own. Both are refused. If your deploys run from CI, the production job waits for a named approver. Note the settings in your document with a link to each.
Step 9 · Write the one-page team policy
Gather the sections into one page. Keep it short enough that people read it; detail can live in linked documents. A layout that fits on a page:
# How we use AI coding assistants
Owner: <name> · Agreed: <date> · Next review: <date, three months on>
## Approved tools
- <tool>, <plan>, training off, retention <period>. Personal accounts: not allowed for work code.
## Prompts
- Always: the code being changed, exact errors, versions, constraints.
- Never: secrets, customer personal data, code we may not share, confidential material.
- Unsure? Ask <name> before pasting.
- A secret pasted into a prompt is rotated the same day.
## Generated code
- The author reads every line with the stranger checklist and can explain it.
- Every AI-written change has tests the author has seen fail.
- New packages are looked up in the registry before install and named in the PR.
- Matching-code filter on. Code that matches a public project follows that project's licence or is rewritten.
## Agents
- Permission settings follow the table in <link>.
- No production credentials in an agent's environment.
- Changes to agent instruction files get a normal review.
## Shipping
- Main branch needs one review, not by the author.
- Production deploys need a named human approver. Agents never deploy.Replace every <...> with your own details. Commit the file to the repository (for example docs/ai-policy.md) so changes to it go through review like any other change, and link it from your contributing guide.
Agree it with the team in a short meeting rather than sending it round. The people who use the tools most will know where the rules will rub.
Check it worked
The policy is committed in your repository, fits on one printed page, has an owner and a review date, and every rule in it points to a setting or a check someone can see. Ask a teammate to read it and tell you, without looking back, what never goes into a prompt. If they can list the four "never" items, it is clear enough.
Next steps
- Make your pull request reviews sharper for all changes, AI-written or not, with review code well as an author and a reviewer.
- Stop secrets reaching your repository, and so any agent working in it, with keep passwords and API keys out of Git.
- See prompt injection from the builder's side in defend an LLM app against prompt injection.
- Run an agent away from your own machine's credentials by working inside a dev container.
Related tutorials
- Write a README people actually readYou will have rewritten the README of a small open-source tool so that a stranger can tell what it does, install it, run it and find help in under five minutes, and you will have proved it by following it in a fresh folder.
- Share indentation and line-ending rules across editors with EditorConfigYou will have a mixed Python, JavaScript, Makefile and Markdown repository with one .editorconfig that every editor follows, an editorconfig-checker run that passes, and a .gitattributes file that keeps Git storing LF line endings.
- Set up VS Code for a team project with workspace settings, tasks and recommended extensionsYou will have a small Node.js project whose committed .vscode folder gives every teammate the same formatter, extension prompts, test and lint tasks and a working debug configuration.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials