Guide

    Prompt Engineering Best Practices

    A practical guide to the frameworks, principles, and habits that make AI prompts reliable — whether you're using ChatGPT, Claude, Gemini, or any other model.

    Why Prompt Engineering Matters

    Prompt engineering is the practice of structuring requests to AI models so they consistently return useful output. The same model can produce mediocre or excellent results depending entirely on how the prompt is written. The difference is not magic words — it is structure, context, and specificity.

    Most people interact with AI like they're texting a friend. They write short, vague requests and hope the model fills in the gaps. It usually fills them with generic, hedged, average output. Prompt engineering replaces hope with a repeatable process: pick a framework, supply the right context, constrain the format, and iterate. The result is faster, more accurate first drafts and dramatically less time spent rewriting AI output.

    Eight Principles That Apply to Every Prompt

    Be specific, not polite

    Replace "could you maybe help me write something about X" with "write 3 LinkedIn posts about X, each under 220 characters, with a hook in the first line." Specificity beats verbosity every time.

    Assign a role

    Giving the model a persona ("Act as a senior copy editor") narrows its vocabulary, tone, and reasoning patterns to the part of its training data most relevant to your task.

    Provide context up front

    State the audience, goal, constraints, and any prior decisions. The model cannot read your mind; everything implicit becomes a guess.

    Show the output format

    Models follow templates. Spell out structure: "Return JSON with keys title, summary, tags" or "Use Markdown with H2 sections." Format drift is one of the top causes of poor results.

    Use delimiters for inputs

    Wrap pasted content in triple backticks, XML tags, or quotes so the model cleanly separates instructions from data. This prevents prompt injection and reduces confusion.

    Ask for reasoning when accuracy matters

    Add "think step by step" or "explain your reasoning before answering" for math, logic, evaluation, and decision tasks. Chain-of-thought lifts accuracy on complex problems significantly.

    Iterate, don’t restart

    When output is close but not right, refine: "Keep the structure, but make paragraph 2 more concrete and shorter." Don’t throw away a working prompt.

    Constrain length and tone explicitly

    "Under 120 words", "neutral tone", "no emojis", "no marketing language" — explicit constraints prevent the model from defaulting to verbose, hedged answers.

    The Core Frameworks

    Frameworks are checklists that make sure your prompt includes everything the model needs. You don't have to memorize all of them — pick one that matches your task and use it as a template.

    CRAFT — Context, Role, Action, Format, Target audience

    Best for: Long-form content, marketing copy, structured documents.

    Context: launching a SaaS analytics tool. Role: senior product marketer. Action: write a 150-word landing page hero. Format: headline + subhead + CTA. Target audience: data engineers at mid-market B2B companies.

    RTF — Role, Task, Format

    Best for: Quick, single-purpose prompts where you need clarity in 3 lines.

    Role: technical recruiter. Task: write a cold outreach message to a senior backend engineer. Format: under 90 words, no buzzwords, end with one specific question.

    Chain-of-Thought — Ask the model to reason step by step before answering

    Best for: Math, logic, multi-step analysis, decision support, debugging.

    Solve the following pricing problem. Think step by step, list each assumption, then state your final recommendation on the last line prefixed with "Answer:".

    RACE — Role, Action, Context, Expectation

    Best for: Business writing, reports, customer-facing communication.

    Role: CFO. Action: summarize Q3 results. Context: revenue up 12%, churn up 3%. Expectation: 5 bullet points for the board, neutral tone.

    TREF — Task, Requirements, Examples, Format

    Best for: Code generation, data transformation, anything with clear specs.

    Task: write a TypeScript function. Requirements: parse ISO dates, return null on invalid input. Examples: "2024-01-01" -> Date. Format: single function, no comments.

    Few-Shot — Show the model 2-5 input/output examples before the real request

    Best for: Classification, formatting tasks, style mimicking, structured extraction.

    Input: "Loved it!" -> positive. Input: "Meh." -> neutral. Input: "Total waste." -> negative. Input: "Surprisingly good." -> ?

    A Repeatable Process

    1. Define success. Before writing anything, decide what a great answer looks like. Length, format, tone, what it must include, what it must avoid.
    2. Pick a framework. Use RTF for quick tasks, CRAFT for content, RACE for business writing, TREF for code, Chain-of-Thought for reasoning.
    3. Draft the prompt. Fill in each slot of the framework with concrete details. Resist the urge to be brief — clarity beats brevity at the prompt level.
    4. Run and evaluate. Read the output against your success criteria. Note what's off: tone, structure, missing details, hallucinations.
    5. Refine, don't restart. Adjust the specific part of the prompt that produced the issue. Keep what worked.
    6. Save winners. A prompt that works once will work many times. Build a personal library of templates for recurring tasks.

    Common Mistakes to Avoid

    • Asking multiple unrelated things in one prompt — split into separate calls.
    • Using vague qualifiers like "good", "engaging", or "professional" without defining them.
    • Forgetting to specify the target audience — the same topic for executives and engineers needs different prompts.
    • Skipping format instructions and then complaining about inconsistent output.
    • Treating every model the same — GPT-4, Claude, and Gemini respond differently to the same prompt.
    • Not providing examples when the task has a specific style or structure.

    Prompt Engineering for Different Models

    All major models respond to the same core principles, but they have personalities. GPT-4 follows explicit format instructions closely and benefits from few-shot examples. Claude tends to be more verbose by default and responds well to XML-tagged inputs and strong constraints on length. Gemini is sensitive to role assignment and step-by-step instructions. When you move a prompt between models, expect to tune length, tone, and example count — not to rewrite from scratch.

    For image and video models the rules shift: order matters more than grammar, every adjective pulls the output in a direction, and shorter, denser prompts usually beat long paragraphs.

    Where to Go Next

    The fastest way to internalize these practices is to apply them to your own prompts. Rexxard gives you free tools for every step of that loop.

    Frequently Asked Questions about Prompt Engineering Best Practices

    Free · No sign-up required

    Enhance this prompt

    Apply every best practice on this page automatically — paste your prompt and the Prompt Enhancer will add role, context, constraints, and format for you.

    Was this guide helpful?