ruvnet/ruflo/tree/main/plugins/ruflo-ddd
ruflo-ddd
Claude Code 用のドメイン駆動設計スキャフォールディングプラグイン。関数フックの Guard で DDD メモリへの秘密情報の書き込みをブロックする。
この mod について
ruflo-ddd は Claude Code プラグインで、境界づけられたコンテキスト、集約ルート、値オブジェクト、ドメインイベント、リポジトリ、腐敗防止層など、ドメイン駆動設計の成果物をスキャフォールドし、AgentDB 内のナビゲート可能なグラフとして保存する。domain-modeler エージェント、スキル(/ddd-context、/ddd-aggregate、/ddd-validate)、コンテキスト管理・集約/イベントのスキャフォールド・検証・コンテキストマッピング用の 6 個の CLI サブコマンドを提供する。記載されたバージョン以降は関数フック mod としても動作する(Claude Code 2.1.287+ が必要)。デフォルトで有効な Guard は、キー、token、パスワードを含むドメインモデルのメモリ書き込みを拒否する(秘密の種類だけを示し、値は決して示さない)。ローカルの /ddd-mod コマンドはモデルターンなしで status/scan/contexts に回答し、ステータスファイルを .claude-flow/ddd-mod/status.json に書き込む。userConfig の guard オプションで強制を切り替えられる。インストール:claude --plugin-dir plugins/ruflo-ddd。bash plugins/ruflo-ddd/scripts/smoke.sh で検証する(期待値は 10 passed, 0 failed)。このプラグインはネットワークを呼び出したりプロセスを生成したりせず、ツール呼び出しを厳しくすることだけができ、緩めることはできない。MIT ライセンス。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add ruvnet/ruflo claude plugin install ruflo-ddd
原文 / README
ruflo-ddd
Domain-Driven Design scaffolding -- bounded contexts, aggregate roots, domain events, and anti-corruption layers.
Overview
Transforms business domains into well-structured bounded contexts with aggregate roots, value objects, domain events, repositories, and anti-corruption layers. Stores the domain model as a navigable graph in AgentDB with hierarchical nodes and causal edges for context dependencies.
Installation
claude --plugin-dir plugins/ruflo-ddd
Agents
| Agent | Model | Role |
|-------|-------|------|
| domain-modeler | sonnet | Map domains to bounded contexts, design aggregates with invariants, define domain events, generate ACL interfaces |
Skills
| Skill | Usage | Description |
|-------|-------|-------------|
| ddd-context | /ddd-context <context-name> | Create a bounded context with standard directory structure |
| ddd-aggregate | /ddd-aggregate <context> <aggregate-name> | Scaffold an aggregate root with entity, value objects, repository, events, and test stubs |
| ddd-validate | /ddd-validate | Detect cross-context import violations and aggregate invariant issues |
Commands (6 subcommands)
# Context management
ddd context create <name>
ddd context list
# Aggregate scaffolding
ddd aggregate <context> <name>
ddd event <context> <name>
# Validation & visualization
ddd validate # Check domain boundary violations
ddd map # Visualize context map with relationships
Directory Structure per Context
src/<context-name>/
domain/
entities/ # Entities and aggregate root
value-objects/ # Immutable value objects
events/ # Domain events
services/ # Domain services
repositories/ # Repository interfaces
application/ # Use cases / application services
infrastructure/ # Repository implementations, ACL adapters
index.ts # Public API of the context
Context Relationships
Detected via import analysis: upstream/downstream, ACL, shared kernel, published language. Boundary violations (direct cross-context imports) are flagged by ddd validate.
Compatibility
- CLI: pinned to
@claude-flow/cliv3.6 major+minor. - Verification:
bash plugins/ruflo-ddd/scripts/smoke.shis the contract.
Namespace coordination
This plugin owns the ddd-patterns AgentDB namespace (kebab-case, follows the convention from ruflo-agentdb ADR-0001 §"Namespace convention"). Reserved namespaces (pattern, claude-memories, default) MUST NOT be shadowed.
ddd-patterns stores reusable bounded-context shapes, aggregate templates, and event vocabularies for cross-project reuse. Accessed via memory_* tools (namespace-routed).
Verification
bash plugins/ruflo-ddd/scripts/smoke.sh
# Expected: "10 passed, 0 failed"
Architecture Decisions
Related Plugins
ruflo-agentdb— namespace convention owner; backing store for the domain graphruflo-adr-- Document domain decisions as Architecture Decision Recordsruflo-sparc-- Architecture phase leverages DDD bounded context patternsruflo-migrations-- Align migration boundaries with aggregate roots
License
MIT
As a mod
Since this version the plugin is also a function-hook mod (ADR-445 pattern; needs Claude Code 2.1.287 or later). It never calls the network or spawns a process, and it only tightens: it can refuse a call, never allow one.
- Guard (default on): refuses domain-model memory writes (
ddd-*keys andcontext:/aggregate:hierarchy edges) that hold a key, token or password. The reason names the kind of secret, never the value. /ddd-mod: answered locally, no model turn:status,scan <text>(would the guard refuse this?), andcontexts(folders undersrc/,src/contexts,src/moduleswith adomain/layer).- Status file:
.claude-flow/ddd-mod/status.json({version, updatedMs, guard, blocked}), written at session start and when a call is blocked. - Option:
guard(on|off, defaulton) in the plugin'suserConfig.
Test it: claude plugin test plugins/ruflo-ddd and bash plugins/ruflo-ddd/scripts/smoke.sh.