06-architecture-ddd

06-architecture-ddd is a cursor rule for coding agents from movebrickschi/harness-engineering-mcp. It costs 394 tokens per session, scanned A, original, MIT.

Rules for organising software into four layers—interface, application, domain, and infrastructure—and for modelling business concepts using domain-driven design.

In plain words
What is it for?
Use them when designing or reviewing a layered application or domain model. They guide dependencies, entities, value objects, aggregate roots, domain services, and choices such as builders, factories, strategies, state machines, and event-based patterns.
Why use it?
They prevent unrelated parts of the system from depending on each other in unsafe ways. They also keep core business logic independent from databases, APIs, and message queues.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/movebrickschi/harness-engineering-mcp/06-architecture-ddd
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 06-architecture-ddd

README.md
[![agentmods](https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/06-architecture-ddd.svg)](https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/06-architecture-ddd)
Your own site
<a href="https://agentmods.dev/rules/movebrickschi/harness-engineering-mcp/06-architecture-ddd"><img src="https://agentmods.dev/badge/rules/movebrickschi/harness-engineering-mcp/06-architecture-ddd.svg" alt="Measured on agentmods" height="20"></a>
Per session 394 This file is loaded in full into every session.
When invoked 394 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00394 $0.00394
Opus 5 $0.00197 $0.00197
Sonnet 5 $0.00079 $0.00079
Haiku 4.5 $0.00039 $0.00039

Measured 5d ago against content hash f06c7735147e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

06-architecture-ddd scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

assets/rules/06-architecture-ddd.mdc · 41 lines

What it actually says

架构分层与DDD设计原则

分层架构

严格遵循四层架构,禁止跨层调用:

Controller(接口层) → Application(编排层) → Domain(核心业务) → Infrastructure(技术实现)
职责 允许依赖
Controller 参数校验、协议转换、路由 Application
Application 用例编排、事务管理、DTO转换 Domain
Domain 核心业务逻辑、领域模型、领域服务 无外部依赖
Infrastructure 数据库访问、外部API、消息队列 Domain(通过Port接口)

关键约束:Domain层禁止依赖Infrastructure层,通过端口(Port)和适配器(Adapter)解耦。

DDD建模要素

  • Entity:有唯一标识的领域对象,生命周期内可变
  • Value Object:无标识、不可变,通过属性值判等
  • Aggregate Root:聚合的入口,外部只能通过聚合根访问内部对象
  • Domain Service:跨聚合的业务逻辑,不属于任何单一实体

设计模式优先策略

  • 复杂对象创建 → Builder模式
  • 多态创建 → Factory Method
  • 多重if-else → Strategy策略模式
  • 状态流转 → State状态机模式
  • 异步流程 → CQRS + Event Sourcing(视场景复杂度而定)
  • 优先组合,避免继承复用代码
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 41 lines · 394 tokens per session scan A f06c7735147e

Subscribe to this mod's changes

06-architecture-ddd is a cursor rule published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 394 tokens to every session, about $0.0020 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.