agentsclimarketplace

Domain driven design

Skill techygarg/lattice/skills/atoms/domain-driven-design

Apply DDD tactical patterns when working with domain code. Enforces aggregate design, value objects over primitives, entity identity rules, and bounded context boundaries. Use when creating or modifying domain models, designing aggregates, working in the domain layer, or when the user mentions 'domain', 'aggregate', 'value object', 'entity', 'bounded context', or 'DDD'.From its SKILL.md

Install
npx -y skills add techygarg/lattice --skill domain-driven-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • reads credentialsReads from 1 credential source: `.lattice/config.yaml`.

SKILL.md

5.8 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

Domain-Driven Design

Config Resolution

Skill support project-custom. Resolution:

  1. Look .lattice/config.yaml repo root
  2. If found, check paths.ddd_principles custom doc path
  3. If custom path exist, read doc, check YAML frontmatter mode:
    • mode: override (or no mode): Custom doc full precedence. Use instead embed default. Must comprehensive -- sole reference.
    • mode: overlay: Read embed ./references/defaults.md first, then apply custom doc section on top. Section custom replace match section default (match by heading). New section append after default.
  4. If no config, no path, or path not found, read ./references/defaults.md
  5. Language adaptation: If paths.language_idioms exist in config, read "Type System & Object Model" section and adapt entity, value object, and aggregate implementation patterns to language constructs (e.g., struct vs class, trait vs interface, data class vs record). Language idioms take precedence over pseudocode defaults.

Self-Validation Checklist

STOP after generating each component. Verify ALL before proceeding. STOP: If any check fails, fix before presenting. If check is a judgment call with multiple valid approaches (see Ambiguity Signals), flag — present options and reasoning rather than silently choosing.

  1. ENTITY VS VALUE OBJECT: Each domain object — business track individual instance over time? Yes → entity with identity. No → value object with immutable and self-validate.
  2. AGGREGATE BOUNDARY: Transactional invariant require this object inside aggregate? If not → separate aggregate reference by ID.
  3. RICH BEHAVIOR: Entity have method enforce business rule, guard state transition, raise event? If entity just data holder → move logic from service into entity.
  4. VALUE OBJECT COVERAGE: Scan primitive type should be value object — string email, number amount, raw UUID as identifier → wrap value object with validate.
  5. AGGREGATE COHESION: List business rule root enforce. Each internal entity participate least one invariant? If not → belong own aggregate.
  6. DOMAIN EVENTS: Domain event raise for state transition other aggregate react, change trigger notification, audit/compliance requirement? Don't raise event internal change nothing react.
  7. DOMAIN SERVICE: Stateless logic span multiple entity place domain service rather than application service? Avoid I/O and infrastructure call?
  8. FACTORY: Complex aggregate creation encapsulate factory method (Order.create(...)) or standalone factory class? Initial creation and reconstitution from persistence handle separate?

Active Anti-Pattern Scan

After verify checklist above, scan output these specific anti-pattern. If find any, fix before present code.

  • Anemic Domain Model: Entity data holder only getter/setter; all logic live service → move business rule into entity and value object
  • Primitive Obsession: Raw string for email, number for money, UUID for ID → wrap value object with validate and behavior
  • God Aggregate: Aggregate many entity, slow load, high contention → decompose keep only what share transactional invariant
  • Cross-Aggregate Transaction: Service update two aggregate one transaction → use domain event eventual consistency
  • Leaking Domain Logic: Business rule in controller, application service, or infrastructure → extract domain object or domain service
  • Misidentified Entity/Value Object: Entity without lifecycle, or value object with identity track → apply identity test

Ambiguity Signals

  • Aggregate Boundary Size: Small aggregate (more event, eventual consistency) vs large aggregate (simple transaction, immediate consistency). Neither inherent correct — depend contention pattern and invariant scope.
  • Entity vs Value Object: Some concept (like Address or Money) may or may not need identity depend domain complexity. Apply identity test, but acknowledge when borderline.
  • Domain Service vs Entity Method: Logic span multiple entity could live domain service or be method on primary entity. Choice depend which entity "own" invariant.
  • Object Creation Pattern: Factory method on aggregate root, standalone factory class, builder pattern, or plain constructor — depend assembly complexity and team convention. Don't prescribe pattern; ask which approach team prefer.

Scope Statement

Skill operate within single repo, single bounded context (e.g., one API -- Order, User, Pricing). Cover tactical DDD pattern only -- not strategic DDD (no context map, no microservice topology, no bounded context integration).

If task appear span multiple bounded context (e.g., Order feature call Shipping logic), flag before proceed: "This task touches [Context A] and [Context B]. Cross-context integration is strategic DDD — outside this skill's scope. Would you like to scope to one context, or proceed knowing cross-context coordination is your responsibility?"

framework:architecture provide structural envelope -- where code live, which layer exist, which direction dependency flow. This skill define how craft domain within envelope: rich model, invariant, aggregate boundary, ubiquitous language.

See ./references/defaults.md for aggregate design rules, entity/value object/domain service/domain event/repository/creation patterns with code examples, inline anti-pattern warnings, and decomposition guide.

What ships with it: 1 file

10.2 KB alongside SKILL.md

references/

Gives 0 of the 12 instructions most design frontend skills give in ~1.1k tokens

Counted across 1,179 of the 2,086 authors here whose files we hold, read 2026-09-06

  • Commit to a bold aesthetic directionin 31 of 1179, across 24 files
  • Prefer component composition over inheritancein 28 of 1179, across 14 files
  • Animate only transform and opacity propertiesin 27 of 1179, across 22 files
  • Memoize expensive computations with useMemoin 26 of 1179, across 13 files
  • Use semantic HTML elementsin 24 of 1179, across 23 files
  • Virtualize long lists for performancein 21 of 1179, across 10 files
  • Use CSS variables for design tokensin 20 of 1179, across 14 files
  • Implement loading, empty, and error statesin 20 of 1179
  • Lazy load heavy components with Suspensein 19 of 1179, across 8 files
  • Respect prefers-reduced-motion media queriesin 18 of 1179, across 10 files
  • Prioritize CSS-only animations for HTMLin 18 of 1179, across 16 files
  • Use compound components for related UI elementsin 18 of 1179, across 7 files

Said here and by no other author read

  • Define entities with identity for tracked objects
  • Enforce business rules within domain entities
  • Keep aggregates small to maintain transactional consistency
  • Use domain events for cross-aggregate state changes
  • Place stateless logic spanning multiple entities in domain services
  • Encapsulate complex aggregate creation in factory methods

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.