Skip to content

Commit c9aecfb

Browse files
fcursoragent
andauthored
Book review (week 2): fix chapters 2-5 in English and all 16 locales (#1363)
* book(ch02-05): fix factual and consistency issues in English chapters - ch02: add an Example section so the 'complete prompt' really uses all six components; correct the last TryIt that claimed six components but has five - ch03: update Principle 3 and quiz for assistants with memory/files/tools; fix the Python example (SyntaxError, 2 vs 3 items); correct principle numbers in the FillInTheBlank explanation; align the InteractiveChecklist with the chapter's actual eight principles - ch04: note that personas shape tone more than factual accuracy - ch05: mention native schema-constrained structured outputs vs JSON mode; replace EOL Node.js 18; correct the self-validation claim Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(tr): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(ar): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(az): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(de): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(el): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(es): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(fa): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(fr): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(he): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(it): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(ja): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(ko): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(nl): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(pt): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(ru): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> * book(zh): sync ch02-05 with English updates and fix translation issues Co-authored-by: Fatih Kadir Akın <fka@linux.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent dbdf1c7 commit c9aecfb

68 files changed

Lines changed: 719 additions & 549 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/content/book/02-anatomy-of-effective-prompt.mdx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ Structure the documentation as:
230230
3. Response (success and error examples)
231231
4. Code Example (in JavaScript/Node.js)
232232
233+
# Example
234+
Match the tone of this error description from our existing docs:
235+
"card_declined: The customer's bank declined the charge. Ask them to try a different payment method."
236+
233237
# Endpoint Details
234238
POST /v1/payments/intents
235239
Body: { "amount": 1000, "currency": "usd", "description": "Order #1234" }`}
@@ -293,7 +297,7 @@ Format: For each feature, provide:
293297
1. Feature name
294298
2. One-sentence description
295299
3. Why it matters for remote teams`}
296-
description="This prompt uses all six components. Try it and see how the structured approach produces focused, actionable results."
300+
description="This prompt uses five of the six components (everything except examples). Try it and see how the structured approach produces focused, actionable results."
297301
/>
298302

299303
## Build Your Own Prompt

‎src/content/book/03-core-prompting-principles.mdx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ Each level adds specificity and dramatically improves output quality.
8484

8585
## Principle 3: Context Is King
8686

87-
Models have no memory, no access to your files, and no knowledge of your situation. Everything relevant must be in the prompt.
87+
A model knows nothing about your situation beyond what reaches it in the conversation. Even assistants with memory features, uploaded files, or connected tools see only what has actually been shared with them, and they recall it selectively. When something matters, put it in the prompt.
8888

8989
### Provide Sufficient Context
9090

9191
<Compare
9292
before={{ label: "Insufficient context", content: "Why isn't my function working?" }}
93-
after={{ label: "Sufficient context", content: "I have a Python function that should filter a list of dictionaries by a specific key value. It's returning an empty list when it should return 3 items.\n\nFunction:\ndef filter_items(items, key, value):\n return [item for item in items if item[key] = value]\n\nCall: filter_items(items, 'status', 'active')\nExpected: 2 items, Got: empty list" }}
93+
after={{ label: "Sufficient context", content: "I have a Python function that should filter a list of dictionaries by a specific key value. It's returning an empty list when it should return 3 items.\n\nFunction:\ndef filter_items(items, key, value):\n return [item for item in items if item.get(key) == value]\n\nSample item: {'id': 7, 'status': 'active'}\nCall: filter_items(items, 'Status', 'active')\nExpected: 3 items, Got: empty list" }}
9494
/>
9595

9696
### The Context Checklist
@@ -321,7 +321,7 @@ List any issues found.
321321
"Iterate and Refine"
322322
]}
323323
correctIndex={2}
324-
explanation="Context Is King emphasizes that AI models have no memory between sessions and cannot read your mind. Including relevant background, constraints, and goals helps the model understand your needs."
324+
explanation="Context Is King emphasizes that AI models cannot read your mind: they only know what reaches them in the conversation. Including relevant background, constraints, and goals helps the model understand your needs."
325325
/>
326326

327327
## Practice: Fill in the Blanks
@@ -353,7 +353,7 @@ Format: Return your answer as {{format}}.`}
353353
{ id: "focus", correctAnswers: [], hint: "What aspect should be prioritized?", context: "A quality or aspect relevant to the task" },
354354
{ id: "format", correctAnswers: [], hint: "How should the output be structured?", context: "An output format type" }
355355
]}
356-
explanation="A well-structured prompt includes: a clear role (Principle 1), sufficient context (Principle 3), specific task (Principle 2), constraints (Principle 4), and output format (Principle 5). The AI checks if your choices are internally consistent."
356+
explanation="A well-structured prompt includes a clear role (Principle 6), sufficient context (Principle 3), a specific task with constraints (Principle 2), and an explicit output format (Principle 7). The AI checks if your choices are internally consistent."
357357
/>
358358

359359
<InteractiveChecklist
@@ -362,10 +362,10 @@ Format: Return your answer as {{format}}.`}
362362
{ id: "clarity", label: "Clarity Over Cleverness", description: "Is your prompt explicit and unambiguous?" },
363363
{ id: "specificity", label: "Specificity Yields Quality", description: "Have you included audience, length, tone, and format?" },
364364
{ id: "context", label: "Context Is King", description: "Does the prompt include all necessary background information?" },
365-
{ id: "examples", label: "Examples Beat Explanations", description: "Have you shown what you want, not just described it?" },
366-
{ id: "constraints", label: "Constraints Focus Output", description: "Are there clear boundaries on scope and format?" },
365+
{ id: "guide", label: "Guide, Don't Just Ask", description: "Have you laid out the steps or reasoning you want, not just asked for an answer?" },
367366
{ id: "iteration", label: "Iterate and Refine", description: "Are you prepared to improve based on results?" },
368-
{ id: "persona", label: "Persona Shapes Perspective", description: "Does the AI know what role to play?" },
367+
{ id: "strengths", label: "Leverage the Model's Strengths", description: "Are you showing patterns and using roles the model handles well?" },
368+
{ id: "structure", label: "Control Output Structure", description: "Have you specified the exact format you need?" },
369369
{ id: "verify", label: "Verify and Validate", description: "Have you built in checks for accuracy?" }
370370
]}
371371
/>

‎src/content/book/04-role-based-prompting.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Think of it this way: if you ask "What should I do about this cough?" the model
2929

3030
<Callout type="info" title="Why This Matters">
3131
The model isn't pretending or role-playing in a theatrical sense. It's statistically biasing its outputs toward patterns it learned from real experts, professionals, and specialists during training. A "doctor" role activates medical knowledge pathways; a "poet" role activates literary patterns.
32+
33+
Roles mostly shape tone, vocabulary, and focus. They can't add knowledge the model never learned, and research has found that a persona on its own rarely makes answers to factual questions more accurate. Pair roles with good context, and verify anything that matters.
3234
</Callout>
3335

3436
## Basic Role Patterns

‎src/content/book/05-structured-output.mdx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ Return the result as a JSON code block:
170170
```
171171
````
172172

173+
<Callout type="info" title="Native Structured Outputs">
174+
If you call a model through an API, you don't have to rely on wording alone. OpenAI, Anthropic, and Google all offer structured output modes that take a JSON Schema and constrain the response to match it, so required fields and allowed values are enforced rather than merely requested. Older "JSON mode" options only guarantee syntactically valid JSON, not your schema. Even with a schema enforced, the values themselves can still be wrong, so keep validating what matters.
175+
</Callout>
176+
173177
## YAML Output
174178

175179
YAML is more human-readable than JSON, using indentation instead of brackets. It's the standard for configuration files (Docker, Kubernetes, GitHub Actions) and works well when the output will be read by humans or used in DevOps contexts. YAML is sensitive to indentation, so be specific about formatting requirements.
@@ -181,7 +185,7 @@ YAML is more human-readable than JSON, using indentation instead of brackets. It
181185
182186
Return as valid YAML:
183187
- Include: install, lint, test, build stages
184-
- Use Node.js 18
188+
- Use the current Node.js LTS release
185189
- Cache npm dependencies
186190
- Run on push to main and pull requests`}
187191
/>
@@ -353,7 +357,7 @@ Transcript: "[meeting transcript]"
353357

354358
## Validation Instructions
355359

356-
Self-validation prompts the model to check its own output before responding. This catches common issues like missing sections, placeholder text, or constraint violations. The model will iterate internally to fix problems, improving output quality without additional API calls.
360+
Self-validation prompts the model to check its own output before responding. This catches common issues like missing sections, placeholder text, or constraint violations. This often improves quality without an extra API call, but it isn't a guarantee: a model can report that a check passed when it didn't, so still verify critical output in your own code.
357361

358362
```
359363
Generate the report, then:

‎src/content/book/ar/02-anatomy-of-effective-prompt.mdx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207

208208
<TryIt
209209
title="مثال موجه كامل"
210-
description="هذا الموجه يوضح جميع المكونات الستة تعمل معاً. جربه لترى كيف تنتج الموجهات المنظمة نتائج احترافية."
210+
description="هذا الموجه يوضح كيف تعمل المكونات الستة جميعها معاً. جربه لترى كيف تنتج الموجهات المنظمة نتائج احترافية."
211211
prompt={`# الدور
212212
أنت كاتب تقني أول لديك 10 سنوات من الخبرة في إنشاء وثائق المطورين.
213213
@@ -230,6 +230,10 @@
230230
3. الاستجابة (أمثلة نجاح وخطأ)
231231
4. مثال كود (بـ JavaScript/Node.js)
232232
233+
# مثال
234+
طابق نبرة وصف الخطأ هذا المأخوذ من وثائقنا الحالية:
235+
"card_declined: رفض بنك العميل عملية الدفع. اطلب منه تجربة وسيلة دفع أخرى."
236+
233237
# تفاصيل نقطة النهاية
234238
POST /v1/payments/intents
235239
Body: { "amount": 1000, "currency": "usd", "description": "Order #1234" }`}
@@ -293,7 +297,7 @@ Body: { "amount": 1000, "currency": "usd", "description": "Order #1234" }`}
293297
1. اسم الميزة
294298
2. وصف من جملة واحدة
295299
3. لماذا هي مهمة للفرق عن بُعد`}
296-
description="هذا الموجه يستخدم جميع المكونات الستة. جربه وانظر كيف ينتج النهج المنظم نتائج مركزة وقابلة للتنفيذ."
300+
description="هذا الموجه يستخدم خمسة من المكونات الستة (كل شيء ما عدا الأمثلة). جربه وانظر كيف ينتج النهج المنظم نتائج مركزة وقابلة للتنفيذ."
297301
/>
298302

299303
## ابنِ موجهك الخاص

‎src/content/book/ar/03-core-prompting-principles.mdx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@
8484

8585
## المبدأ الثالث: السياق هو الملك
8686

87-
النماذج ليس لديها ذاكرة، ولا وصول إلى ملفاتك، ولا معرفة بوضعك. كل شيء ذو صلة يجب أن يكون في المطالبة.
87+
لا يعرف النموذج شيئاً عن وضعك سوى ما يصل إليه في المحادثة. وحتى المساعدات الذكية التي تملك ميزات الذاكرة أو الملفات المرفوعة أو الأدوات المتصلة لا ترى إلا ما تمت مشاركته معها فعلاً، وتستحضره بشكل انتقائي. فحين يكون أمرٌ ما مهماً، ضعه في المطالبة.
8888

8989
### قدم سياقاً كافياً
9090

9191
<Compare
9292
before={{ label: "سياق غير كافٍ", content: "لماذا لا تعمل دالتي؟" }}
93-
after={{ label: "سياق كافٍ", content: "لدي دالة Python يجب أن تفلتر قائمة من القواميس حسب قيمة مفتاح محدد. إنها تعيد قائمة فارغة بينما يجب أن تعيد 3 عناصر.\n\nالدالة:\ndef filter_items(items, key, value):\n return [item for item in items if item[key] = value]\n\nالاستدعاء: filter_items(items, 'status', 'active')\nالمتوقع: عنصران، النتيجة: قائمة فارغة" }}
93+
after={{ label: "سياق كافٍ", content: "لدي دالة Python يجب أن تفلتر قائمة من القواميس حسب قيمة مفتاح محدد. إنها تعيد قائمة فارغة بينما يجب أن تعيد 3 عناصر.\n\nالدالة:\ndef filter_items(items, key, value):\n return [item for item in items if item.get(key) == value]\n\nعنصر نموذجي: {'id': 7, 'status': 'active'}\nالاستدعاء: filter_items(items, 'Status', 'active')\nالمتوقع: 3 عناصر، النتيجة: قائمة فارغة" }}
9494
/>
9595

9696
### قائمة التحقق من السياق
@@ -321,7 +321,7 @@
321321
"كرر وحسّن"
322322
]}
323323
correctIndex={2}
324-
explanation="يؤكد مبدأ 'السياق هو الملك' أن نماذج الذكاء الاصطناعي ليس لديها ذاكرة بين الجلسات ولا يمكنها قراءة أفكارك. تضمين الخلفية والقيود والأهداف ذات الصلة يساعد النموذج على فهم احتياجاتك."
324+
explanation="يؤكد مبدأ 'السياق هو الملك' أن نماذج الذكاء الاصطناعي لا يمكنها قراءة أفكارك: فهي لا تعرف إلا ما يصل إليها في المحادثة. تضمين الخلفية والقيود والأهداف ذات الصلة يساعد النموذج على فهم احتياجاتك."
325325
/>
326326

327327
## التمرين: املأ الفراغات
@@ -353,7 +353,7 @@
353353
{ id: "focus", correctAnswers: [], hint: "ما الجانب الذي يجب إعطاؤه الأولوية؟", context: "جودة أو جانب متعلق بالمهمة" },
354354
{ id: "format", correctAnswers: [], hint: "كيف يجب هيكلة المخرجات؟", context: "نوع تنسيق المخرجات" }
355355
]}
356-
explanation="المطالبة جيدة الهيكلة تتضمن: دوراً واضحاً (المبدأ 1)، سياقاً كافياً (المبدأ 3)، مهمة محددة (المبدأ 2)، قيوداً (المبدأ 4)، وتنسيق المخرجات (المبدأ 5). يتحقق الذكاء الاصطناعي مما إذا كانت اختياراتك متسقة داخلياً."
356+
explanation="المطالبة جيدة الهيكلة تتضمن دوراً واضحاً (المبدأ 6)، وسياقاً كافياً (المبدأ 3)، ومهمة محددة مع قيودها (المبدأ 2)، وتنسيقاً صريحاً للمخرجات (المبدأ 7). يتحقق الذكاء الاصطناعي مما إذا كانت اختياراتك متسقة داخلياً."
357357
/>
358358

359359
<InteractiveChecklist
@@ -362,10 +362,10 @@
362362
{ id: "clarity", label: "الوضوح قبل الذكاء", description: "هل مطالبتك صريحة وغير غامضة؟" },
363363
{ id: "specificity", label: "الدقة تؤدي إلى الجودة", description: "هل ضمّنت الجمهور والطول والنبرة والتنسيق؟" },
364364
{ id: "context", label: "السياق هو الملك", description: "هل تتضمن المطالبة جميع المعلومات الخلفية الضرورية؟" },
365-
{ id: "examples", label: "الأمثلة تتفوق على الشرح", description: "هل أظهرت ما تريد، وليس فقط وصفته؟" },
366-
{ id: "constraints", label: "القيود تركز المخرجات", description: "هل هناك حدود واضحة للنطاق والتنسيق؟" },
365+
{ id: "guide", label: "وجّه، لا تسأل فقط", description: "هل وضّحت الخطوات أو طريقة التفكير التي تريدها، بدلاً من مجرد طلب إجابة؟" },
367366
{ id: "iteration", label: "كرر وحسّن", description: "هل أنت مستعد للتحسين بناءً على النتائج؟" },
368-
{ id: "persona", label: "الشخصية تشكل المنظور", description: "هل يعرف الذكاء الاصطناعي الدور الذي يجب أن يلعبه؟" },
367+
{ id: "strengths", label: "استفد من نقاط قوة النموذج", description: "هل تعرض أنماطاً وتستخدم أدواراً يُحسن النموذج التعامل معها؟" },
368+
{ id: "structure", label: "تحكم في هيكل المخرجات", description: "هل حددت التنسيق الدقيق الذي تحتاجه؟" },
369369
{ id: "verify", label: "تحقق وتأكد", description: "هل أدرجت فحوصات للدقة؟" }
370370
]}
371371
/>

‎src/content/book/ar/04-role-based-prompting.mdx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@
2121

2222
**التكييف الإحصائي**: تعلمت نماذج اللغة الكبيرة من ملايين الوثائق التي كتبها خبراء حقيقيون. عندما تُعيّن دوراً، يُكيّف النموذج توزيعاته الاحتمالية لتتوافق مع الأنماط التي رآها من ذلك النوع من الكُتّاب.
2323

24-
**تقليل الغموض**: بدون دور، يُحسب النموذج متوسطاً عبر جميع المستجيبين المحتملين. مع دور محدد، يضيّق النطاق إلى مجموعة فرعية معينة، مما يجعل الاستجابات أكثر تركيزاً واتساقاً.
24+
**تقليل الغموض**: بدون دور، يحسب النموذج متوسطاً عبر جميع المستجيبين المحتملين. مع دور محدد، يضيّق النطاق إلى مجموعة فرعية معينة، مما يجعل الاستجابات أكثر تركيزاً واتساقاً.
2525

2626
**ترسيخ السياق**: يُنشئ الدور مرساة سياقية مستمرة طوال المحادثة. تتأثر كل استجابة لاحقة بهذا التأطير الأولي.
2727

2828
فكّر في الأمر بهذه الطريقة: إذا سألت "ماذا يجب أن أفعل بشأن هذه الكحة؟" يمكن للنموذج أن يستجيب كطبيب أو صديق أو صيدلي أو والد قلق. كل منهم سيعطي نصيحة مختلفة. بتحديد الدور مسبقاً، أنت تخبر النموذج أي "صوت" يستخدم من بيانات التدريب الخاصة به.
2929

3030
<Callout type="info" title="لماذا هذا مهم">
3131
النموذج لا يتظاهر أو يؤدي دوراً بالمعنى المسرحي. إنه يُحيّز إحصائياً مخرجاته نحو أنماط تعلمها من خبراء ومحترفين ومتخصصين حقيقيين أثناء التدريب. دور "الطبيب" يُنشّط مسارات المعرفة الطبية؛ ودور "الشاعر" يُنشّط الأنماط الأدبية.
32+
33+
تُشكّل الأدوار في الغالب النبرة والمفردات ومحور التركيز. لكنها لا تستطيع إضافة معرفة لم يتعلمها النموذج قط، وقد وجدت الأبحاث أن الشخصية وحدها نادراً ما تجعل الإجابات عن الأسئلة الواقعية أكثر دقة. فاقرن الأدوار بسياق جيد، وتحقق من كل ما هو مهم.
3234
</Callout>
3335

3436
## أنماط الأدوار الأساسية
@@ -92,7 +94,7 @@ Pitch: \${pitch}`} />
9294

9395
### الأدوار التقنية
9496

95-
**مهندس البرمجيات**: الأفضل لقرارات تصميم الأنظمة واختيارات التقنية والمفاضلات المعمارية. التركيز على قابلية الصيانة يوجّه الاستجابات نحو حلول عملية طويلة المدى.
97+
**المهندس المعماري للبرمجيات**: الأفضل لقرارات تصميم الأنظمة واختيارات التقنية والمفاضلات المعمارية. التركيز على قابلية الصيانة يوجّه الاستجابات نحو حلول عملية طويلة المدى.
9698

9799
<TryIt compact prompt={`You are a software architect specializing in scalable distributed systems. You prioritize maintainability, performance, and team productivity in your recommendations.
98100
@@ -199,11 +201,11 @@ Document: \${apiEndpoint}`} />
199201
</div>
200202
<div className="flex gap-2 p-3 bg-muted/50 rounded-lg">
201203
<span className="font-semibold min-w-40">الشرح التقني</span>
202-
<span className="text-muted-foreground">خبير + متواصل</span>
204+
<span className="text-muted-foreground">خبير + بارع في التواصل</span>
203205
</div>
204206
<div className="flex gap-2 p-3 bg-muted/50 rounded-lg">
205207
<span className="font-semibold min-w-40">حل المشكلات</span>
206-
<span className="text-muted-foreground">متخصص في المجال + شامل</span>
208+
<span className="text-muted-foreground">متخصص في المجال + خبير عام</span>
207209
</div>
208210
</div>
209211

0 commit comments

Comments
 (0)