All guides0 of 11 answered
AI-Ready Software: Preparing Your Codebase for Coding Agents

AI copies what it sees. What will it see in your software?

Is your system old, hard to change, or on technology nobody supports anymore? See Bringing an Older System Up to Date →

AI now works in code as an assistant, an agent, a reviewer, a test writer and a migration tool. In software in good shape, these tools speed a team up. In messy software they produce more mess, faster. This guide shows what makes the difference and what to fix first. Most of it is the established basics of good software, and you can check each step with your technical lead.

  • About 15 minutes
  • Written for owners, useful for technical leads
  • Questions along the way are optional
  • Useful even if you never hire us

Updated

Background

What changes when AI works in your code

AI now works in code in several roles. Each of them learns from the code it finds.

RoleWhat it does
AssistantSuggests code while a developer types, or answers questions about the code
AgentTakes a task, such as “add a CSV export to the customer list”, and changes many files on its own
ReviewerComments on proposed changes before they are merged
Test writerWrites automated tests for existing code
Migration toolMoves code to a newer framework, language version or platform

These tools lean heavily on the examples they find in your code, and they can't know which of your patterns the team has stopped using. Birgitta Böckeler of Thoughtworks describes the risk: an assistant (Böckeler, 2023)

can become that developer on the team who keeps copying code from the bad examples in the codebase. (Böckeler, 2023)

When a team wants to move to a better way, the old way may still dominate the code, so the AI keeps suggesting it. (Böckeler, 2023)

Google's DORA research programme, which surveyed nearly 5,000 technology professionals in 2025, reached the same conclusion at the level of whole teams: (DORA, 2025)

AI doesn't fix a team; it amplifies what's already there. (DORA, 2025)

These questions are optional. Your answers shape the personal plan at the end and stay in this browser.

How old is your software?

Add a comment (optional)

How is AI used in your code, now or soon?

Choose all that apply.

Add a comment (optional)
Background

What messy code costs when AI works in it

Messy code was always expensive. With AI, part of that cost shows up on the invoice, and part in quality.

Most AI coding tools charge by usage or cap it, and usage grows with how much code they have to read. In large files they read far more than the lines they change. In an experiment published on martinfowler.com, an engineer split one 17,000-line file in a large Rust application into smaller parts. The same representative change then needed 83% less input for the AI. It was one experiment, on an application written by AI agents, and the cost of the split itself wasn't measured. The saving repeats on every later change to that part. (Edwards-Alexander, 2026)

So split where the code changes often. Those are the parts people struggle with too; the lower AI cost is one more reason, not the main one.

Quality suffers too. Research published in Transactions of the Association for Computational Linguistics found that language models use information in the middle of long inputs noticeably worse than information at the start or end. Anthropic's documentation for its coding agent says the same in practical terms: performance degrades as the working context fills up. (Liu et al., 2024) (Claude Code docs)

The hidden cost is understanding. Thoughtworks calls it codebase cognitive debt: “the growing gap between a system's implementation and a team's shared understanding of how and why it works.” When AI writes code faster than the team understands it, small changes start breaking things elsewhere. (Thoughtworks Radar, 2026)

DORA's 2025 report found that more AI use goes together with higher delivery throughput, but also with lower stability. DORA's explanation: without strong automated testing, mature version control and fast feedback, more changes lead to more instability. The next steps are those controls. (DORA, 2025)

Are there very large files that change often?

Add a comment (optional)
Step 1

Give the AI a safety net

Without automated tests, a coding agent has no way to tell whether its change works. It stops when the change looks finished.

With tests it can check its own work: make a change, run the tests, read the result, and keep fixing until they pass. Anthropic's documentation calls a check the AI can run (Claude Code docs)

the difference between a session you watch and one you walk away from. (Claude Code docs)

Tests pay off without AI as well. DORA's research links test automation to better software stability, less team burnout and lower deployment pain. (DORA)

Two things make this work:

  • Tests for the flows that matter most to the business: placing an order, sending an invoice, calculating a price. Start there, not with full coverage.
  • One command that builds the whole system and runs all the tests. If setting up takes a page of manual steps, neither a new colleague nor an agent can check their work.

If those tests are missing, AI can help write them, as long as a person reviews each test before it counts. Leave the rest of the code alone until they exist.

Watch the tests themselves. Kent Beck lists an agent “disabling or deleting tests” as a sign it is cheating. Have a person review every change to a test before it is merged. (Beck, 2025)

Are there automated tests the team trusts?

Add a comment (optional)

Can the whole system be built and tested with one command?

Add a comment (optional)
Step 2

Write down what the code can't tell

AI tools read the code, not your team's heads.

Conventions, decisions and known traps belong in a short instructions file that coding tools read at the start of every session. AGENTS.md is an open format for this, supported by many coding agents and stewarded by the Linux Foundation's Agentic AI Foundation. Its rule of thumb: “anything you'd tell a new teammate belongs here too.” Some tools use their own file name for it; most can be pointed at AGENTS.md. (AGENTS.md)

What belongs in it:

  • the commands to build, test and run the system
  • rules that differ from common practice, and the reason for them
  • decisions that are easy to get wrong, such as “all amounts are stored in cents”
  • parts of the system not to touch, and why

Keep it short. Anthropic's documentation for its own coding agent suggests asking of every line: “Would removing this cause Claude to make mistakes?” If not, cut it. Long files get ignored. (Claude Code docs)

Then let it grow from experience. Böckeler describes a team at OpenAI that treats every struggle of an agent as a signal: find what was missing, such as a tool, a check or a piece of documentation, and add it to the repository. (Böckeler, 2026)

Where do your conventions and decisions live?

Add a comment (optional)
Step 3

One clear way of doing things

If there are three ways to do the same thing, the AI copies whichever it sees most, which is often the old one.

Choose one way for common tasks, such as reading from the database, handling errors or adding a screen, and retire the others. Then give the AI a good example to follow. Böckeler, who keeps a reference application (a small project that shows the agreed patterns) for coding assistants to copy from, puts the principle simply: “providing LLMs with examples of the outputs that we want leads to better results.” (Böckeler, 2025)

Clear names, small parts and little duplication help as well. The Thoughtworks Technology Radar notes that AI assistants perform better on well-structured code, and that “good software design for humans also benefits AI.” (Thoughtworks Radar, 2025)

Is there one clear way to do common things?

Add a comment (optional)
Step 4

Rules that check themselves

Written instructions are advice. An AI may ignore them, and so may people. Automatic checks run every time.

Anthropic's documentation draws the same line: instructions files are advisory, while hooks (small scripts the tool runs automatically at set moments, for example after every edit) are deterministic and guarantee the action happens. (Claude Code docs)

Turn the rules that matter into checks that run on every change: formatting, forbidden dependencies, security scans, architecture rules such as “the web layer never talks to the database directly”. Böckeler calls the whole set of guides and checks around a coding agent its harness. (Böckeler, 2026)

Does every change go through automatic checks, such as formatting, security scans or rules about how the code is structured?

Add a comment (optional)
Step 5

Small, frequent changes

Small changes are easy to review and cheap to undo. That matters more when AI produces changes faster than people can read them.

DORA's AI Capabilities Model, built from interviews and the survey of nearly 5,000 professionals, lists working in small batches and strong version control practices (the system that records every change and lets you undo it) among seven capabilities that strengthen the benefits of AI. Frequent commits increased AI's positive effect on individual effectiveness, and teams that often used rollback (undoing a change) performed better with AI. (DORA, 2025)

In practice: changes that can be reviewed in one sitting, merged daily rather than after weeks, and an easy way back when something goes wrong.

How big is a typical change?

Add a comment (optional)
Step 6

Limit what AI tools can reach

Coding agents can run commands, install packages and reach other systems, with the rights of the developer who started them.

OWASP, the open security community behind the best-known web security lists, names this risk excessive agency: too much functionality, too many permissions or too much autonomy. Its advice is to give AI tools only the access a task needs, require a person's approval for high-impact actions, and log what they do. (OWASP)

Thoughtworks security specialists add: run agents in a sandbox to limit the damage, and treat their configuration files and plug-ins as part of your software supply chain. (Gumbley and Ryan)

Simon Willison names the dangerous combination: an AI tool with access to private data, exposure to untrusted content such as web pages, issues or other people's code, and a way to send data out. Text hidden in that content can give the agent instructions. Keep passwords, keys and production access out of the environment the agent runs in. Changes reach live systems only through your normal release process. (Willison, 2025)

Review what the AI writes as carefully as anything else. In a 2021 study presented at the IEEE Symposium on Security and Privacy, about 40% of 1,689 programs an AI assistant wrote for security-sensitive tasks contained weaknesses. In a later controlled study, people with an AI assistant wrote less secure code than those without one, and were more confident that it was secure. (Pearce et al., 2022) (Perry et al., 2023)

A specific trap: invented packagesAI models sometimes suggest software packages that don't exist. A study at the USENIX Security Symposium found that at least 5.2% of the packages named by commercial models, and 21.7% by open-source models, did not exist. Attackers can publish malicious packages under those invented names. Check every new dependency before it is installed. (Spracklen et al., 2025)

What can AI tools reach when they work in your code?

Add a comment (optional)
Step 7

Start with a pilot, and measure

Don't rely on how fast AI feels. Measure it.

Start with one part of the software that changes often and has tests. Measure before and after: time from task to release, rework, bugs found later, and the AI bill. Expand when the numbers, not the impressions, say it works.

Meanwhile, individual developers can try AI assistants in their own work, within the rules the team has agreed for AI.

What do you want first?

Add a comment (optional)
Checklist

Ready for AI in your code

A short list to go through with your technical lead.

  • Automated tests cover the flows that matter most, and the team trusts them.
  • One command builds and tests the whole system.
  • A short instructions file holds the conventions, decisions and traps.
  • There is one agreed way to do common things, with a good example.
  • The rules that matter are checked automatically on every change.
  • Changes are small and merged often.
  • AI tools run with limited rights, new dependencies are checked, and a person approves what ships.
  • The effect of AI is measured on one area before it is rolled out further.
Your result

What this would look like for you

Not enough answers

Answer a few questions first

Go back through the guide and answer what you can. The plan fills in as you go.

Related guides

Rather not do it alone?

You can stop here and use the plan yourself. Or hand some of it to us. Pick how you'd like to work:

Your answers and comments come with your request, so we don't ask twice. You get a short proposal within two working days, starting with a fixed-price first step. No obligation.

Sources

  1. DORA (Google Cloud) (2025). State of AI-assisted Software Development 2025. Google Cloud blog
  2. DORA (Google Cloud) (2025). Introducing DORA's inaugural AI Capabilities Model. Google Cloud blog
  3. DORA. Capabilities: Test automation. dora.dev
  4. Liu, N. F. et al. (2024). Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics
  5. Pearce, H. et al. (2022). Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions. IEEE Symposium on Security and Privacy 2022
  6. Perry, N., Srivastava, M., Kumar, D. and Boneh, D. (2023). Do Users Write More Insecure Code with AI Assistants?. ACM CCS 2023
  7. Spracklen, J. et al. (2025). We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs. USENIX Security Symposium 2025
  8. OWASP (2025). LLM06:2025 Excessive Agency. OWASP Top 10 for LLM Applications
  9. Agentic AI Foundation (Linux Foundation). AGENTS.md. agents.md
  10. Anthropic. Best practices for Claude Code. Claude Code documentation
  11. Beck, K. (2025). Augmented Coding: Beyond the Vibes. Software Design: Tidy First?
  12. Willison, S. (2025). The lethal trifecta for AI agents: private data, untrusted content, and external communication. simonwillison.net
  13. Böckeler, B. (2023). In-line assistance: how can it get in the way?. martinfowler.com
  14. Böckeler, B. (2025). Anchoring AI to a reference application. martinfowler.com
  15. Böckeler, B. (2026). Harness engineering: first thoughts. martinfowler.com
  16. Edwards-Alexander, G. (2026). The economic benefit of refactoring. martinfowler.com
  17. Gumbley, J. and Ryan, L.. Coding assistants threaten the software supply chain. martinfowler.com
  18. Thoughtworks (2025). AI-friendly code design. Technology Radar
  19. Thoughtworks (2026). Codebase cognitive debt. Technology Radar