Clear Instructions
The single biggest lever on output quality is telling Claude clearly and specifically what you want.
Prompt engineering sounds fancy, but the core skill is simple: say clearly what you want. Claude follows instructions well, so specific instructions produce specific results.
Be explicit about
- The task — what to produce.
- The format — bullet points, JSON, a single paragraph.
- The constraints — length, tone, what to avoid.
- The audience — beginners, experts, customers.
Positive over negative
Telling Claude what to do works better than a long list of what not to do. "Answer in two sentences" beats "don't be too long".
Example
// Vague — Claude has to guess
const vague = "Tell me about this product.";
// Clear — Claude knows exactly what to return
const clear =
"Write a 2-sentence product summary for a busy shopper. " +
"Mention the material and the main benefit. Avoid marketing hype.";
const res = await client.messages.create({
model: "claude-opus-4-8", max_tokens: 200,
messages: [{ role: "user", content: `${clear}\n\nProduct: ...` }],
});When to use it
- Get consistent button label copy by telling Claude the exact character limit, tone, and verb to start with.
- Extract structured fields from free-text invoices by naming every field and specifying the output format.
- Produce on-brand social captions by listing the platform, max length, hashtag count, and desired emoji style.
More examples
Vague vs. specific instruction
Contrasts an underspecified prompt with one that states audience, length, tone, and CTA format.
// Vague
const vague = "Write something about our product.";
// Specific: audience, length, tone, call-to-action
const specific = `Write a 3-sentence product description for AcmePen aimed at
professional designers. Tone: confident and minimalist.
End with a call-to-action starting with 'Order yours'.`;
const msg = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 128,
messages: [{ role: "user", content: specific }],
});List constraints as numbered rules
Numbered rules are easy for Claude to check off, reducing constraint-violation rate in the output.
const prompt = `Generate an error message for a failed payment. Rules:
1. Under 20 words.
2. Friendly, never blame the user.
3. Include the word 'try'.
4. No technical jargon.`;
const msg = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 48,
messages: [{ role: "user", content: prompt }],
});Specify output format explicitly
Defines format (numbered list), structure (verb-first), and removes unwanted preamble explicitly.
const prompt = `List 5 SEO tips for a small bakery website.
Format: numbered list, each item on its own line.
Each tip must start with an action verb.
No introductory sentence — start at item 1.`;
const msg = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 200,
messages: [{ role: "user", content: prompt }],
});
Discussion