Langsung ke konten
Skillpedia
API & server (backend)7.1k Β· #13512

tactical-ddd

Fungsinya

Skill ini membuat AI meninjau model perangkat lunak untuk mencari aturan bisnis yang hilang atau tersebar, lalu merefaktornya agar aturan itu berada di dalam objek. Skill ini ditujukan untuk pengembang yang ingin kode domain mereka melindungi aturannya sendiri.

Kapan dipakai

  • βœ“Saat Anda meminta AI meninjau atau memeriksa model domain yang desainnya lemah.
  • βœ“Ketika objek domain Anda hanya berisi data dan aturannya ada di layanan lain.
  • βœ“Ketika Anda ingin merefaktor kode menjadi entity, value object, atau aggregate.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/tactical-ddd/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPeriksa kelas pesanan dan faktur kami, beri tahu saya apakah keduanya hanya wadah data, dan apa yang sebaiknya dilakukan.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

AI pertama-tama mendeteksi model yang lemah dan memberinya skor, lalu memutuskan bagian desain yang cocok untuk setiap kelas, dan merefaktor langkah demi langkah jika Anda memintanya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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.

Pertanyaan umum

Apakah AI akan mengubah kode tanpa bertanya?

Tidak. Jika Anda meminta tinjauan, AI melaporkan temuannya dan menunggu sebelum membuat perubahan.

Apa itu model anemik?

Itu adalah kelas yang hanya menyimpan data, sementara semua aturan bisnisnya ada di tempat lain.

Apa itu value object?

Objek kecil tanpa identitas sendiri, misalnya jumlah uang atau alamat.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
7.1k
Peringkat
#13512
Lisensi
β€”
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa