Kỹ thuật prompting hiệu quả — 6 vũ khí cốt lõi

4 năng lực cốt lõi (D2 — applied)Trung cấp35 phút

Có hai trường phái:

Bạn sẽ học được
  • 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

6 kỹ thuật cốt lõi

Đâ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.

┌──────────────────────────────────────────────────────────────┐
│                                                              │
│   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         │
│                                                              │
└──────────────────────────────────────────────────────────────┘

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:

Ví dụ

❌ Without context:

✅ With context:

Khi nào kỹ thuật này crucial

  • 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
  • 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":

Model pattern-match → produce output style matching examples.

Ví dụ

❌ Without examples:

(Model có thể overshoot playful, hoặc miss data-driven.)

✅ With examples:

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)
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: ?

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õ:

Ví dụ

❌ Without constraints:

(Có thể nhận tóm tắt 500 từ, 10 bullet, không match nhu cầu.)

✅ With constraints:

Khi nào kỹ thuật này crucial

  • 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
  • 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:

✅ Explicit steps:

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:

Cách 2 — Outline trước:

Cách 3 — Question first:

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:

✅ With think-first:

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:

Cấp 2 — Tone:

Cấp 3 — Audience:

Combine cả 3 thường tốt nhất.

Ví dụ

❌ Without role:

✅ With role:

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

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.

┌──────────────────────────────────────────────────────────┐
│                                                          │
│  [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].│
│                                                          │
└──────────────────────────────────────────────────────────┘

"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.

AI là prompt critic rất tốt. Đặc biệt:

Try it now: Lấy 1 prompt bạn dùng tuần trước. Run meta-prompt. So sánh trước/sau.

  • 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
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."

Pattern thành công thường gặp

Phân tích thousand of successful interaction, có pattern:

5 pattern này không guarantee success, nhưng presence của chúng correlate strong với output quality.

✅ 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."

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:

Description (Bài 5.8) là framework cấp cao. 6 kỹ thuật là toolset cụ thể để implement framework.

Kỹ thuậtDescription type
1. Give contextProduct + Process
2. Show examplesProduct (style)
3. Specify constraintsProduct
4. Break into stepsProcess
5. Ask AI think firstProcess + Performance
6. Define role/tonePerformance

Á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:

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:

So sánh prompt sau cải thiện với prompt gốc. Học pattern AI thường thêm.

  • 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

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
Nội dung này có hữu ích không?