Back to blog
Prompting
Claude Code

Prompting Basics: How to Write Clear Instructions for AI

Thang Doan
Thang Doan

If you have ever typed a question into ChatGPT or Gemini and gotten a weird answer, the problem is probably not the AI, it is the prompt. Prompt design is simply the art of writing clear, specific requests so the model gives you what you actually want. Here are the basics.

Four Types of Input

Every prompt you write falls into one of these categories:

Question input: You ask a question, the model answers. Example: "What is a good name for a flower shop that sells dried flower bouquets? Give me 5 options."

Task input: You ask the model to do something. Example: "Give me a simple list of 5 things I must bring on a camping trip."

Entity input: You give items and ask the model to operate on them. Example: "Classify these as large or small: Elephant, Mouse, Snail."

Completion input: You start something and the model finishes it. This is like an advanced autocomplete.

The Completion Trick

AI models are really good at continuing patterns. If you show it an example of what you want, then start the next one, it will complete it in the same style. For instance, if you want JSON output, show one example with the format you like, then give the next input and let the model finish.

This is often more effective than writing long instructions in English, because showing is clearer than telling.

Setting Constraints

You can tell the model what to do and what not to do. The most common constraint is length, for example, "Summarize this text in one sentence." Constraints narrow the possibilities and usually lead to better results.

Controlling Response Format

You can ask for the response in any format you want, a table, a bullet list, a paragraph, an elevator pitch, JSON, or even an essay outline. The key is to be explicit about what format you expect.

You can also use the completion trick here: start the response in the format you want (like starting an outline with "I. Introduction") and let the model continue in that format.

The golden rule: the more specific you are about what you want, the better the result. Tell the model the input type, add constraints, and specify the output format. That covers most of what you need for good prompts.

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

Recommended for you

Enjoyed this article?

Subscribe for new articles. No spam. Unsubscribe anytime.

By subscribing you agree to receive the newsletter. See the Privacy page.