acc-extract-domain-concepts
npx skills add https://github.com/dykyi-roman/awesome-claude-code --skill acc-extract-domain-concepts
Agent 安装分布
Skill 文档
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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# Specification pattern
Grep: "class.*Specification|implements.*Specification" --glob "**/*.php"
Grep: "function isSatisfiedBy" --glob "**/*.php"
Analysis Process
- Discover â Find all domain components using patterns above
- Read â Read each component to understand its purpose
- Classify â Categorize by DDD building block type
- Map relationships â Identify which entities belong to which aggregates
- 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
# Find relationships by reading constructor and use statements
Read: aggregate file
# Extract: constructor parameters, property types, use statements
Output Format
## 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
- Use business names â “Shopping Cart” not “CartAggregate”
- Define relationships â “A Customer places Orders”
- Include synonyms â “Purchase” = “Order” in this context
- Note ambiguities â “Account” means different things in different contexts
- Map to code â Always link to the actual class
Integration
This skill is used by:
acc-business-logic-analystâ provides domain model documentationacc-explain-business-processâ references domain conceptsacc-extract-business-rulesâ connects rules to domain entitiesacc-diagram-designerâ generates class/ER diagrams from this data