Skip to content
LinkedInX

Prompt Engineering

About 5 minutes

Prerequisites: No prior knowledge required

Prompt engineering is the practice of designing instructions for generative AI so it is more likely to produce the expected answer. OpenAI’s API documentation treats instructions, input messages, tools, and output formats as controllable parts of model interaction.[1]

Generative AI decides what to return based on the text it receives. If the instruction is vague, the AI guesses the goal, audience, and assumptions. When that guess is wrong, the answer may be too long, too shallow, in the wrong format, or missing an important constraint.

A prompt is like a work request. Humans do better when a request includes the goal, deliverable format, and cautions. Generative AI behaves similarly.

ElementExplanationExample
RoleThe viewpoint expected from the AIExplain as a beginner-friendly technical teacher
GoalWhat should be achievedUnderstand the overview of MCP
AudienceWho the answer is forFor someone without programming experience
ConstraintsConditions to followExplain every technical term
MaterialsInformation to referenceSummarize the meeting notes below
Output formatShape of the answerCompare in a table
Tell me about AI agents.

This can produce an answer, but the depth, length, reader level, and viewpoint are unclear.

You are a beginner-friendly AI teacher.
Explain what an AI agent is for someone without programming experience.

Conditions:
- Start with a one-sentence definition
- Include an everyday analogy
- Compare it with a traditional chatbot in a table
- End with three key points

This prompt clarifies the role, audience, output format, and constraints. The AI has less to guess, so the answer becomes more stable.

You are a web engineer with security expertise.
Check whether the following code has XSS risk.

A role helps the AI prioritize the right viewpoint.

Compare the following three tools.
Use a table with "Use case / Strengths / Cautions".

An output format makes the answer easier to read and reuse.

Match the style of the following sentence and write a similar explanation.

Example:
"First grasp the big picture, then try a small example."

An example shows the AI what kind of output is expected.

Conditions:
- Do not state uncertain information as fact
- Mark places that need external confirmation as "Needs verification"
- Keep the answer within 300 characters

Constraints are quality guardrails.

Some problems cannot be solved with prompts alone.

  • The AI does not have the needed documents
  • Long conversations cause important assumptions to be lost
  • External tools are unavailable
  • No system verifies whether the answer is correct
  • Multi-step work state cannot be managed

These limits are why context engineering and harness engineering matter.

  • Prompt engineering designs instructions for AI
  • Role, goal, audience, constraints, materials, and output format make answers more stable
  • Prompts are important, but they do not manage documents, tools, or verification by themselves
  • Practical AI work is moving from prompt-only design to context and harness design

Q: Are longer prompts always better?

A: No. The important point is organized information. A long prompt with contradictions can reduce quality.

Q: Is “think step by step” still useful?

A: Sometimes. For complex tasks, it is usually better to state the goal, constraints, and expected output clearly than to rely on a single phrase.

Q: Are prompt templates enough?

A: They help with routine tasks, but tasks involving documents, tools, or verification need more than templates.

  1. OpenAI, OpenAI API documentation