ddd-domain-model-extractor

Analyzes existing non-DDD code and proposes domain models with aggregates, entities, and value objects.

Updated Jun 23, 2026
One-click install
npx skills add https://github.com/j5ik2o/marp-ai-base --skill ddd-domain-model-extractor-j5ik2o
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-domain-model-extractor
Source: https://github.com/j5ik2o/marp-ai-base/tree/main/.agents/skills/ddd-domain-model-extractor
Command: npx skills add https://github.com/j5ik2o/marp-ai-base --skill ddd-domain-model-extractor-j5ik2o

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Legacy codebases often lack explicit domain modeling, scattering business rules across services, controllers, and DTOs. This Skill analyzes existing code that was not designed with DDD and proposes a structured domain model, making it easier to plan a migration to domain-driven design. ## Core Features & Use Cases - Domain Model Extraction: Identifies aggregates, local entities, value objects, and domain services from existing code, database schemas, and transaction boundaries. - Pseudocode Proposals: Generates language-agnostic pseudocode for each model including properties, factory methods, command/query methods, and invariants. - Structured Output: Produces a Markdown proposal document with aggregate relationship diagrams and a mapping table between existing code and proposed models. - Use Case: Point it at a legacy order management module and receive a proposed Order aggregate with OrderItem local entities, Money and Address value objects, plus documented invariants and consistency boundaries. ## Quick Start Analyze the code in the src/orders directory and propose a DDD domain model with aggregates and value objects.

Frequently Asked Questions about ddd-domain-model-extractor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract a domain model from legacy code?

Analyze the existing code in phases: map the directory structure, inspect data structures and DB schemas, locate scattered business logic, and identify transaction boundaries. Then derive value objects, aggregates, local entities, and domain services from those signals.

How to identify aggregate boundaries in existing code?

Look for data groups always updated within the same transaction, classes that form CRUD units, and objects accessed directly rather than through a parent. Tables referenced by foreign keys are aggregate root candidates, while child tables accessed only via parents become local entities.

What is the difference between an aggregate and a local entity?

An aggregate has a root ID, is retrieved independently, and defines a consistency boundary. A local entity has its own ID but is only accessed through its parent aggregate and shares the parent's lifecycle.

Does this approach work for any programming language?

Yes, the analysis is language-independent. It works from structural signals like classes, database schemas, and transaction boundaries, and outputs language-agnostic pseudocode rather than framework-specific implementations.

When should code not be mapped one-to-one to aggregates?

Avoid mapping one class or table to one aggregate. Multiple classes may form a single aggregate, one class may split into several, and table structures reflect persistence concerns rather than domain boundaries. Keep aggregates small and split when in doubt.