ddd-validate — Claude Code skill: what it does, how to install
Checks bounded context integrity in TypeScript projects and flags domain boundary leaks. Useful for DDD architecture audits and pre-merge CI checks.
npx skills add ruvnet/ruflo --skill ddd-validate -a claude-codeWhat ddd-validate does
The skill checks architectural integrity across Domain-Driven Design codebases. It starts by scanning src/*/domain/ to discover all bounded contexts. Then it scans .ts files for leaks. Directly importing from another context's domain/entities/ is marked as a violation, while imports from a public index.ts remain permitted.
The check also inspects aggregate roots and storage layers. It flags mutable public properties, direct access to child entities, and domain event names that are not in the past tense. It also verifies that repository interfaces sit in domain/repositories/ while concrete implementations stay inside infrastructure/. Exactly one repository per aggregate root is allowed.
Results appear in a table with line numbers, violation categories, and remediation advice under BOUNDARY, INVARIANT, EVENT, and REPOSITORY. Summary data is then saved via npx @claude-flow/cli@latest memory store. If your repository does not keep domain modules under src/*/domain/, the context scanner will fail to discover your contexts.
What it helps with
- Detect cross-boundary domain imports between bounded contexts
- Spot bypasses of aggregate invariants and exposed child entities
- Verify separation of repository interfaces and implementations
- Validate past-tense naming conventions on domain events
Example prompts for the agent
- Run ddd-validate to audit bounded context boundaries in src/
- Check aggregate invariants and repository locations using ddd-validate
- Use ddd-validate to find illegal cross-context imports before merging
How to install ddd-validate
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill ddd-validate -a claude-code2Manually: put the files in place
~/.claude/skills/ddd-validate/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/ddd-validate/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill ddd-validate -a codex2Manually: put the files in place
.agents/skills/ddd-validate/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill ddd-validate -a cursor2Manually: put the files in place
.cursor/skills/ddd-validate/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo ddd-validate2Manually: put the files in place
.github/skills/ddd-validate/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill ddd-validate -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-ddd/skills/ddd-validateManually: put the files in place
.devin/skills/ddd-validate/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill ddd-validate -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set104
The whole set →Similar
Questions about ddd-validate
How to install ddd-validate in Claude Code?
Run the command npx skills add ruvnet/ruflo --skill ddd-validate -a claude-code. You can also place the specification directly at ~/.claude/skills/ddd-validate/SKILL.md.
What does ddd-validate do?
The skill inspects TypeScript codebases for Domain-Driven Design violations, highlighting illegal cross-boundary imports, mutable aggregate properties, wrong event names, and misplaced repository classes.
What project layout does ddd-validate expect?
The skill looks for contexts located in src/*/domain/ containing TypeScript files. It allows importing from another context only via its application-layer index.ts, flagging direct imports into inner domain entity folders.
Source text
SKILL.md · MIT
---
name: ddd-validate
description: 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.
argument-hint: ""
allowed-tools: Bash Read Grep Glob mcp__plugin_ruflo-core_ruflo__memory_store mcp__plugin_ruflo-core_ruflo__memory_search mcp__plugin_ruflo-core_ruflo__hooks_pre-task mcp__plugin_ruflo-core_ruflo__hooks_post-task
---
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
```bash
# 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**:
```bash
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
```
© ruvnet · MIT · ruvnet/ruflo