Skillpedia
واجهات API والخوادم (backend)7.1k · #13512

tactical-ddd

ما الذي تفعله

يراجع الذكاء الاصطناعي في هذه المهارة نماذج البرمجيات بحثًا عن قواعد العمل المفقودة أو المبعثرة، ثم يعيد هيكلتها حتى تعيش القواعد داخل الكائنات. وهي مخصصة للمطورين الذين يريدون أن تحمي شيفرة المجال قواعدها بنفسها.

متى تستخدمها

  • ✓عندما تطلب من الذكاء الاصطناعي مراجعة نماذج المجال أو فحصها بحثًا عن تصميم ضعيف.
  • ✓عندما تكون كائنات المجال مجرد حاويات بيانات وتقع القواعد في خدمات أخرى.
  • ✓عندما تريد إعادة هيكلة الكود إلى كيانات أو كائنات قيمة أو مجمّعات.

رابط المهارة

https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/tactical-ddd/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/tactical-ddd/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“راجع فئات الطلبات والفواتير لدينا، وأخبرني إن كانت مجرد حاويات بيانات، وماذا أفعل حيال ذلك.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يكشف الذكاء الاصطناعي النماذج الضعيفة أولًا ويقيّمها، ثم يحدد أي قطعة تصميم تناسب كل فئة، ويعيد الهيكلة خطوة بخطوة إذا طلبت ذلك.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Tactical DDD — Rich Domain Modeling

Workflow

Determine the user's intent first:

Intent Phases to run
"validate / review / check / is this correct?" Phase 1 + 2 only → report findings, ask before refactoring
"fix / refactor / improve / clean up" Phase 1 + 2 + 3
"how should I design / model this?" Load reference.md directly

Phase 1 — Detect

Load detection.md and scan the target code for anemia signals. Produce a severity score and list of affected classes.

Phase 2 — Assess

For each affected class, determine the correct building block:

Has unique identity tracked over time? Has invariants tying multiple objects? → Building Block
Yes — Entity
No — Value Object
Yes (root) + children with shared invariants Yes Aggregate
Operation spans multiple Aggregates/doesn't belong to any — Domain Service

Prefer Value Objects over Entities. Prefer small Aggregates over large ones.

If intent was validate/review: stop here. Report findings using the output format below. Ask "Would you like me to apply these fixes?" before proceeding.

Phase 3 — Refactor

Load refactoring.md for step-by-step moves. Apply in this order:

  1. Replace setter chains with a single expressive method
  2. Move service logic into the Aggregate that owns it
  3. Add business guards at the top of each method
  4. Publish a Domain Event after each successful state change
  5. Replace primitive types with Value Objects

For deep pattern questions (boundary design, event modeling, service vs. entity decision), load reference.md.


Quick Anemia Signals (scan first)

public setX() / public setY()        → behaviour should be encapsulated
service.doX(entity, ...)              → logic likely belongs in entity
entity.setA(); entity.setB(); ...     → setter chain = missing intent method
no domain methods beyond getters      → pure data bag

Golden Rules

  1. Behaviour with data — Objects own both state and the operations that change it
  2. Ubiquitous Language — Method names come from the domain, not CRUD (commitTo, not setStatus)
  3. Small Aggregates — Root + Value Objects by default; add child Entities only for true invariants
  4. One transaction = one Aggregate — Cross-Aggregate rules use eventual consistency via Domain Events
  5. Reference by ID — Never hold object references to other Aggregates
  6. Value Objects first — Use Entities only when individual identity is essential
  7. Domain Services sparingly — Excessive services → anemic model
  8. Protect invariants — The Aggregate is the last line of defence; never trust the caller

Output Format

When reviewing code, report:

## Anemia Diagnosis: <ClassName>

Severity: [None | Mild | Moderate | Severe]

Issues:
- <description of problem>

Recommended refactoring:
- <specific move from refactoring.md>

When refactoring, show a before/after diff for each class touched.

الأسئلة الشائعة

هل سيغيّر الكود دون أن يسأل؟

لا. إذا طلبت مراجعة، فإنه يعرض النتائج وينتظر قبل إجراء أي تغيير.

ما هو النموذج الهزيل؟

هو فئة تحمل البيانات لكنها تترك كل قواعد العمل في مكان آخر.

ما هي كائنات القيمة؟

كائنات صغيرة بلا هوية خاصة بها، مثل مبلغ من المال أو عنوان.

التفاصيل

الوصف الأصلي من المؤلف

Detects anemic domain models, validates and refactors them into rich domain models, and enforces tactical DDD patterns (Entities, Value Objects, Aggregates, Domain Services, Domain Events). Use when the user asks to validate, review, or check domain models or DDD code; detect anemia; refactor domain objects; improve encapsulation; or mentions terms like "anemic model", "rich domain", "aggregate", "value object", "domain event", "ubiquitous language", "is this good DDD", "does this follow DDD", or "check my domain". Do NOT use for module or service boundary design, architectural decomposition,

repo: tech-leads-club/agent-skills

الشعبية

نجوم GitHub
7.1k
الترتيب
#13512
الترخيص
—
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة