How to talk to Claude Code: better prompts

Write clear Claude Code prompts: give context, define done, share examples and break big jobs into steps for better results with fewer retries.

Lesson 1.4โฑ 7 min read๐ŸŒฑ Curiousโ“ 3-question quiz
The short answer

The best Claude Code prompts state the goal, the context, the constraints and what "done" looks like. Be specific, point to relevant files, give examples, and ask Claude to plan or ask questions before it builds anything large.

The four-part prompt

Vague in, vague out. A strong prompt usually has four parts:

  1. Goal: what you want to achieve.
  2. Context: who it's for, which files matter, any background.
  3. Constraints: what to avoid, which tools or styles to use.
  4. Definition of done: how you'll both know it worked.
Weak:   make a booking form

Strong: Add a booking form to contact.html for our hair salon.
        Fields: name, email, phone, preferred date.
        Validate the email and stop past dates.
        Match the existing colours in styles.css.
        Done = form shows a friendly thank-you message on submit.

Show, don't only tell

Claude follows examples more reliably than descriptions. If you want a particular format, paste a sample:

Convert these dates to this format:
"3rd March 2026" โ†’ "2026-03-03"
"Mar 14 26" โ†’ "2026-03-14"

Two or three concrete input โ†’ output pairs beat a paragraph of explanation every time.

Analogy: describing a cake recipe is helpful; showing a photo of the finished cake removes the guesswork.

Ask it to plan or interview you first

For anything bigger than a quick fix, try:

  • Before writing code, outline your plan and wait for my OK.
  • Ask me any questions you need answered before you start.
  • Think hard about edge cases first.

This "interview pattern" surfaces things you hadn't considered, which is especially useful in unfamiliar territory.

Iterate like a pro

  • Small steps: one feature at a time is easier to review than ten.
  • Give feedback with evidence: paste the error message or describe exactly what looks wrong.
  • Use tests as the target: "make these tests pass" is a crystal-clear definition of done.
  • Screenshots help: you can paste or drag images in to show a design or a bug.
Tip: if Claude keeps misunderstanding, don't repeat yourself louder. Change approach. Add an example, point to a file, or split the task.

Check yourself

Three quick questions to check it stuck.

Ask the tutor

Stuck on something in this lesson? Ask the AI tutor. It answers from this lesson and points you to others that help. Answers are written by AI and can be wrong. Do not include personal details, passwords or company secrets.

Frequently asked

What makes a good Claude Code prompt?

A clear goal, relevant context, constraints and a definition of done. Point to specific files and include examples of the output you expect.

Should I give Claude Code one big task or several small ones?

Break large work into smaller steps or ask Claude to produce a plan first. Smaller steps are easier to review and correct.

Can I paste images into Claude Code?

Yes. You can paste or drag in screenshots, such as a design mock-up or an error on screen, to give Claude visual context.