Có hai trường phái: Trường phái A — "Prompt engineering sẽ chết": "Model tương lai đủ thông minh để hiểu intent từ vài từ. Bạn không cần học prompt nữa."
- Hiểu prompt engineering là gì và tại sao nó là kỹ năng nền tảng
- Áp dụng 6 kỹ thuật prompting cốt lõi: context, examples, constraints, steps, think-first, role/tone
- Áp dụng "secret weapon": dùng AI để improve prompt của chính bạn
- Troubleshoot khi prompt không cho output mong muốn
- Có 1 thư viện prompt template cá nhân để áp dụng cho task lặp
Mở đầu: Prompt engineering là chuyện nhỏ hay chuyện lớn?
Trường phái B — "Prompt engineering quan trọng forever": "Cùng một model, người fluent vs. người mới có output khác hẳn. Đây là kỹ năng meta."
Sự thật ở giữa, nghiêng về B.
Đúng — model mới (Claude 4.x, GPT-5) đã tha thứ hơn cho prompt sơ sài. Nhưng gap giữa output baseline và output xuất sắc vẫn rất lớn — và gap đó được close bởi prompting kỹ thuật.
Hơn nữa: ngay cả khi model tự suy được intent, biết mô tả rõ vẫn giúp bạn:
- Suy nghĩ rõ hơn về mình muốn gì (forcing function)
- Reproducible — prompt tốt có thể template, share team
- Production-ready — automation cần prompt deterministic
Prompt engineering = kỹ năng giao tiếp, không phải mánh kỹ thuật. Nó không lỗi thời.
6 kỹ thuật cốt lõi
┌──────────────────────────────────────────────────────────────┐
│ │
│ 1️⃣ GIVE CONTEXT — Cung cấp bối cảnh │
│ 2️⃣ SHOW EXAMPLES — Demonstrate qua ví dụ │
│ 3️⃣ SPECIFY CONSTRAINTS — Định ràng buộc │
│ 4️⃣ BREAK INTO STEPS — Chia nhỏ task phức tạp │
│ 5️⃣ ASK AI THINK FIRST — Cho AI "thở" trước khi answer │
│ 6️⃣ DEFINE ROLE/TONE — Spec cách AI giao tiếp │
│ │
└──────────────────────────────────────────────────────────────┘
Đây không phải checklist phải dùng cả 6 mỗi prompt. Đây là 6 vũ khí trong arsenal — chọn theo tình huống.
Kỹ thuật 1 — Give Context
Nguyên tắc
AI biết rất nhiều, nhưng không biết về context của bạn: company, project, audience, history. Bạn phải feed.
Cách làm
Cấu trúc context theo W5H:
- What — Task cụ thể
- Why — Mục đích, vì sao bạn cần
- Who — Audience, stakeholder
- When — Deadline, timing
- Where — Channel, platform sẽ deploy
- How — Cách bạn muốn output dùng
Ví dụ
❌ Without context:
Viết announcement cho team
✅ With context:
What: Internal announcement về office relocation tháng 3 Why: Nhân viên cần thời gian plan commute, family logistics Who: ~150 nhân viên, mix levels (intern → C-suite) When: Sẽ post Slack thứ Sáu này, move ngày 1/3 Where: Slack #all-hands channel How: Sau khi post, manager sẽ link trong 1:1 với team Viết Slack message dựa trên context trên.
Khi nào kỹ thuật này crucial
- Mọi task có "stakeholder" nào đó (email, presentation, decision)
- Task domain-specific (medical, legal, finance — kỹ thuật chuyên ngành)
- Task có history (continuation của project, revision của doc cũ)
Kỹ thuật 2 — Show Examples (Few-Shot)
Nguyên tắc
Một ví dụ value gấp 10 lần explanation abstract. Show, don't tell.
Few-shot learning là 1 trong những "emergent capability" mạnh nhất của LLM hiện đại.
Cách làm
Cung cấp 2-5 ví dụ "input → output mong muốn":
Ví dụ 1:
Input: [X1]
Output: [Y1 — đúng style bạn muốn]
Ví dụ 2:
Input: [X2]
Output: [Y2]
Ví dụ 3:
Input: [X3]
Output: [Y3]
Bây giờ:
Input: [X mới]
Output: ?
Model pattern-match → produce output style matching examples.
Ví dụ
❌ Without examples:
Viết product description theo brand voice của tôi
playful + concise + data-driven."
(Model có thể overshoot playful, hoặc miss data-driven.)
✅ With examples:
Đây là 3 product description matching brand voice: VD 1 — Coffee maker: "Brews 12 cups in 8 min flat. Built for offices that run on espresso and inside jokes." VD 2 — Standing desk: "Adjusts in 4 sec, supports 80kg. Your back will write a thank-you note." VD 3 — Wireless keyboard: "Typing speed +18% vs. average mech. Bluetooth pairs in 2 sec — magic, but engineered." Bây giờ viết description cho mouse pad XL gaming.
Kết quả: AI mimic structure (2 sentences, stat + personality), tone (playful + factual), length (~25 words).
Khi nào kỹ thuật này crucial
- Task style-heavy (writing, design language)
- Task pattern lặp (tagline, headline, naming)
- Bạn có "good output" sẵn từ trước
- Hard to describe abstractly (taste, voice)
Kỹ thuật 3 — Specify Constraints
Nguyên tắc
AI tìm cách "đáp ứng nhiều nhất" → output thường over-engineer. Constraint giúp AI focus.
Cách làm
Spec rõ:
- Length — số từ, số bullet, số slide
- Format — markdown, JSON, table, prose
- Inclusion — must include X
- Exclusion — không dùng Y, không reference Z
- Style — formal/casual, no jargon, in English/Vietnamese
Ví dụ
❌ Without constraints:
Tóm tắt báo cáo này
(Có thể nhận tóm tắt 500 từ, 10 bullet, không match nhu cầu.)
✅ With constraints:
Tóm tắt báo cáo này: - Length: chính xác 5 bullet, mỗi bullet 1 câu (max 20 từ) - Format: markdown bullet - Tone: factual, không opinion - Phải include: số liệu key (revenue, growth rate) - Không include: methodology section, appendices - Output language: tiếng Anh
Khi nào kỹ thuật này crucial
- Output sẽ paste thẳng vào template/system khác (cần exact format)
- Cost/length matter (sẽ dùng làm input cho model khác — token cost)
- Compliance/guideline (legal disclaimer, style guide)
- Avoid clutter (busy stakeholder không có time đọc dài)
Kỹ thuật 4 — Break Complex Tasks into Steps
Nguyên tắc
LLM yếu ở multi-step reasoning khi task implicit. Mạnh khi step được explicit.
Đây là application của "decomposition" — chia chinh phục.
Cách làm
Convert "do X" thành "step 1, 2, 3":
❌ Implicit:
Phân tích competitor và recommend strategy
✅ Explicit steps:
Phân tích competitor + recommend strategy theo các bước: 1. List competitor: Identify 5 direct competitor cho product Y 2. Profile mỗi cái: product offering, pricing, USP, customer review summary 3. Build comparison matrix: 5 cot competitor × 8 dimension 4. Identify gap: dimension nào tất cả competitor weak — opportunity 5. Identify saturation: dimension nào tất cả strong — table stakes 6. Recommend 3 strategy dựa trên gap analysis (each: rationale + risk) 7. Pick top 1 với justification
Mỗi step có output rõ ràng → AI khó miss step.
Khi nào kỹ thuật này crucial
- Task multi-step phức tạp
- Task có dependency (B cần kết quả A)
- Task bạn đã làm thủ công nhiều lần, biết flow chuẩn
- Cần audit trail (Discernment dễ hơn khi step rõ)
Kỹ thuật 5 — Ask AI to Think First
Nguyên tắc
Mặc định, model "respond ngay". Cho phép model "think first" → quality reasoning cao hơn nhiều.
Đây là cơ chế đằng sau "chain-of-thought" và "extended thinking" mode.
Cách làm
Có nhiều cách trigger:
Cách 1 — Explicit instruction:
Trước khi answer, hãy think step by step. Lay out reasoning trong <thinking> tag, sau đó give final answer.
Cách 2 — Outline trước:
Trước khi viết full essay, share outline (bullet point) cho tôi review.
Cách 3 — Question first:
Trước khi solve, list 5 question/assumption bạn cần clarify.
Cách 4 — Use extended thinking mode: Một số model (Claude với thinking, o-series) có dedicated thinking mode — bật lên cho task complex.
Ví dụ
❌ Without think-first:
Cho tôi answer cho 12 + 25 × 7 - 4²" AI có thể type ngay → wrong nếu rush.
✅ With think-first:
Solve: 12 + 25 × 7 - 4² Show step-by-step (BIDMAS): exponent → multiply → add/subtract.
Khi nào kỹ thuật này crucial
- Math, logic, multi-step reasoning
- Complex analysis (trade-off, root cause)
- Code debug — cần model reason qua flow
- Quyết định quan trọng — bạn muốn thấy reasoning để verify
Kỹ thuật 6 — Define Role / Tone
Nguyên tắc
Cùng câu hỏi, hỏi "explain quantum physics" — Einstein vs. Mr. Rogers vs. Wall Street analyst sẽ trả lời khác nhau. Define role/tone giúp AI calibrate.
Cách làm
3 cấp độ:
Cấp 1 — Role:
You are a senior financial analyst with 15 years experience covering tech sector.
Cấp 2 — Tone:
Tone: professional, analytical, no fluff. Use data when possible.
Cấp 3 — Audience:
Audience: CEO non-technical, attention span 5 min. Avoid jargon, use analogy.
Combine cả 3 thường tốt nhất.
Ví dụ
❌ Without role:
Explain blockchain to my board
✅ With role:
Bạn là strategy consultant chuyên về digital transformation, đã advise nhiều board của Fortune 500. Audience: 8 board member của tôi — average age 58, background traditional industry (manufacturing, retail), không tech. Tone: respectful, không patronizing. Use 1-2 analogy từ industry họ familiar (supply chain, ledger). Length: 5 minute talk script (~700 words). Output: speech format, không bullet. Explain blockchain
what, why care, what to do.
Khi nào kỹ thuật này crucial
- Audience-specific output (executive vs. team vs. customer)
- Cần expertise voice (legal, medical, financial)
- Brand voice / personal voice consistency
- Domain-specific tone (academic paper vs. blog post)
Tích hợp 6 kỹ thuật — Prompt mẫu hoàn chỉnh
┌──────────────────────────────────────────────────────────┐
│ │
│ [ROLE/TONE] │
│ You are a [role]. Audience is [who]. Tone: [style]. │
│ │
│ [CONTEXT] │
│ Task: [what]. Why: [purpose]. Background: [history]. │
│ │
│ [STEPS] (if multi-step) │
│ Approach: │
│ 1. ... │
│ 2. ... │
│ 3. ... │
│ │
│ [EXAMPLES] (if pattern-heavy) │
│ Reference style: │
│ - Example 1: [...] │
│ - Example 2: [...] │
│ │
│ [CONSTRAINTS] │
│ - Format: ... │
│ - Length: ... │
│ - Must/Must-not: ... │
│ │
│ [THINK FIRST] │
│ Before final output, share [outline/reasoning/question].│
│ │
└──────────────────────────────────────────────────────────┘
Không cần dùng heading [...] thật — đây chỉ là mental model. Trong thực tế, viết prose tự nhiên, nhưng đảm bảo cover các dimension.
"Vũ khí bí mật": Ask AI to improve YOUR prompt
Đây là kỹ thuật mạnh nhất. Mọi người ignore.
META-PROMPT:
"Đây là prompt tôi định gửi cho AI để do task X:
[Paste prompt của bạn]
Hãy review prompt này và:
1. Identify ambiguity hoặc missing context
2. Suggest improvement (cụ thể, không generic)
3. Rewrite improved version
Goal: prompt sau khi improve sẽ giảm số lần iterate."
AI là prompt critic rất tốt. Đặc biệt:
- AI thấy ambiguity bạn missed (vì bạn quen context)
- AI biết loại detail nào model thường cần
- AI có thể compare prompt của bạn với pattern thành công
Try it now: Lấy 1 prompt bạn dùng tuần trước. Run meta-prompt. So sánh trước/sau.
Pattern thành công thường gặp
Phân tích thousand of successful interaction, có pattern:
✅ PATTERN 1: Clear task overview ngay đầu
"Tôi cần X cho Y, vì Z."
✅ PATTERN 2: Format spec rõ
"Output: markdown, 5 bullet, mỗi bullet < 30 words."
✅ PATTERN 3: Constraint explicit
"Must include A. Must NOT mention B."
✅ PATTERN 4: Background relevant
"Context: tôi đang [tình huống]."
✅ PATTERN 5: Performance expectation
"Concise. Hỏi clarifying nếu cần. Đề xuất 2 option."
5 pattern này không guarantee success, nhưng presence của chúng correlate strong với output quality.
Troubleshooting — Khi prompt không work
Issue 1: Output generic
- Có thể vì
- Thiếu context (Kỹ thuật 1) hoặc constraint (Kỹ thuật 3).
- Fix
- Add specific context. Spec exact format, length.
Issue 2: Output quá dài / quá ngắn
- Có thể vì
- Không spec length, hoặc spec mơ hồ ("ngắn gọn").
- Fix
- Cụ thể: "150-200 words", "exactly 5 bullets".
Issue 3: Wrong tone
- Có thể vì
- Không define role/tone (Kỹ thuật 6).
- Fix
- Add "You are X, audience is Y, tone Z" prefix.
Issue 4: Miss step
- Có thể vì
- Multi-step implicit (Kỹ thuật 4).
- Fix
- Break thành step explicit.
Issue 5: Reasoning sai
- Có thể vì
- Không cho AI think first (Kỹ thuật 5).
- Fix
- "Show reasoning step-by-step before final answer".
Issue 6: Output đúng format nhưng nội dung lệch
- Có thể vì
- Process Description thiếu (Bài 5.8).
- Fix
- Spec methodology, framework, reference.
General troubleshooting workflow
Output không như mong → Re-read prompt
↓
Identify missing dimension (1-6 kỹ thuật)
↓
Add dimension đó (ngắn gọn)
↓
Try again — most case improve significantly
Mối liên hệ với Description (Bài 5.8)
6 kỹ thuật map vào 3 loại Description:
| Kỹ thuật | Description type |
|---|---|
| 1. Give context | Product + Process |
| 2. Show examples | Product (style) |
| 3. Specify constraints | Product |
| 4. Break into steps | Process |
| 5. Ask AI think first | Process + Performance |
| 6. Define role/tone | Performance |
Description (Bài 5.8) là framework cấp cao. 6 kỹ thuật là toolset cụ thể để implement framework.
Áp dụng ngay
Bài tập 1: Prompt makeover marathon (15 phút)
Lấy 5 prompt bạn dùng tuần trước (work hoặc personal). Cho mỗi cái:
- Viết lại với 1-3 trong 6 kỹ thuật phù hợp
- Test trên Claude — so sánh output trước/sau
- Note kỹ thuật nào tạo improvement lớn nhất
Bài tập 2: Build template library (15 phút)
Identify 3 task lặp lại trong tuần làm việc của bạn (weekly report, code review, customer email...). Viết 1 template prompt cho mỗi cái với đầy đủ 6 kỹ thuật phù hợp.
Lưu vào Notion / Google Doc / file. Đây trở thành thư viện cá nhân.
Bài tập 3: Meta-prompt (5 phút)
Chọn 1 prompt khó (gần đây không work). Run meta-prompt:
Review prompt này: [paste]. Identify gì missing/ambiguous. Rewrite improved version.
So sánh prompt sau cải thiện với prompt gốc. Học pattern AI thường thêm.
Anti-patterns
Áp 6 kỹ thuật cho mọi prompt
Sai vì over-engineer. Prompt simple ("dịch câu này") không cần Role + Steps + Examples.
Fix: Match độ chi tiết với độ phức tạp task.
Copy template AI tip mà không adapt
"Top 100 prompt thần kỳ!" — generic, không fit context bạn.
Fix: Hiểu principle, không nhớ template. Build template riêng.
Quên Performance dimension
Spec rất kỹ Product/Process, quên tell AI cư xử thế nào.
Fix: Mọi prompt nontrivial nên có 1-2 sentence performance ("be concise", "ask clarifying", "show options").
Không iterate
Prompt đầu không work → bỏ. Hoặc gõ 5 lần "no, like this!" mà không change prompt.
Fix: Treat prompt như draft — refine có chủ ý dựa trên troubleshooting framework.
Tóm tắt bài học
- 6 kỹ thuật cốt lõi: Context, Examples, Constraints, Steps, Think-first, Role/Tone — 6 vũ khí trong arsenal
- Vũ khí bí mật: dùng AI improve prompt của chính bạn — meta-prompt mạnh nhất
- Match kỹ thuật với task — không cần dùng cả 6 mỗi lần
- Pattern thành công correlate với 5 thuộc tính: clear overview, format spec, constraint explicit, background relevant, performance expectation
- Troubleshooting có hệ thống — mỗi loại issue map về kỹ thuật bị thiếu
- Build prompt template cho task lặp → 80% time saved + consistency
Tài liệu tham khảo
- 6 techniques for effective prompt engineering — handout
- Bài 5.8 — Description framework (cha của 6 kỹ thuật này)
- Anthropic Prompt Library — Production prompt examples
- Anthropic Prompt Engineering Guide — Deep dive technical