Dev.to AI 🤖 Ai 👁 0 📖 1 min read

3 prompt patterns that actually work, with copy-paste examples

Most bad AI output is a bad prompt, not a bad model. These three patterns fix the majority of it. Each one includes a template you can copy. 1. Role plus constraints Vague prompts get vague answers. Give the

Most bad AI output is a bad prompt, not a bad model. These three patterns fix the majority of it. Each one includes a template you can copy.

1. Role plus constraints

Vague prompts get vague answers. Give the model a role and hard constraints:

You are a senior Python reviewer. Review the code below.
Rules:
- List only real bugs, not style nits
- Max 5 items
- Each item: one line describing the bug, one line with the fix

The constraints do the heavy lifting. "Max 5 items" and "one line each" force density. Without them you get a polite essay.

2. Few-shot examples

Show the model what good output looks like instead of describing it. Two examples beat two paragraphs of instructions:

Convert these into calendar event titles:

Input: "Lunch with Sara tomorrow at noon"
Output: "Lunch - Sara"

Input: "Dentist appointment Friday 3pm"
Output: "Dentist"

Input: "Call the bank about the fee on Monday morning"
Output:

The model continues the pattern. This works for formatting, classification, tone matching, and extraction. Use it whenever the output has a shape you can demonstrate.

3. Ask for questions first

For anything complex, make the model interrogate you before it answers:

I want to automate my invoice reminders. Before you suggest anything,
ask me every question you need answered to give a good recommendation.

This kills the biggest failure mode: the model guessing your context and confidently solving the wrong problem. Answer its questions, then let it work.

Putting it together

A strong prompt usually combines all three: a role with constraints, one or two examples of the output shape, and a questions-first step for anything ambiguous. Try rewriting your most-used prompt with this structure and compare the outputs.

I build AI automations for businesses. Chatbots, workflow automation, custom tools that cut manual work. Engineering proof: github.com/Dextheking1. DMs open on X: @FREEAIMETHODS.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.