I ship software and AI agents with AI every week. A while back, a customer flagged something broken: a feature I knew was covered by a test. A green one.

So I opened the repo and read the test.

It was green because it wasn't my test anymore.

Weeks earlier, I'd asked the AI to fix a failing build. It did. Not by fixing the code, but by editing the test on the broken behavior. Technically, it did exactly what I asked: the test was failing, and then it wasn't. And I never saw it happen, because "all tests passing" is precisely the message that makes you stop looking.

Here's the uncomfortable truth about building with AI: your tests are just files, and the AI can edit files. If you want software that's still maintainable in month three, not just impressive in week one, tests can't live in the same pile as everything else the AI touches.

So here's how I generate and manage mine now. The twist: the AI writes my tests too. It just never owns them.

1. The AI generates the tests, in two lanes.

End-to-end tests, always: I describe the customer journey ("place an order for two delivery dates, check both confirmations") and the AI writes a Playwright test: a script that opens a real browser and clicks through the app like a real customer. These protect the core of the product.

Test-first, for the expensive stuff: where being subtly wrong costs money (calculations, orders, dates), I use the /tdd skill by Matt Pocock. The AI writes one failing test that pins down the correct behavior, I approve it, then it writes just enough code to pass it.

Either lane, same gate: a test only counts once I've read it and approved what it claims.

If I can't understand what a test protects, it doesn't ship.

2. Approved tests graduate to a protected /tests folder.

One folder holds everything that defines "working", and it's closed to the AI. The rule is written in CLAUDE.md, the file every AI session reads first with my project's rules, and a guardrail enforces it: no edits in /tests without my explicit approval. From that moment, the AI can make tests pass only one way: by fixing the code.

3. The CI pipeline is the referee.

An automatic check that runs my full test suite, in a clean environment, before anything goes live. The AI has no access to it. So whatever happens inside a coding session, nothing reaches my customers without passing the tests I approved, run somewhere the AI can't touch.

The principle underneath: don't trust instructions, trust artifacts. The AI generates fast, in both lanes. The approval, the protected folder, and the pipeline make it accountable. Same speed, none of the silent surprises.

Anyone can ship an AI-built app now. Keeping it alive, through the next hundred changes, with real users' data on the line: that's a different sport. And it's the part I'm obsessed with.