Prompt Engineering: A Practical Guide to Better AI Output

By Darus S Alfatah · 2025-07-30 · Tutorial · 14 menit

Prompt Engineering: A Practical Guide to Better AI Output

Author note: The biggest improvement usually comes from giving examples, not adding ever-longer instructions.

Start With the Basics

Most disappointing AI output comes from vague instructions, not weak models. Before trying advanced techniques, fix the fundamentals: state the role, the goal, the constraints, and the expected format. Four sentences of clarity often outperform clever tricks.

A Reusable Structure

ROLE: [what specialist]
GOAL: [desired result]
CONTEXT: [supporting data, only what is needed]
CONSTRAINTS: [length, tone, forbidden content]
FORMAT: [JSON / bullets / paragraphs]
EXAMPLE: [one ideal output]

If output is still off, the constraint section is usually the culprit. “Write a good summary” is not a constraint; “summarise in five bullets, one sentence each, no jargon” is.

Use Examples Sparingly but Deliberately

One or two examples of the exact format you want teach more than paragraphs of description. Keep them short, and make sure they are correct — a wrong example teaches the wrong pattern.

Break Big Tasks Into Steps

Asking for a full report in one prompt produces generic text. Ask for an outline first, then expand one section at a time. Each step is easier to verify, and mistakes are caught earlier.

Test One Variable at a Time

If you change length, tone, and format simultaneously, you cannot tell what helped. Keep a set of twenty test inputs, change one thing, and compare results.

Common Mistakes

  • Instructions buried under long context with no priority order.
  • Irrelevant context drowning the important part.
  • No output format specified, so every answer looks different.
  • Assuming the model remembers rules from an earlier conversation.

Frequently Asked Questions

Do I need special wording? No. Clarity beats tricks; “think step by step” helps on reasoning tasks but is not magic.

Is a longer prompt better? Only when the extra words add constraints or useful context. Length without information adds cost and noise.

How do I keep output consistent? Specify the format and provide one example. For structured data, request JSON with fixed keys.

How many attempts should I allow? Two or three at most; if it still fails, the prompt or the task needs restructuring.

Does temperature matter? Yes. Use low temperature for extraction and classification, higher for brainstorming.

Conclusion

Prompt engineering is mostly clear thinking written down. Define the goal, constrain the output, test one change at a time, and keep a library of prompts that work for your recurring tasks.

Working With Long Context

When you must send a lot of material, order matters. Put instructions first, then the most relevant evidence, then the question. Models tend to weight the beginning and end more heavily, so a critical rule buried in the middle of a long document is easily ignored.

Also label sections clearly — "RULES", "DOCUMENT", "QUESTION" — so the model can distinguish instructions from data. This simple labelling reduces accidental instruction-following from document content, a common failure when summarising untrusted text.

Building a Prompt Library

Keep prompts that work. Store them with a short note about the task, the model used, and the output format. When a new task appears, start from the closest existing prompt rather than a blank page. Over a few months this library becomes the fastest part of your workflow, and it makes results reproducible across team members.

Review the library quarterly and delete prompts that no longer match the models you use; a prompt tuned for an older model can silently degrade quality after an upgrade.

Before and after example: Instead of asking please write about coffee, ask: write one ad paragraph for arabica coffee aimed at office workers, casual tone. Specifics produce more usable answers.

Frequently Asked Questions

Can beginners follow this tutorial?

Yes. The steps are explained in order with code examples, suitable for beginners and experienced developers alike.

Is BankAI’s endpoint compatible with the library I already use?

Yes, BankAI is 100% OpenAI-compatible, so libraries such as the OpenAI SDK and LangChain work without code changes beyond the Base URL and API key.

Where do I get an API key to follow this tutorial?

You get the API key (and Secret Token) after registering and completing payment in the BankAI dashboard.

Sources & References

About the author

Darus S Alfatah — Founder & Writer

Darus S Alfatah is the founder of BankAI. He builds and operates the LLM API gateway that serves Indonesian developers, and writes about LLM integration, gateway architecture, and using AI practically and cost-effectively. Every guide is tested in a real environment — including code, configuration, and token calculations — before it is published, and updated when provider documentation or pricing changes.

Editorial policy

Related articles

🚀 Ready to Use the All-in-One API Key?

Sign up, top up with QRIS, and start building with ChatGPT, Claude, DeepSeek and every other model through one key.

🔑 SIGN UP NOW · Pricing