Back to blog
Prompting
Claude Code

Prompting Basics: How to Write Clear Instructions for AI

Thắng Đoàn
Thắng Đoàn

Typed a question into ChatGPT or Gemini and gotten a weird answer? The problem is usually the prompt, not the model. Prompt design is the skill of writing clear, specific requests, and four habits cover most of it.

Know your input type

Every prompt falls into one of four groups. Question input: you ask, it answers, like "What is a good name for a flower shop selling dried bouquets? Give 5 options." Task input: you ask it to do something, like "List 5 things I must bring camping." Entity input: you hand over items to work on, like "Classify as large or small: Elephant, Mouse, Snail." Completion input: you start the pattern and the model finishes it.

Show, do not tell

Models are excellent at continuing patterns. Show one example of the output you want, then give the next input and let the model finish in the same style. Want JSON? Paste one filled-in example. Showing beats long instructions in English almost every time.

Set constraints and name the format

Say what to do and what not to do. The most common constraint is length: "Summarize this in one sentence." Then name the output format explicitly: table, bullet list, JSON, essay outline. Or start the response yourself, like an outline beginning with "I. Introduction", and the model continues in that format.

The trade-off

Specificity improves results until it straitjackets them. A prompt with ten constraints produces rigid output that misses obvious things outside the rules. One well-chosen example often replaces three sentences of instructions, so spend your prompt budget on examples before rules.

The smallest test

Take your last bad prompt, add one constraint and an explicit format, and rerun it.

Based on: Gemini API Prompting Strategies (ai.google.dev)

Share:

Recommended for you

Enjoyed this article?

Subscribe for new articles. No spam. Unsubscribe anytime.

By subscribing you agree to receive the newsletter. No spam, and you can unsubscribe anytime.