العمل داخل Cursor / Claude Code / Aider / Copilot
Prompts رسائل Conventional commits
معظم المهندسين بيقضوا نفس الـ 5 ثواني بيكتبوا نفس commit message العام — update X، fix Y، refactor Z. وبعدين القارئ التالي بيضطر يفتح الـ diff عشان يفهم اللي حصل فعلاً. Commit message سطرين كان هيجاوب السؤال.
الحل واحد من أصغر وأعلى ROI prompts في الكورس كله. بتدّي للموديل diff. بيرجع conventional commit message متبّع format فريقك.
Write a single conventional-commit message for this diff. Subject line under 60 chars. Then a 1-2 sentence body. Then a "BREAKING CHANGE:" footer if applicable.
Diff:
- export type Order = { id: string; total: number; } + export type Order = { id: string; totalCents: number; }(All call sites updated to read
totalCentsand divide by 100 at the UI boundary.)
Claude Sonnet 4.5 رجّع:
refactor(order)!: rename total to totalCents for clarity
The Order type now uses totalCents instead of total to make the unit
explicit. All call sites have been updated to use totalCents and
handle currency formatting at UI boundaries.
BREAKING CHANGE: Order.total has been renamed to Order.totalCents. Consumers must update property access and divide by 100 for display.
Captured from Claude Sonnet 4.5 (claude-sonnet-4-5) on 2026-04-27. Re-runs may differ slightly.
المخرج قابل للنشر. سطر العنوان 51 حرف وفيه prefix refactor(order)!: مع ! الـ breaking-change. الـ body بيشرح ليه في جملتين. الـ BREAKING CHANGE: footer هو بالظبط الـ format اللي parsers git log وأدوات changelog بيتوقعوه.
3 حاجات الـ prompt ده بيعملها كويس:
| إيه | ليه |
|---|---|
under 60 chars constraint على العنوان | بيتجنب قص GitHub في list الـ commits |
1-2 sentence body | الـ body غني عشان يبقى مفيد، قصير عشان يتقرا |
BREAKING CHANGE: footer if applicable | بيخلّي الموديل يشيله للـ commits اللي مش breaking |
كلمة "if applicable" بتعمل شغل أكتر مما يبان. من غيرها، الموديل بيضم BREAKING CHANGE: footer لكل commit (عشان الـ prompt بيذكره)، اللي بيخلّي الأدوات downstream تتعامل مع كل commit كـ breaking. معاها، الموديل بيضم الـ footer بس لما الـ diff فعلاً بيكسر حاجة.
تدفق diff → conventional commit:
الـ prompt ده بيـscale بشكل جميل. وصّله كـ prepare-commit-msg git hook أو CLI shortcut، وcommits بتاعتك بتروح من سطر عام لـ 4 سطور محدّدة من غير ما تصرف وقت زيادة. بتبطّل تكتب update util للأبد.
خطوة مفيدة تالية: ضمّ الـ prompt ده مع prompt وصف الـ PR من module 3. رسالة الـ conventional commit بتبقى عنوان الـ PR؛ الـ body بيبقى قسم الـ ## Summary. Round-trip واحد، مخرجين.
تحذير خفي: الموديل أحياناً بيخترع تفاصيل من الـ diff مش فعلاً في التغيير. في المخرج المسجّل، السطر "All call sites have been updated to use totalCents" مذكور في الـ prompt بين قوسين، فهو صحيح. لو الموديل كتب ده من غير ما تقول، كنت هتعايز تتحقق. اقرا الـ body دايماً قبل الـ commit — sanity check 3 ثواني بيمسك hallucination النادر.
الشكل التاني من الـ prompt اللي المهندسين بيحبوه: اطلب بس سطر العنوان، من غير body. مفيد لـ commits صغيرة الـ body فيها زيادة:
One-line conventional commit subject for this diff. Under 60 chars. No body.
دلوقتي prompt كل-commit بقى input قصير → مخرج قصير. التكلفة الذهنية اختفت. كثافة المعلومات في history الـ commits بتزيد.
Module 6 جاي: المشروع الختامي — كريم بيشحن PR حقيقي. :::
سجّل الدخول للتقييم