AI is changing the economics of software development.
When code generation becomes cheaper, the ability to verify generated code becomes increasingly important. This changes how we should think about software architecture, type systems, testing and CI/CD.
A codebase that is easy for an experienced developer to understand is not necessarily easy for an AI agent to work with. Similarly, a codebase with high test coverage is not necessarily a codebase in which an agent can safely make changes.
We need to think beyond code quality.
We need to think about AI agent readiness.
But what does that actually mean? And how could we measure it?
Traditional code quality assessments tend to focus on properties such as maintainability, complexity, duplication, test coverage and security.
These properties remain important, but they don't tell us the whole story.
An AI coding agent needs to do more than generate code. It needs to:
This introduces a different set of questions.
Can an agent understand the architecture without reconstructing it from thousands of files?
Can it determine whether a dependency violates an architectural boundary?
Can it distinguish between a meaningful test and a test that simply executes code?
Can it detect when its implementation is incorrect?
Most importantly, can it independently establish that its work is complete?
These questions suggest that AI agent readiness is a property of the entire software development environment, not simply the source code.
Let's explore how we could evaluate it in a TypeScript codebase.
The TypeScript compiler is one of the most important verification tools available to an AI agent.
Types communicate intent. They describe contracts, constrain implementations and make certain categories of mistakes detectable before runtime.
However, simply using TypeScript doesn't mean that a codebase has a strong type system.
Consider the following configuration:
{
"compilerOptions": {
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false
}
}
This provides relatively few guarantees.
A readiness assessment should examine:
any. unknown at external boundaries.
Tools such as TypeScript, typescript-eslint, type-coverage and tsd can provide much of the objective evidence.
The LLM's role is to interpret that evidence and identify places where the type system communicates less intent than it should.
For example, an agent should be able to distinguish between a legitimate type assertion at a trusted boundary and an assertion that simply suppresses a type error.
The objective isn't to eliminate every type assertion. It's to understand where the codebase relies on assumptions rather than guarantees.
TypeScript types disappear at runtime.
An API response, environment variable, database result or message from a queue doesn't become trustworthy simply because it has been assigned a TypeScript interface.
Consider:
interface User {
id: string;
email: string;
}
const user = await response.json() as User;
The compiler accepts this, but nothing guarantees that the response actually represents a valid User.
A readiness assessment should investigate whether untrusted data is validated at system boundaries.
This includes:
It should also examine whether runtime schemas and TypeScript types remain consistent.
Libraries such as Zod, Valibot, TypeBox and Ajv can help establish explicit runtime contracts.
The important question is whether an agent can determine where data enters the system and what guarantees are established before that data is used.
Architecture is often documented through conventions, diagrams and developer knowledge.
Unfortunately, conventions are easy to violate, particularly when an AI agent is modifying unfamiliar parts of a codebase.
Architecture should therefore be executable wherever possible.
For example, consider a layered architecture:
Presentation
|
Application
|
Domain
|
Infrastructure
The intended dependency direction might be:
Presentation -> Application -> Domain
Infrastructure -> Application / Domain
An agent should be able to discover these rules and verify that the actual dependency graph respects them.
A readiness assessment should check:
Tools such as dependency-cruiser, Madge, ESLint boundaries, Nx module boundaries and ArchUnitTS can make these rules executable.
Consider this dependency-cruiser configuration:
{
name: 'domain-must-not-depend-on-infrastructure',
from: {
path: '^src/domain'
},
to: {
path: '^src/infrastructure'
}
}
The specific configuration will vary, but the principle is important.
An architectural decision should ideally be represented by an automated constraint rather than relying exclusively on documentation.
For an AI agent, this turns architectural intent into something it can verify.
Test coverage is useful, but it is a relatively weak indicator of test quality.
A test can execute every line of a function without verifying that the function behaves correctly.
An agent readiness assessment should examine:
It should also inspect critical business logic separately from the overall coverage percentage.
For example, 90% overall coverage might look impressive, but what happens if the most important pricing calculation has no meaningful tests?
The objective is not simply to establish whether code is executed. It is to establish whether incorrect behaviour is detected.
Mutation testing is particularly interesting in the context of AI-generated code.
It addresses a question that ordinary coverage cannot answer:
Would the tests detect an incorrect implementation?
Mutation testing tools deliberately introduce small changes into the source code.
For example:
function isEligible(age: number): boolean {
return age >= 18;
}
A mutation might change the comparison:
function isEligible(age: number): boolean {
return age > 18;
}
If the test suite still passes, it may not adequately cover the boundary condition.
An assessment should examine:
StrykerJS is an excellent tool for mutation testing in TypeScript projects.
I would pay particular attention to mutation scores for critical business logic rather than relying exclusively on one aggregate percentage.
A codebase might have excellent overall mutation results while important business rules remain insufficiently protected.
Unit tests cannot establish that independently correct components work correctly together.
An agent needs confidence in the contracts between modules and external systems.
The assessment should investigate:
Tools such as Testcontainers, Pact, MSW, Supertest and Playwright can provide executable evidence