Ask clearly

A clear request gets better work. Give the goal, the limits and an example.

AI cannot read your mind. It fills every gap with a guess, and a confident guess can look like a right answer. A good request leaves fewer gaps.

Weak requestClear request
Make a login pageReact login form with email and password. Show an error under each field. No new libraries.
Fix this bugThis function returns 0 for an empty cart but should return null. Here is the function and the failing test.
Make it fasterThis query takes 8 seconds on 2 lakh rows. Suggest an index and explain why it helps.

Four things to include

  • The goal: what should happen for the user.
  • The context: language, framework and the code it must fit into.
  • The limits: what must not change, and what to avoid.
  • An example: a sample input and the output you expect.

Work in small steps. One small request that you can check is better than one huge request that you cannot. If the answer is wrong, say exactly what is wrong instead of asking again in the same words.

โ† Your job when AI writes codeCheck before you trust โ†’