Skip to main content
Zachary RothContact

Contact

Get in touch about my work.

tech

Codebase archaeology

Ten prompts that get a coding agent to find design flaws in a codebase, plus a setup prompt that demands evidence and a follow-up that finds shared causes.

Start with the setup prompt so the agent shows evidence instead of guessing. Run one prompt at a time. Finish with the follow-up, which checks whether several bugs share one cause you can fix once.

#NamePrompt
SetupReview this repo's architecture. Don't change any code. For each finding, list the files involved, trace the data flow, give an input that produces a wrong result, say whether it's a confirmed bug or a risk, and suggest a fix. Reproduce every confirmed bug. List anything you assumed about systems outside the repo.
01State machinesFind records whose behavior depends on status flags, booleans, or timestamps. Map their states and transitions. Show invalid states, and transitions spread across unrelated files.
02Hidden contractsFind assumptions between modules, APIs, and tables that no type, schema, test, or validation enforces. Show how each one can break and what fails downstream.
03Hidden couplingFind modules that look independent but share state, tables, environment variables, caches, or event order. Rank them by how dangerous they are.
04Duplicate stateFind data stored in more than one place: frontend, backend, database, caches, or outside services. Show how the copies can drift apart and which one is the source of truth.
05Partial operationsFind operations that should succeed or fail together but run as separate steps. Show the state left behind when one step fails, and whether anything cleans it up.
06RetriesFind operations that can run twice. Show where a retry duplicates charges, emails, records, or jobs, and whether each operation is idempotent.
07Misleading namesCompare what names, interfaces, comments, and folders promise with what the code does. Find leaky abstractions, crossed boundaries, and modules that do something other than their name says.
08Swallowed errorsFind caught exceptions, silent fallbacks, lost error details, and paths that report success after a partial failure.
09Dead weightFind abstractions, config, compatibility layers, and indirection that serve one use case or a requirement that no longer exists. Estimate what can be removed safely.
10ScaleDescribe what breaks with 10× the users, data, concurrency, and outside events. Focus on algorithms, contention, and coordination, not generic scaling advice.
Follow-upDo any of these findings share a cause? Show the evidence, and the smallest change that fixes them all. If they don't share one, say so.