Being specific — Guidelines và Process Steps

3 — Prompt EngineeringTrung cấp20 phút

Bạn prompt: "Viết short story về nhân vật phát hiện tài năng ẩn giấu."

Bạn sẽ học được
  • Phân biệt 2 loại specificity: Output Guidelines vs Process Steps
  • Viết quality guidelines kiểm soát length, format, elements
  • Viết process steps giúp Claude reason qua problem systematically
  • Biết khi nào cần cả 2, khi nào chỉ cần 1
  • Đo impact: case study 3.9 → 7.86 score

2 loại specificity

Loại 1: Output Quality Guidelines

Kiểm soát WHAT output trông như thế nào.

Use for: Control consistency của output.

Loại 2: Process Steps

Kiểm soát HOW Claude think through problem.

Guidelines:
- Length: 500-800 từ
- Structure: 3-act (setup → conflict → resolution)
- Characters: protagonist + 1 supporting
- Tone: heart-warming, hopeful
- Include: pivotal scene revealing talent
- Avoid: violence, profanity

Loại 2: Process Steps

Use for: Complex reasoning, decision-making, where "jumping to answer" gives shallow result.

Steps:
1. Brainstorm 3 possible talents that would create dramatic tension
2. Pick most interesting one, explain why
3. Outline a pivotal scene revealing the talent
4. Draft supporting character who amplifies impact
5. Write final story with above elements

Case study: Meal planner tiếp tục (3.9 → 7.86)

v2 (từ bài 6.16) — Clear & direct

Score: 3.9/10

Vấn đề: Claude tạo plan nhưng:

v3 — Add Quality Guidelines

  • Không tính calories đúng
  • Không breakdown macro
  • Không timing bữa ăn
  • Portion vague ("a handful", "some")
prompt_v2 = f"""Generate a one-day meal plan for an athlete:
- Height: {h} cm
- Weight: {w} kg
- Goal: {goal}
- Restrictions: {restrictions}"""

v3 — Add Quality Guidelines

Score: 7.86/10 (+100%)

Chỉ 6 guidelines → score gấp đôi.

v4 — Add Process Steps (optional)

prompt_v3 = f"""Generate a one-day meal plan for an athlete:
- Height: {h} cm
- Weight: {w} kg
- Goal: {goal}
- Restrictions: {restrictions}

Guidelines:
1. Include accurate daily calorie total (based on goal)
2. Show protein/fat/carb breakdown in grams
3. Specify timing for each meal (e.g., "8:00 AM")
4. Only use foods meeting restrictions
5. List portion sizes in grams (not "a handful")
6. Keep budget-friendly if not specified otherwise"""

v4 — Add Process Steps (optional)

Score: 8.2/10

Process steps cho marginal gain (+4%). Worth khi task complex, not always.

prompt_v4 = f"""Generate a one-day meal plan for an athlete:
...

Follow these steps:
1. Calculate target daily calories based on goal + physiology
2. Determine optimal macro split (protein/fat/carb)
3. Design 4 meals distributing calories (breakfast, lunch, snack, dinner)
4. Select foods respecting restrictions
5. Calculate exact portions

Guidelines:
[same as v3]"""

Khi nào dùng loại nào?

Quality Guidelines — Luôn

Mọi prompt production nên có guidelines. Đây là safety net cho consistency.

Minimum guidelines:

Process Steps — Cho problem phức tạp

Dùng khi:

Không cần cho:

  • Length (dài/ngắn/khoảng)
  • Format (paragraph / bullet / JSON)
  • Tone (formal / casual / technical)
  • Include (phải có gì)
  • Troubleshooting: "Why did X fail?" — cần check multiple causes
  • Decision: "Should we do A or B?" — cần weigh tradeoffs
  • Analysis: "Explain why sales dropped" — cần examine từ nhiều angle
  • Critical thinking: "Evaluate this argument" — cần counter-consider
  • Simple tasks (translate, summarize, classify)
  • Creative writing free-form
  • Format transformation

Ví dụ thực chiến: Sales drop analysis

Not specific enough

Claude có thể focus 1 cause (pricing), miss khác (marketing, competition).

Specific with Process Steps

"Why did our sales drop 20% last month?"

Specific with Process Steps

Output: Analysis có structure, cover all dimensions, không bias vào 1 cause.

Impact: CEO thấy "actionable" thay vì "this is what my gut says".

prompt = f"""Analyze why sales dropped 20% last month. Examine these 5 dimensions:

1. Market: macroeconomic, seasonal, industry trends
2. Competition: new competitors, price changes, marketing
3. Internal marketing: campaign performance, channel mix
4. Product: feature changes, bugs, quality issues
5. Customer feedback: reviews, support tickets, NPS

For each dimension:
- State relevant data points (if given; otherwise "need more data")
- Assess likelihood (high/medium/low) of being root cause
- Suggest next step to investigate

Then: synthesize top 2 likely causes + recommended action.

Data:
{sales_data}
Market news:
{news_summary}
Support tickets summary:
{tickets}"""

Ví dụ: Code review prompt

Generic

Specific — Guidelines + Steps

"Review this code"

Specific — Guidelines + Steps

Review this Python function for production readiness.

Review in this order:
1. Correctness: does it handle intended input/output correctly?
2. Edge cases: empty input, None, type mismatch, large input
3. Performance: complexity, memory
4. Security: injection, auth, data validation
5. Style: naming, comments, follow PEP 8
6. Testability: can this be unit-tested?

For each dimension, output:
- Status: ✅ pass / ⚠️ concerns / ❌ issues
- 1-2 sentences reasoning
- If issues, suggest fix

Finally, overall verdict: ship / needs revision / rewrite

Code:
{code}

Template: Specific prompt

[Action verb + object]  ← Bài 6.16 (clear & direct)

Context:
{domain-specific context}

Guidelines:  ← Bài này
- Length: [X words / X paragraphs]
- Format: [type]
- Must include: [list]
- Must NOT include: [list]
- Tone: [descriptor]

Process:  ← Bài này, optional
1. [step 1]
2. [step 2]
3. [step 3]

Output:
{expected structure}

Case studies theo ngành

🎓 Education — Graded essay feedback

💼 Sales — Call prep brief

prompt = """Grade this student essay on climate change.

Steps:
1. Read for overall argument
2. Check thesis statement strength
3. Evaluate evidence use (count citations, assess relevance)
4. Check structure (intro → body → conclusion)
5. Check grammar and style

Guidelines:
- Score: 0-100
- Feedback: 150-250 words
- Tone: constructive, specific
- Include: 1 strength + 2 areas to improve
- Point to specific sentences in essay

Essay:
{essay}"""

💼 Sales — Call prep brief

💰 Finance — Investment memo

prompt = """Prepare 1-page brief for sales call with {prospect}.

Guidelines:
- Length: 500-800 words, 4 sections
- Sections: Company background, Pain points, Value prop, Objection handling

Process:
1. Research company (from website and recent news)
2. Identify top 3 pain points for their industry + size
3. Map pain points → our solution features
4. Anticipate 2 common objections + prep responses
5. Format in 1-pager

Prospect info: {info}"""

💰 Finance — Investment memo

prompt = """Write investment memo on {company}.

Guidelines:
- 1500-2000 words
- Sections: Exec summary, Thesis, Financials, Risks, Recommendation
- Include: at least 3 data points with sources
- Tone: analytical, cautious

Steps:
1. Identify primary investment thesis
2. Support with 3-5 data points
3. Identify 3 key risks + mitigants
4. Conclude: Invest / Pass / Need more research
"""

Anti-patterns

❌ Guidelines contradict mỗi other

Vấn đề: Impossible. Claude sẽ bias 1, miss other.

Fix: Guidelines consistent. Length match với complexity.

❌ Too many guidelines

Guidelines:
- Concise (< 100 words)
- Include detailed analysis of 5 dimensions

❌ Too many guidelines

Vấn đề: Claude overwhelmed, ignore một phần.

Fix: Max 6-8 guidelines. Prioritize.

❌ Process steps quá prescriptive

Guidelines (15 items):
1. Must be funny
2. Must be < 500 words
3. Must use metaphor
4. ...

❌ Process steps quá prescriptive

Vấn đề: Claude không phải flowchart executor. Quá nhiều steps → output robotic.

Fix: 3-6 steps, high-level. Let Claude fill in details.

❌ Dùng Process Steps cho simple task

Steps (20 steps):
1. Read the input
2. Look for keyword "X"
3. If found, go to step 5
...

❌ Dùng Process Steps cho simple task

Vấn đề: Overkill. Thêm tokens, không cải thiện.

Fix: Simple task → chỉ clear & direct + minimal guidelines.

Task: Translate to English
Steps:
1. Read Vietnamese sentence
2. Identify vocabulary
3. Apply grammar rules
4. Output English

Áp dụng ngay

Bài tập 1: Add guidelines to your prompt (15 phút)

Lấy v2 prompt của bạn (từ bài 6.16). Thêm 5-6 guidelines. So sánh output.

Checklist:

Bài tập 2: Decision-making prompt với Process Steps (15 phút)

Viết prompt cho 1 trong:

Với Process Steps + Guidelines. Test với scenario.

  • [ ] Có length guideline?
  • [ ] Có format guideline?
  • [ ] Có must-include?
  • [ ] Có tone?
  • [ ] Testable?
  • "Should our startup pivot?"
  • "Is this contract fair?"
  • "Should I hire person A or B?"

Tóm tắt bài học

🎯 2 loại specificity: Output Guidelines (WHAT) và Process Steps (HOW).

🎯 Guidelines luôn dùng cho production prompt — length, format, must-include.

🎯 Process Steps dùng cho complex reasoning (troubleshoot, decide, analyze).

🎯 6-8 guidelines là sweet spot. Quá nhiều → Claude ignore.

🎯 Case study meal plan: Clear only = 3.9. Clear + guidelines = 7.86. (+100%)

Tài liệu tham khảo
  • Anthropic: Be specific
Nội dung này có hữu ích không?