Describe It Well: Prompts That Produce Working Code

Describe It Well: Prompts That Produce Working Code 1
⏱ 2 min readUpdated 13 October 2026

πŸ“˜ Vibe Coding Course Β· Lesson 3 of 6

In this article
  1. The six-part description
  2. Before
  3. After
  4. When something is wrong
  5. Ask for explanations

The quality of AI-written code depends mostly on the quality of your description. Here is a template that works.

Advertisement

The six-part description

  1. Goal β€” one sentence: what problem does this solve?
  2. Input β€” file type, where it is, a sample.
  3. Output β€” exact file name, columns, format.
  4. Rules β€” every business rule, written as a list.
  5. Examples β€” 2–3 input rows and the output you expect.
  6. Done when β€” how you will check it.

Before

Make a script to clean my vendor file.

After

Goal: clean the monthly vendor export so it can be loaded into Tally.
Input: sample/vendors.csv (UTF-8, comma separated, header row).
Output: output/vendors_clean.csv with columns Name, GSTIN, State, Phone.
Rules:
- Trim spaces; Name in Title Case.
- GSTIN: 15 characters, uppercase; if invalid, keep it but add "CHECK" in a new Remarks column.
- State: derive from the first two digits of GSTIN (27 = Maharashtra, 07 = Delhi, ...).
- Phone: digits only, keep the last 10.
- Remove exact duplicate rows; keep the first.
Example: " acme traders ","27aapfa1234b1z5",... -> "Acme Traders","27AAPFA1234B1Z5","Maharashtra",...
Done when: running it on sample/vendors.csv gives exactly expected/vendors_clean.csv.

The second prompt takes three minutes longer to write and saves an hour of back-and-forth.

When something is wrong

Be specific and give evidence:

  • Bad: “It doesn’t work.”
  • Good: “Row 14 (Sharma & Sons) has State blank but GSTIN starts with 09 β€” that should be Uttar Pradesh. Fix the lookup and add a test for it.”

Ask for explanations

After it works, ask: “Explain what this script does in 8 bullet points, for a non-programmer.” If the explanation surprises you, you have found a bug in the requirements or the code.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong