Prompt Engineering: How to Talk to AIs
Think of prompt engineering as giving a smart but literal intern a precise set of instructions. It's the skill of structuring your text input to guide a generative AI toward a specific, desired output, moving beyond simple keywords. This is essential for getting reliable results, from formatted JSON to correctly styled text. The biggest mistake is treating the AI like a search engine instead of a collaborator that needs clear direction.
### The mental model
Instead of just asking a question, you're designing a “request package.” Think of it like writing a detailed work ticket for a brilliant but extremely literal programmer. You must specify the task, the context, the constraints, and the desired output format. A simple keyword search is a guess; a well-structured prompt is an instruction.
### How it works
A prompt guides the AI by constraining its vast space of possible responses. It's not just *what* you ask, but *how* you ask. For example, instead of "write about dogs," a better prompt is "Write a 150-word blog post intro about the benefits of adopting a rescue dog, in a warm and encouraging tone. Include a question at the end to encourage comments." This structured input provides a persona (warm), a format (blog intro), a length (150 words), and a specific goal (encourage comments).
### When to use it
* To get consistently formatted output, like JSON or Markdown tables. * To have the AI adopt a specific persona, style, or tone for a task. * To break down a complex problem into smaller steps for the AI to solve sequentially. * To provide examples ("few-shot prompting") to teach the model the desired output pattern on the fly.
### When NOT to use it
* Don't rely on prompting alone to teach the model new, complex domains. For that, fine-tuning the model on a large dataset is more effective. * For managing structured data, APIs, or external tools the model can use, the related discipline of **Context Engineering** is more appropriate. It focuses on providing this information outside the main prompt.
### One canonical example
**Goal:** Get a list of product ideas in JSON format.
**Bad Prompt:** `Give me some app ideas.`
**Good Prompt:** ``` You are an expert product manager. Generate 3 innovative mobile app ideas for the fitness market. For each idea, provide a `name`, a `one_sentence_pitch`, and a `target_audience`. Return your response as a valid JSON array of objects. ``` This prompt sets a persona, specifies the domain, gives a quantity, defines the output structure, and explicitly requests the JSON format.
*Source: Wikipedia: Few-shot learning (natural language processing)*
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.