packages/skills-catalog/skills/(architecture)/domain-identification-grouping/SKILL.md
Groups existing components into logical business domains to plan service-based architecture. Use when asking "which components belong together?", "group these into services", "organize by domain", "component-to-domain mapping", or planning service extraction from an existing codebase. Do NOT use for identifying new domains from scratch (use domain-analysis) or analyzing coupling (use coupling-analysis).
npx skillsauth add tech-leads-club/agent-skills domain-identification-groupingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill groups architectural components into logical domains (business areas) to prepare for creating domain services in a service-based architecture.
Request analysis of your codebase:
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 alignment
Example 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 assignment
Example 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 plan
Apply this skill when:
A domain is a logical grouping of components that:
Examples:
One-to-Many: A single domain contains multiple components
Domain: Customer
├── Component: Customer Profile
├── Component: Billing Payment
├── Component: Billing History
└── Component: Support Contract
Domains are physically manifested through namespace structure:
Before Domain Alignment:
services/billing/payment
services/billing/history
services/customer/profile
services/supportcontract
After Domain Alignment:
services/customer/billing/payment
services/customer/billing/history
services/customer/profile
services/customer/supportcontract
Notice how all customer-related functionality is grouped under .customer domain.
Analyze the codebase to identify distinct business domains:
Examine Component Responsibilities
Look for Business Language
Identify Domain Boundaries
Collaborate with Business Stakeholders
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
- Notification
Assign each component to an appropriate domain:
Analyze Component Functionality
Check Component Relationships
Assign to Domain
Handle Edge Cases
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)
Ensure components fit well in their assigned domains:
Check Cohesion
Verify Boundaries
Assess Completeness
Get Stakeholder Validation
Validation Checklist:
Align component namespaces with identified domains:
Compare Current vs Target Namespaces
services/billing/paymentservices/customer/billing/payment.customer domain nodeIdentify Refactoring Needed
Create Refactoring Plan
Execute Refactoring
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 |
Visualize domain structure and component groupings:
Create Domain Diagram
Document Domain Structure
Create Domain Inventory
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
```markdown
## 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 domains
## 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
### 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 components
## Domain Map
### Domain Structure
Customer 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)
Domain Identification:
Component Grouping:
Domain Validation:
Namespace Refactoring:
Domain Mapping:
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/
Domains identified by package structure:
com.company.customer ← Customer Domain
├── profile
├── billing
│ ├── payment
│ └── history
└── supportcontract
com.company.ticket ← Ticketing Domain
├── shared
├── maintenance
├── assign
└── route
Strategy 1: Business Capability Analysis
Strategy 2: Vocabulary Analysis
Strategy 3: Relationship Analysis
Strategy 4: Stakeholder Collaboration
After creating domains, create automated checks:
// 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
}
// 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
}
After creating component domains:
development
Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities". Do NOT use for accessibility (use web-accessibility), SEO (use seo), performance (use core-web-vitals), or comprehensive multi-area audits (use web-quality-audit).
tools
Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing. Do NOT use for quick page debugging or network inspection (use chrome-devtools instead).
development
Configure, explore, and optimize Nx monorepo workspaces. Use when setting up Nx, exploring workspace structure, configuring project boundaries, analyzing affected projects, optimizing build caching, or implementing CI/CD with affected commands. Keywords — nx, monorepo, workspace, projects, targets, affected. Do NOT use for running tasks (use nx-run-tasks) or code generation with generators (use nx-generate).
development
Execute build, test, lint, serve, and other tasks in an Nx workspace using single runs, run-many, and affected commands. Use when user says "run tests", "build my app", "lint affected", "serve the project", "run all tasks", or "nx affected". Do NOT use for code generation (use nx-generate) or workspace configuration (use nx-workspace).