Prompt Engineering · AI · ChatGPT

How to write better AI prompts for ChatGPT and Claude

AI gives generic answers when the prompt leaves it guessing. A prompt structure with role, task, context, constraints, examples and format, and a free tool.

Mohit Goyal 6 min read
How to write better AI prompts for ChatGPT and Claude

To write better AI prompts, stop making the model guess. State the task, give the context it cannot know, such as your audience and goal, set constraints like length and tone, show an example when style matters, and say exactly what format you want back. A prompt like "write a blog post about website speed" leaves all of that out, so the model fills each gap with the most average answer.

I write prompts every day for the AI features on this site, including the chat on the home page and the free AI tools. The free Prompt Improver applies the same structure to any prompt you paste in. Here is the structure, and what I have learned using it in production.

Why do AI prompts give generic answers?

Because a model answers the prompt it was given, not the one you meant. "Write a blog post about SEO" does not say who the post is for, what it should achieve, how long it is, what tone to use or how to format it. The model has to guess all five, and its guess is the middle of everything it has seen.

Every detail you add removes a guess. That is most of what prompt engineering is.

The fix is not longer prompts for their own sake. A long prompt full of vague adjectives, such as "engaging", "high quality" or "professional", still leaves the model guessing, because those words mean something different to everyone. Specific beats long: "for owners of independent restaurants who have never hired a developer" does more work than three paragraphs of adjectives. When you catch yourself writing an adjective, ask what it would look like in the output, and write that instead.

What makes a strong prompt?

Six parts. Not every prompt needs all of them, but every missing one is a guess.

PartWhat it doesExample
Role or perspectiveSets the expertise and the standard"Review this like a senior conversion copywriter"
TaskThe one thing to do"Rewrite the headline and subheadline"
ContextWhat the model cannot know"For HR managers at companies with 50 to 500 people. Goal: book a demo"
ConstraintsLimits on length, tone and content"Under 12 words. Plain English. No claims I have not given you"
ExampleShows the style when words are not enoughA headline you like, or a past post
Output formatThe exact shape of the reply"Three options, one per line, then one sentence on which to test first"

Here is the difference in practice, using the Prompt Improver's own example:

text
Before:
write a blog post about website speed

After:
You are writing for small business owners who are not technical.
Write a 900-word blog post on why website speed matters for them.
Goal: get readers to book a website speed audit.
Tone: plain, friendly, no jargon. Explain any technical term in one line.
Structure: a two-sentence answer up top, four question-shaped
subheadings, a short checklist, and one call to action at the end.
Do not invent statistics. Where a number would help, write [stat].

How do I structure prompts for the AI tools on this site?

Every tool here runs on one server-side prompt split into two parts: a one-line job and an output spec that describes the exact shape of the reply. The Landing Page Roaster's job, for example, is to review copy like a senior conversion copywriter and rewrite the weakest parts. Its output spec lists every section in order: a one-sentence verdict, four scores out of 10, the problems quoting the exact weak phrases, three headline rewrites from different angles, a table of section fixes, and one tip.

Rendering diagram…

Three lessons from running those prompts:

  • Specify the output exactly. Saying "a table with columns Feature, Priority, Effort, Why" gets a table every time. Saying "list the features" gets a different shape each run.
  • Write rules for what the model must not do. Every tool prompt forbids inventing claims, numbers, testimonials or client names, and asks for a [placeholder] where proof is needed.
  • Give real data instead of hoping. The chat on the home page is given real project counts in its system prompt, labelled as the only project numbers it may chart, so it never needs to invent one.

How are system prompts different from chat prompts?

A chat prompt is used once. A system prompt runs on every request, for every user, including the strange ones. So it needs more than a task: rules for edge cases, what to do when information is missing, what is off limits and the exact format of every reply.

Turn every mistake into a rule

When the model gets something wrong, do not just retry. Add a specific instruction that prevents that mistake, then test again. A good system prompt is mostly a record of mistakes that no longer happen.

On this site the system prompts live only on the server. They are never sent to the browser, and the chat's system prompt is built from my server-side profile, never from what the visitor types.

How do you use the Prompt Improver?

  1. 1

    Paste your prompt

    The prompt you would normally type, rough as it is.

  2. 2

    Pick where you will use it

    Chat assistant, coding assistant, image generator or API and system prompt. Each needs a different structure.

  3. 3

    Add the goal

    What the result should achieve. This is the context most prompts are missing.

  4. 4

    Copy and test

    You get a diagnosis of what was missing, the improved prompt, what changed and why, and two variations to try side by side.

It keeps your intent and adds the missing structure. It is free with no sign-up, with ten runs per tool per day.

How do you know if a prompt is better?

Run the old and new versions on the same input, two or three times each, and compare against what you actually needed. Keep what works. Where the new version still goes wrong, add a rule and test again. For anything you will reuse, keep the prompt in a document with a note of what each rule is for.

Prompts are one part of an AI feature; the rest is the product around them. If you are looking for where AI would help your business in the first place, read AI use cases for small businesses. For a working example of prompts, streaming and guardrails in one place, see how I built the AI chat on this portfolio.

Frequently asked

What is prompt engineering?+

Writing instructions for AI models so they return accurate, useful and consistent results. It covers the task, context, constraints, examples and output format.

Do the same prompts work for ChatGPT, Claude and Gemini?+

The same patterns do. Clear goals, context, constraints and an output format work across all major models. Small details differ, so test your prompt on the model you will actually use.

How long should a prompt be?+

As long as it needs to be to remove the guesses that matter. A one-line request is fine for a quick fact. A blog post, a code change or a system prompt usually needs a paragraph or more.

Should I give the AI a role?+

It helps when the role carries real expectations, such as a conversion copywriter or a senior reviewer. A role is not a substitute for context, though. The model still needs to know your audience and goal.

How do I write better image prompts?+

Structure them around subject, style, composition, lighting and detail, which is what image models respond to. The Prompt Improver has an Image generator mode that does this.

Mohit Goyal

Written by Mohit Goyal

Senior Web Developer in Gurugram, India. 100+ fast, SEO-friendly sites shipped in 4+ years with Next.js, React and WordPress, including the procol.ai rebuild. Send me your next project.

Keep reading

Let's build

Have a site that needs to be fast, rank and convert?

Open to Work. Usually replies within a day.