Prompt Engineering Basics

Generative AI & LLM Fundamentals · Prompt engineering · 8 min read · Updated

Prompt engineering is writing instructions so a model reliably does what you want. It is closer to writing a clear brief for a new colleague than to a magic spell.

Be clear about the task

State what you want, who it is for and what a good result looks like. Compare:

  • Weak: "Improve my resume."
  • Better: "Rewrite the work-experience bullets below for a customer support role. Keep every fact true, start each bullet with an action verb, keep each under 20 words."

Zero-shot, one-shot and few-shot

  • Zero-shot: just the instruction, no examples.
  • One-shot: one example of the input and the output you want.
  • Few-shot: several examples. This is the most reliable way to fix a format or tone.
Task: Rewrite the bullet in a stronger, factual style.

Example input: Was responsible for answering calls
Example output: Resolved 40+ customer calls per shift with a focus on first-call resolution.

Input: Helped the team with reports
Output:

Role, context and constraints

  • Role: "You are an experienced HR recruiter reviewing resumes for warehouse roles."
  • Context: who the reader is, what the goal is, what the input is.
  • Positive constraints: say what to do ("use plain English").
  • Negative constraints: say what to avoid ("do not invent employers or dates").

Templates and variables

In an application you rarely write each prompt by hand. You write a prompt template with variables such as {job_title} and {resume_text}, then fill them in. Keep templates in version control, as you would code.

Frequently asked questions

How many examples should I give in a few-shot prompt?

Two to five varied examples are usually enough. More can help for tricky formats but use more tokens.

Do I always need a role in the prompt?

No. A role helps set tone and focus, but clear task instructions and examples matter more.