Lesson 10 of 10

Prompt Engineering Masterclass

Prompt Engineering Masterclass — AIFree.vn AI illustration

Prompt engineering is the skill of reliably steering large language models — not typing magic words. This masterclass consolidates frameworks, advanced patterns, evaluation, and team workflows so your prompts survive model updates and new teammates.

Start: AI Tutorials Hub · Lesson 1: ChatGPT effectively

What you will learn

  • RCTFC and when to add few-shot and chain-of-thought
  • System vs user messages in API and chat UIs
  • Build a prompt library with versions
  • Lightweight eval loops (1–5 rubric)

The RCTFC framework (deep dive)

Part Question Example
Role Who is the model? “Senior tax-aware accountant for VN SMEs”
Context What background matters? “Reader is founder, non-technical”
Task What exactly to do? “List 5 compliance reminders for Q3”
Format Output shape? “Markdown table, max 120 words”
Constraints What to avoid? “No legal advice; cite law names only”

Worked example

Role: B2B SaaS product marketer.
Context: Launching AI tutorial hub; audience developers and founders in Vietnam.
Task: Write 3 email subject lines A/B/C for newsletter.
Format: Table with columns Variant, Subject, Hypothesis.
Constraints: Under 50 chars subject; no spam words (FREE!!!); no fake stats.

Few-shot prompting

Provide 2–3 input → ideal output pairs before the real request. Use when:

  • Format is unusual (JSON, custom IDs)
  • Tone is niche (your brand voice)
  • Classification with edge cases

Keep examples diverse and label them Example 1 so the model does not confuse them with the live task.

Chain-of-thought (when worth it)

Ask the model to plan briefly before the final answer:

First list assumptions and steps (max 5 bullets), then give the final answer under heading “Final”.

Use for multi-step math, policy analysis, or architecture — skip for simple rewrites (wastes tokens).

System prompts and policies

For API apps, put immutable rules in system message:

  • Refusal conditions
  • JSON-only responses
  • Language policy

Never rely on users to “be nice” — attackers probe user channels.

Cross-read: How to write effective prompts for Claude.

Prompt library (team ops)

Store prompts in Git:

prompts/
  support-summarize-v3.md
  blog-outline-v2.md

Each file header:

model: gpt-4.1
owner: content-team
last_eval: 2026-06-01
score: 4.2/5

Change logs beat Slack scrollback.

Evaluation without a PhD

  1. Collect 20 representative user prompts from logs (redact PII)
  2. Run baseline and candidate prompt
  3. Score blind (you should not know which is which)
  4. Ship if average +0.5 on rubric without new safety failures
Score Definition
5 Correct, complete, on-brand
3 Needs light edit
1 Wrong, unsafe, or off-format

Advanced patterns (catalog)

  • Decomposition: break “write campaign” into research → outline → draft
  • Self-critique: “List 3 weaknesses in your draft, then revise”
  • Structured output: JSON schema in prompt; validate with code
  • Tool calling: let model fetch live data instead of guessing

Resources: ChatGPT prompts collection, image prompts library.

Common mistakes

  • Prompt length explosion without added constraints
  • Identical retries after failure (change one variable)
  • No regression test when OpenAI/Anthropic updates models
  • Hiding prompts from QA team

FAQ

Do prompt marketplaces replace skill?
They help starters; your domain examples still win.

Is prompt engineering dying?
Models improve but task specification remains — it shifts toward evals and agents.

Key takeaway

Treat prompts as versioned product specs: RCTFC baseline, examples for edge cases, evals before rollout — the same discipline as shipping code.


AIFree.vn — practical AI & IT education. Updated June 2026.