Agent skill

Domain Driven Design

by techygarg in techygarg/lattice

Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode).

MITAuto-check passedDevelopment

Install Domain Driven Design

skills CLI
$ npx skills add techygarg/lattice --skill domain-driven-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install techygarg/lattice domain-driven-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/techygarg/lattice.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/domain-driven-design .claude/skills/domain-driven-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
domain-driven-design
GitHub stars
198
Token cost
~1.9k tokens
SKILL.md length
975 words
Files
2 (incl. references)
Skills in repo
33
Repo updated
First seen
Licence
MIT

At a glance

Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode).

  • Works in 6 steps: Look for .lattice/config.yaml in the… → If found, check paths.ddd_principles for… → If a custom document exists at that… → …
  • Modifying domain models
  • SKILL.md covers Config Resolution, Self-Validation Checklist, Active Anti-Pattern Scan and Ambiguity Signals, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Domain Driven Design is an agent skill from techygarg/lattice. Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode). 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'.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/defaults.md`).

It sits in Development, covering Domain-driven design. The repository describes itself as: Install engineering discipline into any AI coding assistant. Composable skills for design, implementation, review, and team standards. Better process, not just better prompts. The licence is MIT.

When your agent uses it

  • Modifying domain models
  • Designing aggregates
  • Working in the domain layer
  • The user mentions domain

Example prompts

  • “domain”
  • “aggregate”
  • “value object”
  • “/domain-driven-design”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Look for .lattice/config.yaml in the repo root.
  2. If found, check paths.ddd_principles for a custom doc path.
  3. If a custom document exists at that path, read it and check its YAML frontmatter mode
  4. If a custom path is configured but no document exists at it → tell the user which configured path is missing, then read…
  5. If there is no config file or no paths.ddd_principles key → read ./references/defaults.md.
  6. Language adaptation: if paths.language_idioms is set in the config and the document exists, read its "Type System & Object Model" section…

What it can do on your machine

Read from SKILL.md and the folder at commit 4d6c35f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Domain Driven Design loads about 1.9k tokens when it runs, and up to ~4.5k if it reads all its reference files. Until then it costs about 115 tokens; SKILL.md has 975 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from techygarg/lattice at commit 4d6c35f, republished under its MIT licence (© techygarg). 975 words, ~1,880 tokens.

Download SKILL.mdSave it as .claude/skills/domain-driven-design/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
domain-driven-design
description
Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode). 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'.

Domain-Driven Design

Config Resolution

The skill supports project-custom principles. Resolution:

  1. Look for .lattice/config.yaml in the repo root.
  2. If found, check paths.ddd_principles for a custom doc path.
  3. If a custom document exists at that path, read it and check its YAML frontmatter mode:
    • mode: override: the custom doc has full precedence. Use it instead of the embedded default. It must be comprehensive -- sole reference.
    • mode: overlay (or no mode): read the embedded ./references/defaults.md first, then apply the custom doc on top. A custom section replaces the matching default section (matched by heading); new sections append after the defaults.
  4. If a custom path is configured but no document exists at it → tell the user which configured path is missing, then read ./references/defaults.md.
  5. If there is no config file or no paths.ddd_principles key → read ./references/defaults.md.
  6. Language adaptation: if paths.language_idioms is set in the config and the document exists, read its "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 checks before proceeding. If any check fails, fix before presenting. If a check is a judgment call with multiple valid approaches (see Ambiguity Signals), flag it — present options and reasoning rather than silently choosing; if framework:collaborative-judgment is loaded, use its presentation format.

  1. ENTITY VS VALUE OBJECT: For each domain object — does the business track individual instances over time? Yes → entity with identity. No → value object, immutable and self-validating.
  2. AGGREGATE BOUNDARY: Does a transactional invariant require this object inside the aggregate? If not → reference it from a separate aggregate by ID.
  3. RICH BEHAVIOR: Does the entity have methods that enforce business rules, guard state transitions, raise events? If the entity is just a data holder → move logic from services into the entity.
  4. VALUE OBJECT COVERAGE: Scan for primitives that should be value objects — string emails, number amounts, raw UUIDs as identifiers → wrap in a validating value object.
  5. AGGREGATE COHESION: List the business rules the root enforces. Does every internal entity participate in at least one invariant? If not → it belongs in its own aggregate.
  6. DOMAIN EVENTS: Should a domain event be raised — a state transition another aggregate reacts to, a change triggering notification, an audit/compliance requirement? Do not raise events for internal changes nothing reacts to.
  7. DOMAIN SERVICE: Does stateless logic spanning multiple entities belong in a domain service rather than an application service? Keep I/O and infrastructure calls out of it.
  8. FACTORY: Is complex aggregate creation encapsulated behind a factory method (Order.create(...)) or a standalone factory class? Are initial creation and reconstitution from persistence handled separately?

All checks pass → state "Passes domain-driven-design. [next step]."

Active Anti-Pattern Scan

After verifying the checklist above, scan the output for these specific anti-patterns. If you find any, fix before presenting.

  • Anemic Domain Model: Entity is a getter/setter data holder; all logic lives in services → move business rules into entities and value objects
  • Primitive Obsession: Raw string for email, number for money, UUID for ID → wrap in a validating value object with behavior
  • God Aggregate: Aggregate has many entities, loads slowly, high contention → decompose; keep only what shares a transactional invariant
  • Cross-Aggregate Transaction: Service updates two aggregates in one transaction → use domain events and eventual consistency
  • Leaking Domain Logic: Business rule in a controller, application service, or infrastructure → extract into a domain object or domain service
  • Misidentified Entity/Value Object: Entity without a lifecycle, or value object with tracked identity → apply the identity test
Show full SKILL.md (372 more words)Show less

Ambiguity Signals

These checks often have multiple valid outcomes. When you encounter one, present the options rather than silently choosing. If framework:collaborative-judgment is loaded, use its presentation format.

  • Aggregate Boundary Size: Small aggregate (more events, eventual consistency) vs large aggregate (simple transaction, immediate consistency). Neither is inherently correct — it depends on contention patterns and invariant scope.
  • Entity vs Value Object: Some concepts (like Address or Money) may or may not need identity depending on domain complexity. Apply the identity test, but acknowledge when borderline.
  • Domain Service vs Entity Method: Logic spanning multiple entities could live in a domain service or be a method on the primary entity. The choice depends on which entity "owns" the invariant.
  • Object Creation Pattern: Factory method on the aggregate root, standalone factory class, builder pattern, or plain constructor — depends on assembly complexity and team convention. Don't prescribe a pattern; ask which approach the team prefers.

Scope Statement

This skill operates within a single repo, single bounded context (e.g., one API -- Order, User, Pricing). It covers tactical DDD patterns only -- not strategic DDD (no context maps, no microservice topology, no bounded-context integration).

If a task appears to span multiple bounded contexts (e.g., an Order feature calling Shipping logic), flag before proceeding: "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?"

Design Mode

When invoked during design — no code is being written; a planning molecule is validating a proposed domain model — apply the same checks as a forward-looking validation:

  1. Take the proposed artifact (aggregate list, entity/value object classification, event set, or contract types) as the unit of validation.
  2. Run the Self-Validation Checklist and Active Anti-Pattern Scan against it — before the model is presented for user approval.
  3. Report violations as concrete findings on the model ("Order aggregates both pricing and fulfillment state — split by transactional invariant"), not generic advice. Resolve them through the design.
  4. STOP: do not skip evaluation because no code exists yet — the proposed model is what gets validated.

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 a decomposition guide.

© techygarg, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/domain-driven-design of techygarg/lattice.

  • SKILL.md
  • references/defaults.md

Open the folder on GitHubat commit 4d6c35f

Compare with similar skills

Domain Driven Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Domain Driven Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Domain Driven Design this skilltechygarg/lattice198—~1.9kAutomated safety check: PassMIT
Domain Modelingfossasia/eventyay-interpretation1.6k31 repos~821Automated safety check: PassApache-2.0
Architecture Governancezai-org/ZCode7.5k—~1.2kAutomated safety check: PassApache-2.0
Evolutionary Modular Architecturetech-leads-club/agent-skills7k—~3.7kAutomated safety check: PassCC-BY-4.0
Domain Modelingbrim-borium/spotify_sdk1665 repos~806Automated safety check: PassApache-2.0
Domain Modeling and Glossarywindmill-labs/windmill18k—~622Automated safety check: PassCustom licence

Similar skills

  • Domain Modeling

    fossasia/eventyay-interpretation

    Build and sharpen a project's domain model. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 31 repos~821 tokens
    DevelopmentAuto-check passed
  • Apply the repository's architecture policy to code changes by generating a bounded context package, checking module and layer boundaries, and reporting baseline-aware violations.

    7.5k GitHub stars~1.2k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Evolutionary Modular Architecture

    tech-leads-club/agent-skills

    Guides design of modular-monolith platforms with DDD, flat-by-aggregate modules, anti-corruption layers, outbox events and resilience, plus an architecture document with SVG diagrams.

    7k GitHub stars~3.7k tokensUpdated 18 days ago
    DevelopmentAuto-check passed
  • Domain Modeling

    brim-borium/spotify_sdk

    Build and sharpen a project's domain model. An agent skill from brim-borium/spotify_sdk.

    166 GitHub starsUsed in 5 repos~806 tokens
    DevelopmentAuto-check passed
  • Domain Modeling and Glossary

    windmill-labs/windmill

    Actively challenges vague or conflicting terminology as you design, and keeps a living domain glossary file up to date in real time.

    18k GitHub stars~622 tokensUpdated today
    DevelopmentAuto-check passed
  • Ddd

    swamp-club/swamp

    Domain Driven Design guidance for TypeScript/Deno codebases.

    644 GitHub stars~1.4k tokensUpdated today
    DevelopmentAuto-check passed

More from techygarg/lattice

All 33 skills in this repo
  • Architecture Compass

    techygarg/lattice

    Architectural thinking partner for an existing repository — scans the codebase, conducts a structured interview, agrees on current architectural state and recommended direction, and produces a…

    198 GitHub stars~4.4k tokensUpdated 2 days ago
    Auto-check passed
  • Lattice Init

    techygarg/lattice

    Guided setup and upgrade-check experience for Lattice projects -- scans the repository, detects existing configuration and outdated conventions, suggests refiners and available upgrades in priority…

    198 GitHub stars~3.3k tokensUpdated 2 days ago
    Auto-check passed
  • Skill Align

    techygarg/lattice

    Audit and fix all Lattice documentation, README, docs/, PROJECT.md, GitHub issue templates, and CLAUDE.md to ensure they are fully aligned with the current skill inventory.

    198 GitHub stars~2k tokensUpdated 2 days ago
    Auto-check passed
  • Skill Validate

    techygarg/lattice

    Validate any Lattice SKILL.md against all tier conventions — atoms, molecules, and refiners.

    198 GitHub stars~1.5k tokensUpdated 2 days ago
    Auto-check passed
  • Architecture Refiner

    techygarg/lattice

    Facilitate a structured conversation to define architecture principles for a repository.

    198 GitHub stars~3.7k tokensUpdated 2 days ago
    Auto-check passed
  • Clean Code Refiner

    techygarg/lattice

    Facilitate a structured conversation to define clean code principles for a repository.

    198 GitHub stars~3k tokensUpdated 2 days ago
    Auto-check passed

Categories

Questions about Domain Driven Design

What does Domain Driven Design do?

Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode). Domain Driven Design is an agent skill from techygarg/lattice. Apply DDD tactical patterns when working with domain code, and validate proposed domain models before approval (design mode).

When should I use Domain Driven Design?

Domain Driven Design fits situations like: modifying domain models; designing aggregates; working in the domain layer; the user mentions domain.

How do I install Domain Driven Design in Claude Code?

Run `npx skills add techygarg/lattice --skill domain-driven-design -a claude-code`. Or copy the skill folder (skills/domain-driven-design in techygarg/lattice) into .claude/skills/domain-driven-design in your project. Claude Code loads it when a task matches its description.

How do I install Domain Driven Design in Codex?

Run `npx skills add techygarg/lattice --skill domain-driven-design -a codex`. Or copy the skill folder (skills/domain-driven-design in techygarg/lattice) into .agents/skills/domain-driven-design in your project. Codex loads it when a task matches its description.

Can I use Domain Driven Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add techygarg/lattice --skill domain-driven-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/domain-driven-design, .gemini/skills/domain-driven-design, .github/skills/domain-driven-design and .opencode/skills/domain-driven-design in your project.

What does Domain Driven Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Domain Driven Design is instructions for the agent only.

Does Domain Driven Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Domain Driven Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Domain Driven Design use?

Domain Driven Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Domain Driven Design use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.6k tokens, read only when the agent opens those files.

What are the alternatives to Domain Driven Design?

Skills that share tags, products or a category with Domain Driven Design: Domain Modeling (fossasia/eventyay-interpretation, 1.6k stars), Architecture Governance (zai-org/ZCode, 7.5k stars), Evolutionary Modular Architecture (tech-leads-club/agent-skills, 7k stars) and Domain Modeling (brim-borium/spotify_sdk, 166 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Domain Driven Design?

techygarg (a GitHub user) maintains it in techygarg/lattice, which has 198 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 6, 2026.

Source: techygarg/lattice on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.