New to Claude Skills? Learn how to install them →

ruvnet on GitHub

DDD Validate

Free

Ensure domain boundary integrity in your codebase.

by ruvnet67.6k stars on ruvnet/ruflo
1 views
Updated Aug 10, 2026
Get this skill

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 source

1. Install with the skills CLI

npx skills add ruvnet/ruflo/ddd-validate --agent claude-code

2. 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 ruvnet

Validate domain boundary integrity across all bounded contexts.

Steps

  1. Discover contexts: Scan src/*/domain/ to find all bounded contexts.

  2. Check cross-boundary violations:

    • For each context, scan all .ts files 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
    
  3. 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)
  4. Check event naming conventions:

    • Domain events should be past-tense named (e.g., OrderCreated, not CreateOrder)
    • Events should be immutable (no public setters)
    • Events should carry the aggregate ID
  5. Check repository patterns:

    • Repository interfaces should exist in domain/repositories/, not infrastructure/
    • Repository implementations should exist in infrastructure/, not domain/
    • Each aggregate root should have exactly one repository
  6. 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
  7. 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