Can AI write your data quality tests?

Yes. An AI model reading a real data profile can write useful business-rule tests in minutes. In DataKitchen's 2026 NYC taxi test, 62 generated tests passed on a 300,000-row sample, while seven rules an AI wrote failed on the sample and on all 2,964,624 trips. A person still checks the rules, and a deterministic tool, not the model, runs them.

Key points

  • In DataKitchen's August 2026 NYC taxi test, TestGen generated 62 tests that all passed on a 300,000-row sample, because the minimum-fare test set its floor at negative $367, the lowest fare present.
  • Seven business-rule tests written by an AI reading the profile failed on the sample and again on the full 2,964,624 rows, finding 171,627 trips with zero or null passengers and 37,448 with a negative fare.
  • On the full month, 11 of 69 tests failed: the 7 AI-written rules plus 4 generated minimum-value tests that caught values more extreme than anything in the sample.
  • In DataKitchen's September 2026 CMS Open Payments test, 16 rule tests written from the regulations kept working when moved from Massachusetts to the national file, while 33 of 353 generated tests broke because their thresholds came from the sample.
  • An agent should never grade its own homework: the model writes and reads the tests, and a deterministic tool it doesn't control runs them against real rows.

An AI writes a different kind of test than a profiler does. You want both.

What happened when an AI wrote the rules

In August 2026, DataKitchen pointed Claude Code at the January 2024 NYC yellow taxi trips through TestGen’s MCP server. TestGen profiled the data and generated 62 tests from a 300,000-row sample. All 62 passed. The generated minimum-value test for fare_amount set its floor at negative $367, because that was the lowest fare in the sample, so negative fares looked normal.

Then the model read the profile and wrote seven business rules in SQL, nobody dictating them. All seven failed on the sample. On the full 2,964,624 rows, the run had 69 tests, 11 failures, and 2 warnings:

TestWritten bySample (300,000 rows)Full month (2,964,624 rows)
62 generated testsTestGen, from the profileAll passed4 minimum-value tests failed
Passengers at least 1AI17,477 failing rows171,627 failing rows
Payment code in the documented rangeAI14,252 failing rows140,162 failing rows
Fare not negative, plus 4 more rulesAIAll failedAll failed, including 37,448 negative fares

The four generated failures on the full month were real too: records more extreme than anything the sample held. That’s the generated tests doing their job, which is catching change. The AI rules catch what’s wrong today.

The pattern held on regulated data

In September 2026, the same setup ran against 15.5 million CMS Open Payments records. TestGen generated 353 tests on the Massachusetts rows and 349 passed, including on payment dates in the year 2. Sixteen SQL tests, written in a Claude Code session from the federal reporting rule, the 2020 OIG speaker-program alert, the industry codes, and the Massachusetts gift ban, flagged 92 entertainment payments and 91 meals over $500 per person in Massachusetts alone.

The useful detail came next. Moving the 353 generated tests to the national table broke 33 of them, because their thresholds came from the Massachusetts sample. The 16 rule tests didn’t break. Their thresholds came from the law.

Where AI-written tests stop

A model knows what a taxi is because taxis are public knowledge. It doesn’t know what “active” means in your billing system, or which day your finance team closes the month. Those rules live in someone else’s head. The model is still useful there, as a drafter. Show an analyst a rule to correct and she fixes it in seconds. Send her a blank template and you get four rows back, two of which say the data should be accurate.

And never let the agent grade its own homework. That’s the rule behind all seven sins of AI-generated pipelines. The model writes the tests and reads the results. A deterministic tool runs them against real rows and returns the same answer on the same data every time. When an LLM gets root cause wrong, the most common failure is misread evidence, and deterministic results are the correction.

How to try it this afternoon

Install open-source TestGen, turn on its MCP server, and connect the AI client you already use. Ask for a profile and a generated suite first. Then ask the model to read the profile and write tests for the things that can’t be true in your data. Check its rules against the raw table before you trust a single one.

Frequently asked questions

Short answers to the follow-up questions people ask next.

Can ChatGPT or Claude write data quality tests?

Yes, when the model can read a real profile of the data rather than guessing from column names. In DataKitchen's NYC taxi test, Claude Code read a TestGen profile over MCP and wrote seven business-rule tests in SQL, covering negative fares, zero passengers, impossible distances, and dropoffs before pickups. All seven failed, on a 300,000-row sample and on the full 2,964,624 rows.

Why do AI-written tests catch errors that generated tests miss?

Because generated tests learn what the data already looks like, and a model brings knowledge about the world. TestGen's generated minimum-fare test on NYC taxi data set its floor at negative $367, the lowest fare present, so negative fares passed. A model knows a taxi fare can't be negative and that no cab ride covers 312,722 miles.

Should I let an AI agent run and pass its own tests?

No. An agent should never grade its own homework. Let the model write tests and read results, and let a deterministic test tool it doesn't control run them against real rows, returning the same result on the same data every time. The most common failure in LLM root cause analysis is misread evidence, and ground truth from deterministic tests corrects it.

Can AI replace the business analyst in writing data quality rules?

Not fully. A model knows public facts, such as what a taxi is. Your rules about your own customers, contracts, and calendars usually live in someone's head. AI helps most by drafting rules from the profile for that person to correct, because showing an analyst an existing rule to fix works in seconds, while a blank template comes back nearly empty.

What do I need to let an AI write tests against my data?

A test tool your AI client can reach. Open-source DataOps TestGen ships a Model Context Protocol server with 96 tools, so Claude, Claude Code, Cursor, or Copilot can read profiles, create tests, and run them, with every tool running under the user's existing TestGen role. Start with triage before you let the model change anything.

Try it on your own data

DataOps TestGen is free and open source. Profile a table and generate its tests this afternoon.