Core Techniques

Prompts are code — versioned, tested, engineered. Six techniques that separate 'it sometimes works' from 'it ships.'

▶ Watch this reel

What you'll learn

  1. Clear instructions & role
  2. Few-shot examples
  3. Chain-of-thought
  4. XML / delimiters
  5. Output format control
  6. Negative instructions

Remember this

Clear instructions & role

Few-shot

Chain-of-thought

XML / delimiters

Output format control

Negative instructions

Code: A production-grade prompt template

PROMPT = """You are a senior support triage engineer.

Classify each ticket by urgency.

<rules>
- P1: money lost or service down
- P2: degraded but usable
- P3: feature requests and questions
</rules>

<examples>
Q: app crashes on login
A: {"urgency": "P1", "reason": "service unusable"}

Q: report export is slow
A: {"urgency": "P2", "reason": "degraded, workaround exists"}
</examples>

Answer with JSON only: {"urgency": "...", "reason": "one sentence"}.
Reason in at most 2 short steps, then the JSON.

<ticket untrusted="true">
{ticket}
</ticket>
"""

# Usage — THIS is a prompt template (GA-06 versions it):
ticket = "charged twice for one order"
messages = [{"role": "system", "content": PROMPT.replace("{ticket}", ticket)}]