
Domain Identification Grouping
- 165 installs
- 5k repo stars
- Updated August 4, 2026
- tech-leads-club/agent-skills
Use domain-identification-grouping for development tasks
About
domain-identification-grouping: A skill for development. This provides functionality for development workflows.
- domain-identification-grouping
Domain Identification Grouping by the numbers
- 165 all-time installs (skills.sh)
- +9 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #2,345 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tech-leads-club/agent-skills --skill domain-identification-groupingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 165 |
|---|---|
| repo stars | ★ 5k |
| Last updated | August 4, 2026 |
| Repository | tech-leads-club/agent-skills ↗ |
What it does
Use domain-identification-grouping for development tasks
Files
Domain Identification and Grouping
This skill groups architectural components into logical domains (business areas) to prepare for creating domain services in a service-based architecture.
How to Use
Quick Start
Request analysis of your codebase:
- "Group components into logical domains"
- "Identify component domains for service-based architecture"
- "Create domain groupings from components"
- "Analyze which components belong to which domains"
Usage Examples
Example 1: Domain Identification
User: "Group components into logical domains"
The skill will:
1. Analyze component responsibilities and relationships
2. Identify business domains based on functionality
3. Group components into domains
4. Create domain diagrams
5. Suggest namespace refactoring for domain alignmentExample 2: Domain Analysis
User: "Which domain should the billing components belong to?"
The skill will:
1. Analyze billing component functionality
2. Check relationships with other components
3. Identify appropriate domain (e.g., Customer or Financial)
4. Recommend domain assignmentExample 3: Domain Refactoring
User: "What namespace refactoring is needed to align components with domains?"
The skill will:
1. Compare current component namespaces to identified domains
2. Identify misaligned components
3. Suggest namespace changes
4. Create refactoring planStep-by-Step Process
1. Identify Domains: Analyze business capabilities and component relationships 2. Group Components: Assign components to appropriate domains 3. Validate Groupings: Ensure components fit well in their domains 4. Refactor Namespaces: Align component namespaces with domains 5. Create Domain Map: Visualize domain structure and component groupings
When to Use
Apply this skill when:
- After identifying, sizing, and analyzing component dependencies
- Before creating domain services (Pattern 6)
- When planning service-based architecture migration
- Analyzing component relationships and business alignment
- Preparing for domain-driven design implementation
- Grouping components for better organization
Core Concepts
Domain Definition
A domain is a logical grouping of components that:
- Represents a distinct business capability or area
- Contains related components that work together
- Has clear boundaries and responsibilities
- Can become a domain service in service-based architecture
Examples:
- Customer Domain: Customer profile, billing, support contracts
- Ticketing Domain: Ticket creation, assignment, routing, completion
- Reporting Domain: Ticket reports, expert reports, financial reports
Component Domain Relationship
One-to-Many: A single domain contains multiple components
Domain: Customer
├── Component: Customer Profile
├── Component: Billing Payment
├── Component: Billing History
└── Component: Support ContractDomain Manifestation
Domains are physically manifested through namespace structure:
Before Domain Alignment:
services/billing/payment
services/billing/history
services/customer/profile
services/supportcontractAfter Domain Alignment:
services/customer/billing/payment
services/customer/billing/history
services/customer/profile
services/customer/supportcontractNotice how all customer-related functionality is grouped under .customer domain.
Analysis Process
Phase 1: Identify Business Domains
Analyze the codebase to identify distinct business domains:
1. Examine Component Responsibilities
- Read component names and descriptions
- Understand what each component does
- Identify business capabilities
2. Look for Business Language
- Group components by business vocabulary
- Example: "billing", "payment", "invoice" → Financial domain
- Example: "customer", "profile", "contract" → Customer domain
3. Identify Domain Boundaries
- Where do business concepts change?
- What are the distinct business areas?
- How do components relate to business capabilities?
4. Collaborate with Business Stakeholders
- Validate domain identification with product owners
- Ensure domains align with business understanding
- Get feedback on domain boundaries
Example Domain Identification:
## Identified Domains
1. **Ticketing Domain** (ss.ticket)
- Ticket creation, assignment, routing, completion
- Customer surveys
- Knowledge base
2. **Customer Domain** (ss.customer)
- Customer profile
- Billing and payment
- Support contracts
3. **Reporting Domain** (ss.reporting)
- Ticket reports
- Expert reports
- Financial reports
4. **Admin Domain** (ss.admin)
- User maintenance
- Expert profile management
5. **Shared Domain** (ss.shared)
- Login
- NotificationPhase 2: Group Components into Domains
Assign each component to an appropriate domain:
1. Analyze Component Functionality
- What business capability does it support?
- What domain vocabulary does it use?
- What other components does it relate to?
2. Check Component Relationships
- Which components are frequently used together?
- What are the dependencies between components?
- Do components share data or workflows?
3. Assign to Domain
- Place component in domain that best fits its functionality
- Ensure component aligns with domain's business language
- Verify component relationships support domain grouping
4. Handle Edge Cases
- Components that don't fit clearly: Analyze more deeply
- Components that fit multiple domains: Choose primary domain
- Shared components: May belong to Shared domain
Example Component Grouping:
## Component Domain Assignment
### Ticketing Domain (ss.ticket)
- Ticket Shared (ss.ticket.shared)
- Ticket Maintenance (ss.ticket.maintenance)
- Ticket Completion (ss.ticket.completion)
- Ticket Assign (ss.ticket.assign)
- Ticket Route (ss.ticket.route)
- KB Maintenance (ss.ticket.kb.maintenance)
- KB Search (ss.ticket.kb.search)
- Survey (ss.ticket.survey)
### Customer Domain (ss.customer)
- Customer Profile (ss.customer.profile)
- Billing Payment (ss.customer.billing.payment)
- Billing History (ss.customer.billing.history)
- Support Contract (ss.customer.supportcontract)
### Reporting Domain (ss.reporting)
- Reporting Shared (ss.reporting.shared)
- Ticket Reports (ss.reporting.tickets)
- Expert Reports (ss.reporting.experts)
- Financial Reports (ss.reporting.financial)Phase 3: Validate Domain Groupings
Ensure components fit well in their assigned domains:
1. Check Cohesion
- Do components in domain share business language?
- Are components frequently used together?
- Do components have direct relationships?
2. Verify Boundaries
- Are domain boundaries clear?
- Do components belong to only one domain?
- Are there components that don't fit anywhere?
3. Assess Completeness
- Are all components assigned to a domain?
- Are domains cohesive and well-formed?
- Do domains represent distinct business capabilities?
4. Get Stakeholder Validation
- Review domain groupings with product owners
- Ensure domains align with business understanding
- Get feedback on domain boundaries
Validation Checklist:
- [ ] All components assigned to a domain
- [ ] Domains have clear boundaries
- [ ] Components fit well in their domains
- [ ] Domains represent distinct business capabilities
- [ ] Stakeholders validate domain groupings
Phase 4: Refactor Namespaces for Domain Alignment
Align component namespaces with identified domains:
1. Compare Current vs Target Namespaces
- Current:
services/billing/payment - Target:
services/customer/billing/payment - Change: Add
.customerdomain node
2. Identify Refactoring Needed
- Which components need namespace changes?
- What domain nodes need to be added?
- Are there components already aligned?
3. Create Refactoring Plan
- List components needing namespace changes
- Specify target namespace for each
- Prioritize refactoring work
4. Execute Refactoring
- Update component namespaces
- Update imports/references
- Verify all references updated
Example Namespace Refactoring:
## Namespace Refactoring Plan
### Customer Domain Alignment
| Component | Current Namespace | Target Namespace | Action |
| ---------------- | ------------------- | --------------------------- | ------------- |
| Billing Payment | ss.billing.payment | ss.customer.billing.payment | Add .customer |
| Billing History | ss.billing.history | ss.customer.billing.history | Add .customer |
| Customer Profile | ss.customer.profile | ss.customer.profile | No change |
| Support Contract | ss.supportcontract | ss.customer.supportcontract | Add .customer |
### Ticketing Domain Alignment
| Component | Current Namespace | Target Namespace | Action |
| -------------- | ----------------- | ------------------------ | ----------- |
| KB Maintenance | ss.kb.maintenance | ss.ticket.kb.maintenance | Add .ticket |
| KB Search | ss.kb.search | ss.ticket.kb.search | Add .ticket |
| Survey | ss.survey | ss.ticket.survey | Add .ticket |Phase 5: Create Domain Map
Visualize domain structure and component groupings:
1. Create Domain Diagram
- Show domains as boxes
- Show components within each domain
- Show relationships between domains
2. Document Domain Structure
- List domains and their components
- Describe domain responsibilities
- Note domain boundaries
3. Create Domain Inventory
- Table of domains and components
- Component counts per domain
- Size metrics per domain
Example Domain Map:
## Domain Map┌─────────────────────────────────────┐ │ Ticketing Domain (ss.ticket) │ ├─────────────────────────────────────┤ │ • Ticket Shared │ │ • Ticket Maintenance │ │ • Ticket Completion │ │ • Ticket Assign │ │ • Ticket Route │ │ • KB Maintenance │ │ • KB Search │ │ • Survey │ └─────────────────────────────────────┘ │ │ uses ▼ ┌─────────────────────────────────────┐ │ Customer Domain (ss.customer) │ ├─────────────────────────────────────┤ │ • Customer Profile │ │ • Billing Payment │ │ • Billing History │ │ • Support Contract │ └─────────────────────────────────────┘
````
Output Format
Domain Identification Report
## Domain Identification
### Domain: Customer (ss.customer)
**Business Capability**: Manages customer relationships, billing, and support contracts
**Components**:
- Customer Profile (ss.customer.profile)
- Billing Payment (ss.customer.billing.payment)
- Billing History (ss.customer.billing.history)
- Support Contract (ss.customer.supportcontract)
**Component Count**: 4
**Total Size**: ~15,000 statements (18% of codebase)
**Domain Cohesion**: ✅ High
- Components share customer-related vocabulary
- Components frequently used together
- Direct relationships between components
**Boundaries**:
- Clear separation from Ticketing domain
- Clear separation from Reporting domain
- Shared components (Notification) used by all domainsComponent Domain Assignment Table
## Component Domain Assignment
| Component | Current Namespace | Assigned Domain | Target Namespace |
| ------------------ | --------------------- | --------------- | --------------------------------- |
| Customer Profile | ss.customer.profile | Customer | ss.customer.profile (no change) |
| Billing Payment | ss.billing.payment | Customer | ss.customer.billing.payment |
| Ticket Maintenance | ss.ticket.maintenance | Ticketing | ss.ticket.maintenance (no change) |
| KB Maintenance | ss.kb.maintenance | Ticketing | ss.ticket.kb.maintenance |
| Reporting Shared | ss.reporting.shared | Reporting | ss.reporting.shared (no change) |Namespace Refactoring Plan
## Namespace Refactoring Plan
### Priority: High
**Customer Domain Alignment**
**Components to Refactor**:
1. Billing Payment: `ss.billing.payment` → `ss.customer.billing.payment`
2. Billing History: `ss.billing.history` → `ss.customer.billing.history`
3. Support Contract: `ss.supportcontract` → `ss.customer.supportcontract`
**Steps**:
1. Update namespace declarations in source files
2. Update import statements in dependent components
3. Update directory structure
4. Run tests to verify changes
5. Update documentation
**Expected Impact**:
- All customer-related components aligned under `.customer` domain
- Clearer domain boundaries
- Easier to identify domain componentsDomain Map Visualization
## Domain Map
### Domain StructureCustomer Domain (ss.customer) ├── Customer Profile ├── Billing Payment ├── Billing History └── Support Contract
Ticketing Domain (ss.ticket) ├── Ticket Shared ├── Ticket Maintenance ├── Ticket Completion ├── Ticket Assign ├── Ticket Route ├── KB Maintenance ├── KB Search └── Survey
Reporting Domain (ss.reporting) ├── Reporting Shared ├── Ticket Reports ├── Expert Reports └── Financial Reports
Admin Domain (ss.admin) ├── User Maintenance └── Expert Profile
Shared Domain (ss.shared) ├── Login └── Notification
### Domain Relationships
Ticketing Domain │ uses ├─→ Shared Domain (Login, Notification) └─→ Customer Domain (Customer Profile)
Customer Domain │ uses └─→ Shared Domain (Login, Notification)
Reporting Domain │ uses ├─→ Ticketing Domain (Ticket data) ├─→ Customer Domain (Customer data) └─→ Shared Domain (Login)
Analysis Checklist
Domain Identification:
- [ ] Analyzed component responsibilities
- [ ] Identified business capabilities
- [ ] Identified distinct business domains
- [ ] Validated domains with stakeholders
Component Grouping:
- [ ] Assigned each component to a domain
- [ ] Analyzed component relationships
- [ ] Ensured components fit domain vocabulary
- [ ] Handled edge cases (shared components, unclear assignments)
Domain Validation:
- [ ] Checked cohesion within domains
- [ ] Verified domain boundaries are clear
- [ ] Ensured all components assigned
- [ ] Validated with stakeholders
Namespace Refactoring:
- [ ] Compared current vs target namespaces
- [ ] Identified components needing refactoring
- [ ] Created refactoring plan
- [ ] Prioritized refactoring work
Domain Mapping:
- [ ] Created domain diagram
- [ ] Documented domain structure
- [ ] Created domain inventory table
- [ ] Documented domain relationships
Implementation Notes
For Node.js/Express Applications
Domains typically organized in services/ directory:
services/
├── customer/ ← Customer Domain
│ ├── profile/
│ ├── billing/
│ │ ├── payment/
│ │ └── history/
│ └── supportcontract/
├── ticket/ ← Ticketing Domain
│ ├── shared/
│ ├── maintenance/
│ ├── assign/
│ └── route/
└── reporting/ ← Reporting Domain
├── shared/
├── tickets/
└── experts/For Java Applications
Domains identified by package structure:
com.company.customer ← Customer Domain
├── profile
├── billing
│ ├── payment
│ └── history
└── supportcontract
com.company.ticket ← Ticketing Domain
├── shared
├── maintenance
├── assign
└── routeDomain Identification Strategies
Strategy 1: Business Capability Analysis
- Identify what business capabilities the system provides
- Group components by capability
- Example: "Customer Management" capability → Customer Domain
Strategy 2: Vocabulary Analysis
- Identify business vocabulary used by components
- Group components sharing same vocabulary
- Example: Components using "billing", "payment", "invoice" → Financial Domain
Strategy 3: Relationship Analysis
- Identify components frequently used together
- Group components with strong relationships
- Example: Components that share data/workflows → Same Domain
Strategy 4: Stakeholder Collaboration
- Work with product owners/business analysts
- Use their understanding of business areas
- Validate domain boundaries with them
Fitness Functions
After creating domains, create automated checks:
Domain Namespace Governance
// Ensure components belong to correct domain
function validateDomainNamespaces(components, domainRules) {
const violations = []
components.forEach((comp) => {
const domain = identifyDomain(comp.namespace)
const expectedDomain = domainRules[comp.name]
if (domain !== expectedDomain) {
violations.push({
component: comp.name,
currentDomain: domain,
expectedDomain: expectedDomain,
namespace: comp.namespace,
})
}
})
return violations
}Domain Boundary Enforcement
// Prevent components from accessing other domains directly
function enforceDomainBoundaries(components) {
const violations = []
components.forEach((comp) => {
comp.imports.forEach((imp) => {
const importedDomain = identifyDomain(imp)
const componentDomain = identifyDomain(comp.namespace)
if (importedDomain !== componentDomain && importedDomain !== 'shared') {
violations.push({
component: comp.name,
domain: componentDomain,
importsFrom: imp,
importedDomain: importedDomain,
issue: 'Cross-domain direct dependency',
})
}
})
})
return violations
}Best Practices
Do's ✅
- Collaborate with business stakeholders to identify domains
- Group components by business capability, not technical layers
- Ensure domains represent distinct business areas
- Validate domain boundaries with stakeholders
- Refactor namespaces to align with domains
- Create clear domain documentation
- Use business language in domain names
Don'ts ❌
- Don't create domains based on technical layers (services, controllers, models)
- Don't force components into domains where they don't fit
- Don't skip stakeholder validation
- Don't create too many small domains (aim for 3-7 domains)
- Don't create domains that are too large (monolithic domains)
- Don't ignore components that don't fit (analyze why)
- Don't skip namespace refactoring (critical for clarity)
Common Domain Patterns
Typical Domains in Business Applications
- Customer Domain: Customer management, profiles, relationships
- Product Domain: Product catalog, inventory, pricing
- Order Domain: Order processing, fulfillment, shipping
- Billing Domain: Invoicing, payments, financial transactions
- Reporting Domain: Reports, analytics, dashboards
- Admin Domain: User management, system configuration
- Shared Domain: Common functionality (login, notification, utilities)
Domain Size Guidelines
- Small Domain: 2-4 components
- Medium Domain: 5-8 components
- Large Domain: 9-15 components
- Too Large: >15 components (consider splitting)
Next Steps
After creating component domains:
1. Apply Create Domain Services Pattern - Extract domains to separate services 2. Plan Service Extraction - Create migration plan for domain services 3. Implement Domain Services - Move domains to separately deployed services 4. Monitor Domain Boundaries - Use fitness functions to enforce boundaries
Notes
- Domains should represent business capabilities, not technical layers
- Domain identification requires collaboration with business stakeholders
- Namespace refactoring is critical for domain clarity
- Domains prepare the codebase for service-based architecture
- Well-formed domains make service extraction easier
- Domain boundaries should be clear and well-documented
Domain Identification & Grouping - Quick Reference
Domain Definition
Domain = Logical grouping of components representing a distinct business capability
Key Characteristics:
- Represents business area, not technical layer
- Contains related components
- Has clear boundaries
- Can become domain service
Domain Identification Strategies
1. Business Capability Analysis
What business capabilities does the system provide?
→ Each capability = Potential domain2. Vocabulary Analysis
What business language do components use?
→ Components sharing vocabulary = Same domain3. Relationship Analysis
Which components are frequently used together?
→ Related components = Same domain4. Stakeholder Collaboration
What do business experts say?
→ Their understanding = Domain boundariesComponent-to-Domain Assignment
Decision Process
Analyze component:
├─ What business capability does it support?
├─ What domain vocabulary does it use?
├─ What other components does it relate to?
└─ Assign to domain that best fitsEdge Cases
- Unclear assignment: Analyze more deeply, check relationships
- Multiple domains: Choose primary domain, document secondary
- Shared functionality: May belong to Shared domain
Namespace Refactoring
Pattern
Before: services/billing/payment After: services/customer/billing/payment
Rule: Add domain node to namespace
Refactoring Steps
1. Update namespace declarations 2. Update import statements 3. Update directory structure 4. Run tests 5. Update documentation
Domain Validation
Checklist
- [ ] All components assigned to a domain
- [ ] Domains have clear boundaries
- [ ] Components fit domain vocabulary
- [ ] Domains represent distinct capabilities
- [ ] Stakeholders validate groupings
Cohesion Check
High Cohesion ✅:
- Components share business language
- Components used together
- Direct relationships
Low Cohesion ❌:
- Different vocabularies
- Rarely used together
- No relationshipsDomain Size Guidelines
| Size | Component Count | Notes |
|---|---|---|
| Small | 2-4 | May need consolidation |
| Medium | 5-8 | Ideal size |
| Large | 9-15 | Monitor for splitting |
| Too Large | >15 | Consider splitting |
Common Domain Patterns
Typical Domains
- Customer: Customer management, profiles, billing
- Product: Catalog, inventory, pricing
- Order: Processing, fulfillment
- Billing: Invoicing, payments
- Reporting: Reports, analytics
- Admin: User management, config
- Shared: Common functionality
Domain Count
Ideal: 3-7 domains Too Many: >10 domains (consider merging) Too Few: <3 domains (consider splitting)
Output Template
## Domain: [Name] ([namespace])
**Business Capability**: [what it does]
**Components**:
- Component 1
- Component 2
**Component Count**: X
**Total Size**: Y statements (Z% of codebase)
**Domain Cohesion**: ✅ High / ⚠️ Medium / ❌ Low
**Boundaries**:
- Clear separation from [Domain A]
- Clear separation from [Domain B]Quick Analysis Steps
1. Identify → Analyze components, find business capabilities 2. Group → Assign components to domains 3. Validate → Check cohesion, boundaries, completeness 4. Refactor → Align namespaces with domains 5. Map → Create domain visualization
Decision Tree
Identify domains
├─ Analyze component responsibilities
├─ Identify business capabilities
├─ Group by vocabulary/relationships
└─ Validate with stakeholders
Assign components
├─ Analyze functionality
├─ Check relationships
├─ Assign to domain
└─ Handle edge cases
Refactor namespaces
├─ Compare current vs target
├─ Identify changes needed
├─ Create refactoring plan
└─ Execute refactoringDomain Identification and Grouping Skill
A skill for grouping architectural components into logical domains (business areas) to prepare for creating domain services in a service-based architecture.
What This Skill Does
This skill analyzes codebases to:
1. Identify business domains based on component responsibilities and business capabilities 2. Group components into domains by analyzing functionality and relationships 3. Validate domain groupings to ensure components fit well 4. Refactor namespaces to align component namespaces with identified domains 5. Create domain maps visualizing domain structure and component groupings 6. Document domain boundaries and relationships 7. Prepare for domain services extraction in service-based architecture
When to Use This Skill
This skill is applied when you:
- Ask to group components into logical domains
- Request domain identification for service-based architecture
- Need help creating component domains
- Want to analyze which components belong to which domains
- Ask about domain grouping or organization
- Plan to create domain services
- Discuss component-to-domain mapping
Key Features
Business-Focused Domain Identification
This skill focuses on business capabilities, not technical layers:
- Groups components by business vocabulary and capabilities
- Identifies domains based on what the business does
- Ensures domains represent distinct business areas
- Requires collaboration with business stakeholders
Multiple Identification Strategies
Uses multiple approaches to identify domains:
1. Business Capability Analysis: What business capabilities does the system provide? 2. Vocabulary Analysis: What business language do components use? 3. Relationship Analysis: Which components are frequently used together? 4. Stakeholder Collaboration: What do business experts say?
Namespace Refactoring
Aligns component namespaces with identified domains:
- Identifies components needing namespace changes
- Suggests target namespaces for domain alignment
- Creates refactoring plans with priorities
- Ensures clear domain boundaries in code structure
Domain Validation
Validates domain groupings before proceeding:
- Checks cohesion within domains
- Verifies domain boundaries are clear
- Ensures all components are assigned
- Gets stakeholder validation
Files Included
SKILL.md (Main Skill)
The primary skill file containing:
- Domain identification methodology
- Component grouping process
- Domain validation framework
- Namespace refactoring guidance
- Domain mapping techniques
- Output format templates
- Implementation notes for different languages
- Fitness function examples
QUICK-REFERENCE.md (Quick Lookup)
Fast reference for common scenarios:
- Domain identification strategies
- Component grouping guidelines
- Namespace refactoring patterns
- Domain validation checklist
- Output template
README.md (This File)
Complete documentation including:
- What the skill does
- When to use it
- Usage examples
- Core concepts
- Integration with other skills
Usage Examples
Example 1: Identify Domains
User: "Group components into logical domains"
The skill will:
1. Analyze component responsibilities
2. Identify business domains
3. Group components into domains
4. Create domain map
5. Suggest namespace refactoringOutput:
## Identified Domains
1. **Customer Domain** (ss.customer)
- Customer Profile
- Billing Payment
- Billing History
- Support Contract
2. **Ticketing Domain** (ss.ticket)
- Ticket Maintenance
- Ticket Assignment
- Ticket Routing
- Knowledge Base
- Survey
3. **Reporting Domain** (ss.reporting)
- Ticket Reports
- Expert Reports
- Financial ReportsExample 2: Domain Assignment
User: "Which domain should the billing components belong to?"
The skill will:
1. Analyze billing component functionality
2. Check relationships with other components
3. Identify appropriate domain
4. Recommend domain assignmentOutput:
## Domain Assignment
**Billing Payment Component**:
- Current: ss.billing.payment
- Functionality: Customer billing and payment processing
- Relationships: Used with Customer Profile, Support Contract
- **Recommendation**: Customer Domain (ss.customer.billing.payment)
**Reasoning**: Billing is customer-related functionality, not a separate domainExample 3: Namespace Refactoring
User: "What namespace refactoring is needed to align components with domains?"
The skill will:
1. Compare current namespaces to identified domains
2. Identify misaligned components
3. Suggest namespace changes
4. Create refactoring planOutput:
## Namespace Refactoring Plan
### Customer Domain Alignment
| Component | Current | Target | Action |
| ---------------- | ------------------ | --------------------------- | ------------- |
| Billing Payment | ss.billing.payment | ss.customer.billing.payment | Add .customer |
| Billing History | ss.billing.history | ss.customer.billing.history | Add .customer |
| Support Contract | ss.supportcontract | ss.customer.supportcontract | Add .customer |Core Concepts
Domain Definition
A domain is a logical grouping of components that:
- Represents a distinct business capability or area
- Contains related components that work together
- Has clear boundaries and responsibilities
- Can become a domain service in service-based architecture
Examples:
- Customer Domain: Customer management, billing, support
- Ticketing Domain: Ticket processing, knowledge base, surveys
- Reporting Domain: Reports and analytics
Component Domain Relationship
One-to-Many: A single domain contains multiple components
Domain: Customer
├── Component: Customer Profile
├── Component: Billing Payment
├── Component: Billing History
└── Component: Support ContractDomain Manifestation
Domains are physically manifested through namespace structure:
Before Domain Alignment:
services/billing/payment
services/customer/profileAfter Domain Alignment:
services/customer/billing/payment
services/customer/profileAll customer-related functionality grouped under .customer domain.
How to Use
Quick Start
Request analysis of your codebase:
"Group components into logical domains"
"Identify component domains for service-based architecture"
"Create domain groupings from components"
"Analyze which components belong to which domains"Step-by-Step Usage
1. Identify Domains
Start by identifying business domains:
User: "What domains exist in this codebase?"This will:
- Analyze component responsibilities
- Identify business capabilities
- Identify distinct business domains
- Validate with component relationships
2. Group Components
Assign components to domains:
User: "Group all components into their appropriate domains"This will:
- Analyze each component's functionality
- Check component relationships
- Assign components to domains
- Handle edge cases
3. Validate Groupings
Ensure components fit well:
User: "Do the component domain assignments make sense?"This will:
- Check cohesion within domains
- Verify domain boundaries
- Ensure all components assigned
- Flag any issues
4. Refactor Namespaces
Align namespaces with domains:
User: "What namespace refactoring is needed for domain alignment?"This will:
- Compare current vs target namespaces
- Identify components needing refactoring
- Create refactoring plan
- Prioritize work
Advanced Usage
Stakeholder Collaboration
Include business stakeholders:
User: "Identify domains and validate with product owner"Custom Domain Rules
Specify domain rules:
User: "Group components into domains, ensuring billing stays in Customer domain"Domain Size Analysis
Analyze domain sizes:
User: "Are any domains too large or too small?"Output Format
The skill generates structured output:
Domain Identification Report
## Domain Identification
### Domain: Customer (ss.customer)
**Business Capability**: Manages customer relationships, billing, and support
**Components**:
- Customer Profile
- Billing Payment
- Billing History
- Support Contract
**Component Count**: 4
**Total Size**: ~15,000 statements (18% of codebase)
**Domain Cohesion**: ✅ High
- Components share customer-related vocabulary
- Components frequently used together
- Direct relationships between componentsComponent Domain Assignment Table
## Component Domain Assignment
| Component | Current Namespace | Assigned Domain | Target Namespace |
| ------------------ | --------------------- | --------------- | --------------------------- |
| Customer Profile | ss.customer.profile | Customer | ss.customer.profile |
| Billing Payment | ss.billing.payment | Customer | ss.customer.billing.payment |
| Ticket Maintenance | ss.ticket.maintenance | Ticketing | ss.ticket.maintenance |Namespace Refactoring Plan
## Namespace Refactoring Plan
### Priority: High
**Customer Domain Alignment**
**Components to Refactor**:
1. Billing Payment: `ss.billing.payment` → `ss.customer.billing.payment`
2. Billing History: `ss.billing.history` → `ss.customer.billing.history`
**Steps**:
1. Update namespace declarations
2. Update import statements
3. Update directory structure
4. Run tests
5. Update documentationDomain Map Visualization
## Domain Map
Customer Domain (ss.customer)
├── Customer Profile
├── Billing Payment
├── Billing History
└── Support Contract
Ticketing Domain (ss.ticket)
├── Ticket Maintenance
├── Ticket Assignment
└── Ticket RoutingIntegration with Other Skills
This skill is part of a decomposition pattern sequence:
1. Component Identification & Sizing → Understand what you have 2. Component Dependency Analysis → Assess coupling 3. Common Domain Component Detection → Find duplicates 4. Component Flattening → Remove orphaned classes 5. Domain Identification & Grouping (this skill) → Group into domains 6. Service Boundary Recommendation → Plan service extraction
Use this skill after flattening components and before creating domain services.
Installation
This skill is installed at the project level:
skills/domain-identification-grouping/This means it's:
- Shared with the repository: Anyone cloning this repo gets the skill
- Version controlled: Changes are tracked in git
- Project-specific: Can be customized for this codebase
The skill will be automatically discovered and used when appropriate based on the description in the frontmatter.
Customization
For Project-Specific Domains
Document your project's domain structure:
skills/domain-identification-grouping/
└── project-domains.md # Document project-specific domainsFor Framework-Specific Analysis
Add framework-specific patterns:
## Framework: NestJS
**Domain Pattern**: `@Module()` decorator groups domain components
**Domain Structure**: `modules/[domain]/[component]/`
**Example**: `modules/customer/billing/`Custom Domain Rules
Modify domain rules in SKILL.md:
## Custom Domain Rules
For this project:
- Billing always belongs to Customer domain
- Reporting is always a separate domain
- Admin functionality grouped under Admin domainFitness Functions
After creating domains, create automated checks:
Domain Namespace Governance
// Ensure components belong to correct domain
function validateDomainNamespaces(components, domainRules) {
const violations = []
components.forEach((comp) => {
const domain = identifyDomain(comp.namespace)
const expectedDomain = domainRules[comp.name]
if (domain !== expectedDomain) {
violations.push({
component: comp.name,
currentDomain: domain,
expectedDomain: expectedDomain,
})
}
})
return violations
}Domain Boundary Enforcement
// Prevent cross-domain direct dependencies
function enforceDomainBoundaries(components) {
const violations = []
components.forEach((comp) => {
comp.imports.forEach((imp) => {
const importedDomain = identifyDomain(imp)
const componentDomain = identifyDomain(comp.namespace)
if (importedDomain !== componentDomain && importedDomain !== 'shared') {
violations.push({
component: comp.name,
importsFrom: imp,
issue: 'Cross-domain direct dependency',
})
}
})
})
return violations
}Best Practices
Do's ✅
- Collaborate with business stakeholders to identify domains
- Group components by business capability, not technical layers
- Ensure domains represent distinct business areas
- Validate domain boundaries with stakeholders
- Refactor namespaces to align with domains
- Create clear domain documentation
- Use business language in domain names
- Aim for 3-7 domains (not too many, not too few)
Don'ts ❌
- Don't create domains based on technical layers
- Don't force components into domains where they don't fit
- Don't skip stakeholder validation
- Don't create too many small domains
- Don't create domains that are too large (monolithic)
- Don't ignore components that don't fit (analyze why)
- Don't skip namespace refactoring
Common Domain Patterns
Typical Domains in Business Applications
- Customer Domain: Customer management, profiles, relationships
- Product Domain: Product catalog, inventory, pricing
- Order Domain: Order processing, fulfillment
- Billing Domain: Invoicing, payments, transactions
- Reporting Domain: Reports, analytics, dashboards
- Admin Domain: User management, configuration
- Shared Domain: Common functionality (login, notification)
Domain Size Guidelines
- Small Domain: 2-4 components
- Medium Domain: 5-8 components
- Large Domain: 9-15 components
- Too Large: >15 components (consider splitting)
Troubleshooting
Components Don't Fit Any Domain
Issue: Some components don't clearly belong to any domain
Solution:
- Analyze component functionality more deeply
- Check if component is truly domain-specific
- Consider if component belongs to Shared domain
- May need to create new domain or split component
Too Many/Few Domains
Issue: Identified too many or too few domains
Solution:
- Aim for 3-7 domains typically
- Too many: Consider merging related domains
- Too few: Consider splitting large domains
- Validate with stakeholders
Namespace Refactoring Too Complex
Issue: Refactoring seems too difficult
Solution:
- Break into smaller steps
- Refactor one domain at a time
- Use automated refactoring tools
- Update tests incrementally
References
This skill is based on:
- Software Architecture: The Hard Parts by Neal Ford, Mark Richards, Pramod Sadalage, Zhamak Dehghani
- Create Component Domains Pattern (Chapter 5)
- Fundamentals of Software Architecture by Mark Richards & Neal Ford
- Domain-Driven Design by Eric Evans
Contributing
To improve this skill:
1. Add language-specific domain patterns 2. Expand framework-specific domain detection 3. Add more domain identification strategies 4. Document new anti-patterns or red flags 5. Share real-world case studies
Version
Version: 1.0.0 Created: 2026-02-05 Based on: Create Component Domains Pattern from "Software Architecture: The Hard Parts"
---
Quick Start
To use this skill immediately:
User: "Group components into logical domains"
User: "Identify component domains for service-based architecture"
User: "Create domain groupings from components"
User: "Analyze which components belong to which domains"This skill will automatically be applied to provide comprehensive domain identification and grouping analysis.