20 coding prompts that stop the AI guessing

Most bad AI code comes from the model filling in gaps you left. Each prompt here closes one: the model reads before it writes, tests before it fixes, and ranks its guesses out loud.

Swap anything in [brackets] for your own code, error or goal.

01. Map the blast radius before you touch anything

Before changing code you did not write.

Read the code below. Do not write or change any code yet.

Tell me:
1. What it does, in three sentences or fewer.
2. Every assumption it makes about its inputs, its callers and its environment.
3. What would break if I [describe the change you want to make], and where.

If you need to see another file to answer, name the file and stop.

[paste the code]

02. Rank the causes before anyone writes a fix

A bug you cannot explain yet.

Here is an error and the code around it.

List the three most likely causes, most likely first. For each one, give me the single log line or test that would confirm it or rule it out.

Do not propose a fix. I will run the checks and tell you which cause it was.

Error and stack trace:
[paste the error]

Code:
[paste the relevant code]

03. Write the failing tests, then stop

Before you ask for new code or a fix.

Write tests for [function or feature] using [test framework].

Cover the normal case, these edge cases: [list any you already know], and at least two cases you think I have not considered. Say in one line why each of those two matters.

Every test should fail against the current code or a missing implementation. Do not write the implementation.

Unlock the other 17 prompts for free

Sign up for the Whizi newsletter to read the rest of this pack.

  1. Review the diff as the person who gets paged
  2. Refactor without changing a single behavior
  3. Pick the five files to read first
  4. Write the query against your real schema
  5. Get a regex with the cases that prove it
  6. Port code so it reads like a native wrote it
  7. Find where the time goes from a real profile
  8. Trace untrusted input from source to sink
  9. Write the README a stranger can use
  10. Write the commit message from the diff
  11. Learn a concept using your own code
  12. Design the API, then attack the design
  13. Plan a migration that never takes the site down
  14. Make the model ask the questions
  15. List the inputs that will break it
  16. Find what a dependency upgrade breaks in your code
  17. Ask a second model to grade the first