
DDD Validate
FreeEnsure domain boundary integrity in your codebase.
Free · Opens the source repo
What DDD Validate does
DDD Validate is a specialized tool designed to help developers maintain the integrity of domain boundaries within a Domain-Driven Design (DDD) codebase. It systematically scans your project to identify cross-context import violations, ensuring that each bounded context remains isolated and adheres to established architectural principles. This is particularly useful when auditing codebases for leaks between contexts, merging changes that affect multiple areas, or implementing continuous integration practices to catch boundary erosion early.
The skill operates by first discovering all bounded contexts within your project, specifically looking in the src/*/domain/ directories. It then checks for direct import statements that violate the boundaries set by DDD principles, such as importing entities directly from another context's domain directory, which is not allowed. Instead, it permits imports only from the public application layer, helping to enforce a clean separation of concerns.
In addition to checking for import violations, DDD Validate also examines aggregate root entities for compliance with invariant enforcement. It flags any public setters that bypass validation and ensures that child entities cannot be accessed directly, thereby maintaining the integrity of the aggregate. Furthermore, it verifies event naming conventions, repository patterns, and outputs a comprehensive report of any violations found, categorized by type and severity. This structured reporting aids developers in quickly addressing issues and improving the overall quality of their codebase.
Whether you are a developer working on a large-scale DDD project or a team lead overseeing multiple contexts, DDD Validate provides the necessary checks to ensure your architecture remains robust and maintainable. By integrating this tool into your CI pipeline, you can catch potential issues early and streamline your development process, ensuring that your code adheres to the principles of Domain-Driven Design.
When to use it
Use DDD Validate when auditing a DDD codebase, merging cross-cutting changes, or as a CI gate.
When not to use it
This tool may not be suitable for projects that do not follow DDD principles or where bounded contexts are not clearly defined.
What you can build with it
Auditing DDD Codebases
Use DDD Validate to perform a thorough audit of your DDD codebase, ensuring that all domain boundaries are respected.
Merging Changes Safely
Before merging cross-cutting changes, run DDD Validate to identify potential boundary violations that could lead to architectural issues.
Continuous Integration Checks
Incorporate DDD Validate into your CI pipeline to automatically catch and report domain boundary violations during the development process.
How to install DDD Validate
View source1. Install with the skills CLI
npx skills add ruvnet/ruflo/ddd-validate --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by ruvnetValidate domain boundary integrity across all bounded contexts.
Steps
-
Discover contexts: Scan
src/*/domain/to find all bounded contexts. -
Check cross-boundary violations:
- For each context, scan all
.tsfiles for import statements - Flag any import that reaches into another context's
domain/directory directly - Allowed: importing from another context's public
index.ts(application layer) - Violation: importing from
src/<other-context>/domain/entities/...directly
# Find cross-boundary imports for ctx in $(find src -maxdepth 2 -name "domain" -type d | sed 's|src/||;s|/domain||'); do grep -rn "from ['\"].*src/" "src/$ctx/" --include="*.ts" | grep -v "src/$ctx/" || true done - For each context, scan all
-
Check aggregate invariant enforcement:
- Scan aggregate root entities for public setters that bypass validation
- Flag mutable public properties without invariant checks
- Verify that child entities are not directly accessible (must go through aggregate root)
-
Check event naming conventions:
- Domain events should be past-tense named (e.g.,
OrderCreated, notCreateOrder) - Events should be immutable (no public setters)
- Events should carry the aggregate ID
- Domain events should be past-tense named (e.g.,
-
Check repository patterns:
- Repository interfaces should exist in
domain/repositories/, notinfrastructure/ - Repository implementations should exist in
infrastructure/, notdomain/ - Each aggregate root should have exactly one repository
- Repository interfaces should exist in
-
Report findings:
- Output a table of violations with file path, line number, violation type, and suggestion
- Categorize as:
BOUNDARY,INVARIANT,EVENT,REPOSITORY - Exit with summary: total violations, by category, severity
-
Store results:
npx @claude-flow/cli@latest memory store --key "ddd-validation-TIMESTAMP" --value "RESULTS_SUMMARY" --namespace tasks npx @claude-flow/cli@latest hooks post-task --task-id "ddd-validate" --success true --store-results true
Frequently asked questions about DDD Validate
Similar skills
Quality Playbook Generator
Run comprehensive quality audits on any codebase.
PR Draft Summary
Automate PR summary generation for openai-agents-python.
Final Release Review
Streamline your release candidate audits with ease.
Unit Test Vue Pinia
Efficiently write and review unit tests for Vue 3 applications.
Slang Shader Expert
Optimize and integrate Slang shaders with ease.
Telemetry Standards
Ensure consistent event tracking in Supabase Studio.
