Guide

How to Write Better AI Prompts: The Complete Beginner's Guide

June 6, 2026  ·  10 min read  ·  By Codevantum

How to Write Better AI Prompts

To write better AI prompts, use a four-part structure: assign a Role, define a clear Task, supply relevant Context, and add Constraints on format, length, or tone. This single framework — used by professional prompt engineers and casual users alike — dramatically improves the quality and usefulness of every AI response you receive. Most people skip at least two of these four parts, and that's exactly why their results feel generic or off-target. Nail all four and ChatGPT, Claude, or Gemini will feel like a different tool entirely.

Why Most Beginners Write Terrible Prompts (and How to Fix It)

The most common mistake new AI users make is treating the chat box like a search engine. They type a few keywords — "marketing ideas" or "explain machine learning" — and then wonder why the answer is shallow, too long, or completely off-base. The problem isn't the AI. It's that the AI has been given almost no information to work with.

Language models are next-token predictors. They will produce the most statistically likely continuation of your input. If your input is vague, the output will mirror that vagueness. The fix is simple: give the AI the same information you'd give a smart human colleague who knew nothing about your situation. That means telling it who it's supposed to be, what you need, why you need it, and in what form.

Another beginner pitfall is assuming the AI remembers previous conversations or has magical context about your industry, your audience, or your goals. It doesn't — unless you explicitly provide that context within the prompt itself. Every great prompt is self-contained. If you wouldn't hand a printed version of your prompt to a freelancer and expect great work, your prompt needs more detail.

The 4-Part Prompt Formula: Role, Task, Context, Constraints

This is the core skill behind prompt engineering for beginners and professionals alike. Each part of the formula serves a distinct purpose, and together they give the AI everything it needs to produce a genuinely useful response.

The 4-Part Prompt Formula

1. Role  →  "Act as a [role]"
e.g. Act as a senior UX copywriter with B2B SaaS experience.

2. Task  →  "Your task is to [specific goal]"
e.g. Your task is to write a 3-email onboarding sequence for new users.

3. Context  →  "Here is the context: [details]"
e.g. Here is the context: Our product is a project management app for remote teams. Our users are busy managers aged 30–50.

4. Constraints  →  "Keep it [length/tone/format]"
e.g. Keep each email under 150 words. Use a warm, professional tone. Output in plain text with clear subject lines.

Role: Make the AI an Expert

Assigning a role primes the model to draw on specific knowledge and adopt an appropriate voice. "Act as a data scientist" will produce a very different answer to "Act as a high school science teacher" — even if the underlying question is the same. Choose a role that matches the expertise level and perspective you actually need.

Task: Be Brutally Specific

Vague tasks produce vague answers. Compare "write something about productivity" with "write a 5-step morning routine guide for software developers who struggle to focus before 10am." The second version tells the AI exactly what to produce, who it's for, and what problem it solves. Always include the deliverable type, the topic, and the intended audience.

Context: Feed the AI What It Doesn't Know

Context is the section most people skip entirely. This is where you paste in your product description, target audience profile, tone-of-voice guidelines, competitor examples, or whatever background information shapes a good answer. Think of it as the briefing document you'd hand to a contractor on their first day.

Constraints: Set the Guardrails

Without constraints, AI models default to their most average, general-purpose output. Constraints snap the response into shape: specify the word count, the reading level, the file format, the language register (formal/casual), what to avoid, and what to prioritise. Constraints aren't restrictions — they're directions.

Advanced Techniques: Chain-of-Thought and Few-Shot Prompting

Once you've mastered the 4-part formula, two advanced techniques will take your prompting skills further: chain-of-thought and few-shot prompting. These are the same strategies that AI researchers use to squeeze peak performance from large language models — and they're surprisingly easy to apply in practice.

Chain-of-Thought Prompting

Chain-of-thought (CoT) prompting tells the AI to reason through a problem step by step before giving a final answer. Simply add a phrase like "Think through this step by step before answering" or "First outline your reasoning, then give your conclusion." This dramatically improves accuracy on complex tasks — maths problems, logical puzzles, multi-step planning — because it forces the model to "show its work" rather than jump straight to a (potentially wrong) conclusion.

Few-Shot Prompting

Few-shot prompting means giving the AI two or three examples of what a good output looks like, right inside your prompt. Instead of describing the format abstractly, you demonstrate it. For example, if you want the AI to classify customer support tickets, show it three labelled examples first. The model will pick up the pattern and apply it consistently to new cases. This technique is especially powerful for tasks with a very specific structure, style, or classification scheme.

To go deep on these techniques with hands-on exercises, check out the Prompt Engineering for Beginners course — it covers both CoT and few-shot prompting with real-world practice projects.

Real Examples: Bad Prompt vs. Good Prompt vs. Great Prompt

Theory only goes so far. The fastest way to internalise good prompting is to see the contrast between weak and strong prompts side by side.

Example: Writing a Product Description

Bad prompt: "Write a product description."
This will produce something generic and unusable. The AI knows nothing about the product, the audience, or the style required.

Good prompt: "Write a product description for a wireless noise-cancelling headphone targeting remote workers."
Better — but still missing a role, constraints, and specific context about features and benefits.

Great prompt: "Act as an e-commerce copywriter specialising in consumer electronics. Your task is to write a 100-word product description for 'FocusPro X1' — wireless noise-cancelling headphones. Here is the context: Key features are 40-hour battery, ANC rated for open-plan offices, USB-C charging, and a matte black finish. The target buyer is a remote worker aged 25–40 who values focus and style. Keep the tone confident and benefit-led. Avoid technical jargon. End with a single punchy call-to-action sentence."

The great prompt uses all four parts of the formula. The AI now has everything it needs to produce copy you could actually use — often on the first attempt.

Common Prompting Mistakes to Avoid

Even with a solid framework, a few recurring mistakes trip up beginners and intermediate users. Watch out for these:

Asking multiple unrelated questions at once. If you bundle five different requests into one prompt, you'll get five mediocre answers instead of one excellent one. Break complex tasks into separate, focused prompts.

Being too polite or too vague out of habit. Phrases like "Could you perhaps maybe write something..." add no information. The AI doesn't need pleasantries — it needs specifics. Be direct and precise.

Ignoring the output format. If you need a bulleted list, a table, a JSON object, or a numbered step-by-step guide — say so explicitly. Otherwise you'll get a wall of prose that requires extra work to reformat.

Not iterating. A prompt is rarely perfect on the first try. If the result is 80% there, don't start from scratch — refine. Tell the AI what was wrong and ask it to adjust. Prompting is a dialogue, not a single command.

Skipping the constraints section. This is the most commonly omitted part of the formula and it's the one that most often causes runaway responses, wrong tone, or outputs that are twice as long as you needed.

Practice Makes Perfect: How to Level Up Your Prompting Skills

Reading about prompt engineering is a start. Actually practising it is where the real skill-building happens. Here's a structured approach to improving fast:

Keep a prompt journal. Every time you write a prompt that produces an excellent result, save it. Over time you'll build a personal library of reusable prompt templates tailored to your work. Patterns will emerge that you can apply across different tools and tasks.

Run A/B experiments. Write the same prompt two ways and compare the outputs. Change one variable at a time — the role, the level of context, the presence or absence of constraints — and observe what shifts. This deliberate experimentation is how prompt engineers develop their intuition.

Study how experts prompt. Communities on Reddit, Twitter/X, and Discord share high-quality prompt templates regularly. Analysing what makes these prompts work is one of the fastest learning shortcuts available.

Take a structured course. Self-directed experimentation is valuable, but a structured curriculum with feedback loops can compress months of trial-and-error into days. Our AI and prompt engineering courses are designed specifically for learners who want to go from zero to proficient as efficiently as possible. You'll work through real exercises, get guided feedback, and build a portfolio of prompts you can use professionally. Explore the full course catalogue and find the track that fits where you are right now.

Prompt engineering is one of the most accessible and immediately valuable skills in the modern AI landscape. You don't need a computer science degree or any prior coding experience — just curiosity, practice, and the right framework. The four-part formula gives you that framework. Everything else is repetition and refinement.

Ready to become a confident AI prompter?

Join thousands of learners building real AI skills on Codevantum — no experience needed.

Start Learning Free →