// Fundamentals

How to Write Prompts That Actually Work

A practical framework — not theory

Most bad AI output isn't a model problem. It's a prompt problem. The same model that gives you a generic, hedge-everything answer to a vague prompt can give you something sharp and specific if you structure the request differently. Here's the framework we use inside PromptLab's auto-engineer feature, broken down so you can apply it manually too.

The four parts of a working prompt

Every prompt that reliably produces good output has some version of these four elements, even if they're not labeled:

1. Role

Tell the model what perspective to answer from. Not "you are a helpful assistant" — that's the default anyway. Be specific: "you are a senior backend engineer reviewing this code for production readiness" changes the vocabulary, the assumptions, and the level of detail you get back.

2. Context

Models can't read your mind or your codebase. If the task depends on constraints — a tech stack, an audience, a tone, a prior decision you've already made — state it. Omitted context is the single biggest cause of generic output.

3. Task

Say exactly what you want done, as a verb: "summarize," "rewrite," "critique," "generate three variations," "find the bug." Vague tasks like "help me with this" force the model to guess your intent, and it will guess conservatively.

4. Format

Specify how you want the answer structured — bullet points, a table, JSON, under 200 words, no preamble. Without this, models default to a safe middle ground: some prose, some structure, usually longer than you wanted.

A before-and-after example

Weak prompt:

Help me write a product description for my app.

Strong prompt:

You are a conversion-focused copywriter for developer tools. Write a 3-sentence product description for a Chrome extension that auto-fills API keys during local testing. Audience: backend developers who hate repetitive setup. Tone: direct, no marketing fluff. No emoji.

The second version doesn't just get you a better answer — it gets you a predictable answer, which is what actually matters when you're iterating.

Common mistakes

Where this fits into PromptLab

PromptLab's auto-engineer feature applies this framework automatically — you give it a rough idea, and it fills in role, context, format, and task structure before sending it to the model. The template library takes this further with pre-built structures for common jobs like code review, marketing copy, and security analysis, so you're not rebuilding the same scaffolding every time.

TRY THE PROMPT ENGINEER →