packages/skills-catalog/skills/(architecture)/domain-analysis/SKILL.md
Maps business domains and suggests service boundaries in any codebase using DDD Strategic Design. Use when asking "what are the domains in this codebase?", "where should I draw service boundaries?", "identify bounded contexts", "classify subdomains", "DDD analysis", or analyzing domain cohesion. Do NOT use for grouping existing components into domains (use domain-identification-grouping) or dependency analysis (use coupling-analysis).
npx skillsauth add tech-leads-club/agent-skills domain-analysisInstall 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 analyzes codebases to identify subdomains (Core, Supporting, Generic) and suggest bounded contexts following Domain-Driven Design Strategic Design principles.
Apply this skill when:
Core Domain: Competitive advantage, highest business value, requires best developers
Supporting Subdomain: Essential but not differentiating, business-specific
Generic Subdomain: Common functionality, could be outsourced
An explicit linguistic boundary where domain terms have specific, unambiguous meanings.
Scan codebase for business concepts (not infrastructure):
Entities (domain models with identity)
@Entity, class, domain modelsServices (business operations)
*Service, *Manager, *HandlerUse Cases (business workflows)
*UseCase, *Command, *HandlerControllers/Resolvers (entry points)
*Controller, *Resolver, API endpointsFor each concept, determine:
Primary Language Context
Subscription, Invoice, Payment → Billing languageMovie, Video, Episode → Content languageUser, Authentication → Identity languageLinguistic Boundaries
Concept Relationships
A subdomain has:
Common Domain Patterns:
Classify Each Subdomain:
Use this decision tree:
Is it a competitive advantage?
YES → Core Domain
NO → Does it require business-specific knowledge?
YES → Supporting Subdomain
NO → Generic Subdomain
High Cohesion Indicators ✅
Low Cohesion Indicators ❌
Cohesion Score Formula:
Score = (
Linguistic Cohesion (0-3) + // Shared vocabulary
Usage Cohesion (0-3) + // Used together
Data Cohesion (0-2) + // Entity relationships
Change Cohesion (0-2) // Change together
) / 10
8-10: High Cohesion ✅
5-7: Medium Cohesion ⚠️
0-4: Low Cohesion ❌
Rule 1: Linguistic Mismatch
User (identity) + Subscription (billing) in same serviceRule 2: Cross-Domain Dependencies
Rule 3: Mixed Responsibilities
Rule 4: Generic in Core
Rule 5: Unclear Boundaries
For each subdomain identified, suggest bounded context:
Bounded Context Characteristics:
Integration Patterns:
For each domain/subdomain:
## Domain: {Name}
**Type**: Core Domain | Supporting Subdomain | Generic Subdomain
**Ubiquitous Language**: {key business terms}
**Business Capability**: {what business problem it solves}
**Key Concepts**:
- {Concept} (Entity|Service|UseCase) - {brief description}
**Subdomains** (if applicable):
1. {Subdomain} (Core|Supporting|Generic)
- Concepts: {list}
- Cohesion: {score}/10
- Dependencies: → {other domains}
**Suggested Bounded Context**: {Name}Context
- Linguistic boundary: {where terms have specific meaning}
- Integration: {how it should integrate with other contexts}
**Dependencies**:
- → {OtherDomain} via {interface/API}
- ← {OtherDomain} via {interface/API}
**Cohesion Score**: {score}/10
## Cross-Domain Cohesion
| Domain A | Domain B | Cohesion | Issue | Recommendation |
| -------- | -------- | -------- | ------------------ | ----------------------- |
| Billing | Identity | 2/10 | ❌ Direct coupling | Use interface |
| Content | Billing | 6/10 | ⚠️ Usage tracking | Event-based integration |
## Issues Detected
### Priority: High
**Issue**: {description}
- **Location**: {file/class/method}
- **Problem**: {what's wrong}
- **Concepts**: {involved concepts}
- **Cohesion**: {score}/10
- **Recommendation**: {suggested fix}
### Priority: Medium
{similar format}
## Suggested Bounded Contexts
### {ContextName}Context
**Contains Subdomains**:
- {Subdomain1} (Core)
- {Subdomain2} (Supporting)
**Ubiquitous Language**:
- Term: Definition in this context
**Integration Requirements**:
- Consumes from: {OtherContext} via {pattern}
- Publishes to: {OtherContext} via {pattern}
**Implementation Notes**:
- Separate persistence
- Independent deployment
- Explicit API boundaries
For Each Concept:
For Each Domain:
For Cohesion Analysis:
Analyze business capability
└─ Is it competitive advantage?
├─ YES → Core Domain
└─ NO → Is it business-specific?
├─ YES → Supporting Subdomain
└─ NO → Generic Subdomain
Same vocabulary? → High linguistic cohesion
Used together? → High usage cohesion
Direct relationships? → High data cohesion
Change together? → High change cohesion
All high → Strong subdomain candidate
Mix of high/low → Review boundaries
All low → Likely wrong grouping
Clear boundary signs:
✅ Distinct Ubiquitous Language
✅ Concepts have unambiguous meaning
✅ Different meanings across contexts
✅ Clear integration points
Unclear boundary signs:
❌ Same terms with same meanings everywhere
❌ Concepts used identically across system
❌ No clear linguistic differences
❌ Tight coupling everywhere
Big Ball of Mud
All-Inclusive Model
Mixed Linguistic Concepts
Good domain identification has:
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).