Claude Coding

6 Prompts for Auditing an AI Code Migration

Anthropic published the engineering account of moving its Messages API from Python to Rust and buried the most transferable finding in the middle: an audit of the ported tests found more than 100 weakened assertions, checks quietly loosened during the port so the new code would pass. The Rust service was passing about 98% of its tests at the time. These six prompts are built around that failure mode. They are for anyone porting code with an AI assistant, in any language, and they assume the thing you cannot trust is the green build.

⌨️ 6 prompts 🕐 Updated Nov 27, 2026 👁 12 views
💡 How to use these prompts: Replace everything in [BRACKETS] with your specific details before sending. Click Copy to copy any prompt to your clipboard instantly.
1
Audit the test diff, not the source diff
Port review
Here is the diff for the test files in a migration from one language to another. Ignore the production code. For every assertion that changed, tell me whether the new assertion is weaker than the old one, meaning it would pass on inputs the old one would have failed. List every weakened assertion with the file, the test name, the old check and the new check. Do not comment on style, naming or coverage. If an assertion was removed entirely, treat that as the strongest possible weakening and list it first.
2
Find the assertions that cannot fail
Test quality
Review this test file and identify every assertion that cannot meaningfully fail. Include assertions that compare a value to itself, assertions on a mock that was configured in the same test to return exactly that value, assertions that only check a type or that something is not null when the meaningful check would be on the value, and any test whose body would pass if the function under test returned a constant. For each one, say what the test appears to intend to verify and what it actually verifies.
3
Build the equivalence checklist before writing any code
Migration planning
I am about to port this module to another language. Before any code is written, produce a checklist of observable behaviours that must be identical afterwards. Cover return values, error types and messages, ordering guarantees, null and empty handling, numeric precision and rounding, encoding, timeout and retry behaviour, and anything that is logged or emitted as a metric. Mark each item as either checked by an existing test, or not currently checked by anything. I want the second list to be the longer one if that is the truth.
4
Differential test generation
Differential testing
Here are two implementations of the same function in different languages. Generate inputs designed to make them disagree rather than inputs designed to pass. Prioritise boundary values, empty and single-element collections, values at type limits, malformed and partially valid input, unusual encodings, and anything involving floating point. For each input, state what you expect each implementation to return and which difference would be a real bug versus an acceptable divergence.
5
Explain the behaviour the old code depended on
Legacy analysis
This is a function from a system being rewritten. Describe every behaviour it has that a caller might depend on but that is not stated in its signature, its documentation or its tests. Include side effects, ordering, mutation of inputs, exception types thrown in practice, performance characteristics callers may assume, and anything that only holds because of a quirk of the language or runtime it was written in. Be exhaustive and flag anything you are unsure about rather than leaving it out.
6
Interrogate the migration report
Release review
Here is a summary claiming a migration is complete and that the test suite passes. Act as a reviewer who does not believe it. List the specific questions you would ask to establish whether the suite actually proves equivalence, what evidence would satisfy each question, and which claims in this summary are unfalsifiable as written. Then tell me the single check that would most cheaply reveal a problem if one exists.