extract-domain-concepts
Maps domain model components — Entities, Value Objects, Aggregates, Services, Events, Repositories. Builds Ubiquitous Language glossary connecting code names to business terminology.
Best use case
extract-domain-concepts is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Maps domain model components — Entities, Value Objects, Aggregates, Services, Events, Repositories. Builds Ubiquitous Language glossary connecting code names to business terminology.
Teams using extract-domain-concepts should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/extract-domain-concepts/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How extract-domain-concepts Compares
| Feature / Agent | extract-domain-concepts | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Maps domain model components — Entities, Value Objects, Aggregates, Services, Events, Repositories. Builds Ubiquitous Language glossary connecting code names to business terminology.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Domain Concepts Extractor
## Overview
Extracts and catalogs all domain model components from the codebase, maps relationships between them, and builds a Ubiquitous Language glossary that connects technical class names to business concepts.
## Domain Component Detection
### Entities
```bash
# DDD entities
Glob: "**/Domain/**/Entity/*.php"
Glob: "**/Domain/**/*Entity.php"
Grep: "class.*Entity|extends.*Entity" --glob "**/Domain/**/*.php"
# Doctrine entities
Grep: "#\\[ORM\\\\Entity" --glob "**/*.php"
Grep: "@ORM\\\\Entity" --glob "**/*.php"
# Identity markers
Grep: "function getId|private.*\\$id|readonly.*Id \\$id" --glob "**/Domain/**/*.php"
```
### Value Objects
```bash
# Explicit Value Objects
Glob: "**/Domain/**/ValueObject/*.php"
Glob: "**/ValueObject/**/*.php"
Grep: "class.*ValueObject|extends.*ValueObject" --glob "**/*.php"
# Readonly classes in Domain (likely VOs)
Grep: "readonly class" --glob "**/Domain/**/*.php"
# Common VO patterns
Grep: "class (Email|Money|Address|PhoneNumber|Name|Quantity|Price|DateRange)" --glob "**/*.php"
# Self-validating constructors (VO pattern)
Grep: "private function __construct" --glob "**/Domain/**/*.php"
```
### Aggregates
```bash
# Explicit aggregates
Grep: "class.*Aggregate|extends.*AggregateRoot" --glob "**/*.php"
Glob: "**/Domain/**/Aggregate/*.php"
# Aggregate behavior (event recording)
Grep: "function (recordEvent|raise|apply)" --glob "**/Domain/**/*.php"
# Classes with multiple entity relationships
Grep: "private.*Collection|private.*array.*\\$" --glob "**/Domain/**/*.php"
```
### Domain Events
```bash
# Event classes
Glob: "**/Domain/**/Event/*.php"
Grep: "class.*Event|extends.*DomainEvent" --glob "**/Domain/**/*.php"
# Event data (what happened)
Grep: "readonly class.*Event" --glob "**/*.php"
Grep: "function __construct" --glob "**/Domain/**/Event/**/*.php"
```
### Domain Services
```bash
# Domain services
Glob: "**/Domain/**/Service/*.php"
Grep: "class.*Service" --glob "**/Domain/**/*.php"
# Services with domain logic (not infrastructure)
# Read files and check for: no external dependencies, pure domain logic
```
### Repositories
```bash
# Repository interfaces (Domain)
Grep: "interface.*Repository" --glob "**/Domain/**/*.php"
# Repository methods
Grep: "function (find|findBy|save|remove|nextIdentity|exists)" --glob "**/Domain/**/*.php"
# Repository implementations (Infrastructure)
Grep: "implements.*Repository" --glob "**/Infrastructure/**/*.php"
```
### Enumerations
```bash
# PHP 8.1+ enums
Grep: "^enum " --glob "**/Domain/**/*.php"
# Backed enums
Grep: "enum.*: string|enum.*: int" --glob "**/Domain/**/*.php"
# Status/Type enums
Grep: "enum.*(Status|Type|State|Category|Priority|Role)" --glob "**/*.php"
```
### Specifications
```bash
# Specification pattern
Grep: "class.*Specification|implements.*Specification" --glob "**/*.php"
Grep: "function isSatisfiedBy" --glob "**/*.php"
```
## Analysis Process
1. **Discover** — Find all domain components using patterns above
2. **Read** — Read each component to understand its purpose
3. **Classify** — Categorize by DDD building block type
4. **Map relationships** — Identify which entities belong to which aggregates
5. **Build glossary** — Translate class names to business terms
### Relationship Mapping
For each aggregate:
- Which entities it contains
- Which value objects it uses
- Which events it raises
- Which repository manages it
```bash
# Find relationships by reading constructor and use statements
Read: aggregate file
# Extract: constructor parameters, property types, use statements
```
## Output Format
```markdown
## Domain Model
### Component Summary
| Type | Count | Examples |
|------|-------|---------|
| Entities | 12 | Order, Customer, Product |
| Value Objects | 18 | Money, Email, Address |
| Aggregates | 4 | Order, Customer, Product, Catalog |
| Domain Events | 8 | OrderCreated, PaymentReceived |
| Domain Services | 3 | PricingService, ShippingCalculator |
| Repositories | 6 | OrderRepository, CustomerRepository |
| Enumerations | 5 | OrderStatus, PaymentMethod |
### Aggregate Map
#### Order Aggregate
```
Order (Aggregate Root)
├── OrderId (Value Object) — unique identifier
├── OrderItem[] (Entity) — line items
│ ├── ProductId (Value Object) — reference to Product
│ ├── Quantity (Value Object) — item quantity
│ └── Price (Value Object) — item price
├── Money (Value Object) — total amount
├── OrderStatus (Enum) — current status
├── ShippingAddress (Value Object) — delivery address
└── Events:
├── OrderCreated
├── OrderConfirmed
└── OrderShipped
```
### Ubiquitous Language Glossary
| Business Term | Code Name | Type | Description |
|---------------|-----------|------|-------------|
| Order | `Order` | Aggregate | A customer's purchase request |
| Line Item | `OrderItem` | Entity | Single product in an order |
| Price | `Money` | Value Object | Amount with currency |
| Order Number | `OrderId` | Value Object | Unique order identifier |
| Customer | `Customer` | Aggregate | Person who places orders |
| Shipping Address | `ShippingAddress` | Value Object | Delivery destination |
| Order Status | `OrderStatus` | Enum | pending, confirmed, shipped, delivered |
### Entity Relationship Diagram Data
| Entity | Relates To | Relationship | Description |
|--------|-----------|--------------|-------------|
| Order | Customer | belongs-to | Order placed by Customer |
| Order | OrderItem | has-many | Order contains items |
| OrderItem | Product | references | Item refers to Product |
| Payment | Order | belongs-to | Payment for an Order |
### Bounded Context Map (if multi-context)
| Context | Aggregates | Shared Concepts |
|---------|-----------|----------------|
| Order | Order, OrderItem | CustomerId, ProductId |
| Customer | Customer, Address | CustomerId |
| Payment | Payment, Transaction | OrderId, Money |
| Catalog | Product, Category | ProductId |
```
## Glossary Building Rules
1. **Use business names** — "Shopping Cart" not "CartAggregate"
2. **Define relationships** — "A Customer places Orders"
3. **Include synonyms** — "Purchase" = "Order" in this context
4. **Note ambiguities** — "Account" means different things in different contexts
5. **Map to code** — Always link to the actual class
## Integration
This skill is used by:
- `business-logic-analyst` — provides domain model documentation
- `explain-business-process` — references domain concepts
- `extract-business-rules` — connects rules to domain entities
- `diagram-designer` — generates class/ER diagrams from this dataRelated Skills
extract-state-machine
Detects state machines from enums, status fields, switch/match statements, and transition methods. Extracts states, transitions, guards, and actions to build state diagram data.
extract-business-rules
Extracts validation rules, guards, business constraints, authorization rules, and invariants from domain code. Maps technical implementations to business terminology for non-technical stakeholders.
create-domain-service
Generates DDD Domain Services for PHP 8.4. Creates stateless services for business logic that doesn't belong to entities or value objects. Includes unit tests.
create-domain-event
Generates DDD Domain Events for PHP 8.4. Creates immutable event records with metadata, past-tense naming. Includes unit tests.
yii-knowledge
Yii framework knowledge base. Provides Yii3 modular architecture, DDD integration, PSR-7/PSR-15 compliance, persistence, DI, security (RBAC, auth), event system (PSR-14), queue/jobs, infrastructure components (cache, rate limiter, HTTP client), testing, and antipatterns for Yii PHP projects.
troubleshooting-template
Generates troubleshooting guides and FAQ sections for PHP projects. Creates problem-solution documentation.
trace-request-lifecycle
Traces full request lifecycle from Router through Middleware, Controller, UseCase, Repository to Response. Documents HTTP methods, routes, middleware stack, response codes, and error handling paths.
trace-data-transformation
Maps data transformation chains — Request DTO to Command to Entity to Response DTO. Identifies mappers, serializers, type conversions, and data loss points across layer boundaries.
testing-knowledge
Testing knowledge base for PHP 8.4 projects. Provides testing pyramid, AAA pattern, naming conventions, isolation principles, DDD testing guidelines, and PHPUnit patterns.
task-progress-knowledge
TaskCreate pattern guidelines for progress tracking in coordinator agents
symfony-knowledge
Symfony framework knowledge base. Provides architecture, DDD integration, persistence, DI, security, messenger, workflow, events, infrastructure components, testing, and antipatterns for Symfony PHP projects.
suggest-testability-improvements
Suggests testability improvements for PHP code. Provides DI refactoring suggestions, mock opportunities, interface extraction, testing strategy recommendations.