Skip to content
Skillpedia
APIs & servers (backend)81k · #1616

ddd-validate

What it does

This skill audits a domain-driven codebase for boundary leaks, where one business area imports another area's internal files. It is for teams who want to keep their code structure clean.

When to use it

  • ✓When you want to audit a codebase for leaks between business areas.
  • ✓When you are about to merge a change that touches several areas.
  • ✓When you want an automatic check that catches boundary problems early.

Skill link

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-validate/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-validate/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Check my codebase for any code that reaches into another area's internal files.”

5 new skills a week. 1 minute to read.

How it works

The skill finds each business area, scans its files for imports that go into another area's internal folder, and checks rules about entities, event names and where repositories sit. It then reports each issue it finds.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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
    
FAQ

What counts as a violation?

An import that reaches directly into another area's domain folder is flagged. Importing from another area's public index is allowed.

Does it fix the problems itself?

The steps focus on finding and reporting issues, so review the report and decide what to change.

What naming rule applies to events?

Domain events should be named in the past tense, such as OrderCreated rather than CreateOrder.

Details

Original description by the author

Validate domain boundaries -- detect cross-context import violations and aggregate invariant issues. Use when auditing a DDD codebase for leaks between bounded contexts, before merging cross-cutting changes, or as a CI gate to catch boundary erosion early.

repo: ruvnet/ruflo

Popularity

GitHub stars
81k
Ranking position
#1616
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills