module-seven-elements

A detailed specification for designing software modules around seven areas, including goals, users, models, workflows, states, interfaces, and data.

In plain words
What is it for?
It is for writing module designs, defining use cases and data flows, recording non-functional requirements, and planning testing, monitoring, and future changes.
Why use it?
It helps teams describe how a module should work and what quality, monitoring, security, and maintenance concerns it must cover.

Cursor rule for Cursor

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/mywand/cusrsor-do-it/module-seven-elements
Clone the repo
git clone --depth 1 https://github.com/mywand/cusrsor-do-it

Made for: Cursor.

Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,780 The whole file, excluding the scripts and references it only reads on demand.
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.00015 $0.04780
Opus 5 $0.00008 $0.02390
Sonnet 5 $0.00003 $0.00956
Haiku 4.5 $0.00002 $0.00478

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

Security

Grade A, and why

module-seven-elements 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 2d 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.

.cursor/rules/docs/module-seven-elements.mdc · 460 lines

How it starts

The opening of the file, as written. The whole thing — 460 lines — stays where its author put it; the contents beside it link to each section on GitHub.

最近更新: 2025-10-28 最近审阅: 2025-10-28

模块设计七要素详细规范

文件编码:UTF-8, 无 BOM

本文档内容:第3-9章 - 七要素详细设计规范

📚 文档导航

文档 内容
📖 主文档 核心设计原则、文档概述、七要素框架
📘 当前文档 第3-9章:背景、角色、模型、流程、状态、接口、数据
📙 质量保障指南 第10-15章:NFR、监控、安全、风险
📕 工程实践指南 第16-24章:技术债、评审、演进、快速指南

3. 背景与目标(要素一)

3.1 设计目标

在模块设计文档中,需要明确回答:

  • 业务背景:当前痛点是什么?为什么需要这个模块?
  • 核心目标:要达成什么业务价值?(需可量化)
  • 非目标:明确不做什么,避免范围蔓延
  • 成功标准:如何衡量模块是否成功?

3.2 目标描述模板

维度 说明 示例
业务背景 当前问题/痛点 现有结算流程手工操作多,错误率高达5%
核心目标 要达成的效果(可量化) 自动化结算,错误率<0.1%,处理时间<1小时
非目标 明确不在范围内 不包含跨境结算、不支持实时结算
度量指标 成功的量化标准 错误率、处理时长、人工介入次数
依赖假设 前置条件 订单数据完整、商家信息准确

3.3 目标自检清单

  • 目标是否可量化?(有具体数字或标准)
  • 是否说明了业务价值?(而非仅技术实现)
  • 非目标是否明确?(避免范围蔓延)
  • 度量指标是否可测量?(有监控手段)
  • 依赖假设是否清晰?(风险可控)

4. 角色与用例(要素二)

4.1 角色识别

角色类型 说明 示例 关键需求
主要用户 直接使用系统的人 运营人员、商家 操作便捷、结果可见
管理员 系统管理和维护 系统管理员 监控、配置、问题排查
外部系统 通过API调用 订单系统、支付系统 接口稳定、响应快速
内部服务 同组织内的服务 通知服务、审计服务 事件及时、数据一致

4.2 用例设计模板

用例ID 用例名称 触发角色 前置条件 主成功路径 异常分支 后置条件
UC-001 创建结算批次 系统定时任务 有待结算订单 1. 查询订单2. 生成批次3. 发布事件 订单为空/重复创建 批次创建完成

4.3 用例自检清单

  • 是否覆盖了所有主要角色?
  • 是否有主成功路径描述?
  • 是否有异常分支处理?
  • 是否有前置和后置条件?
  • 是否有时序图或流程图支撑?

5. 模型与不变量(要素三)

5.1 领域模型设计

聚合设计原则

参考主文档第0.2节 DDD原则

  • 聚合要小:不超过3层深度
  • 通过ID引用其他聚合
  • 聚合内保证强一致性
  • 聚合间最终一致性
实体vs值对象
类型 特征 判断标准 示例
实体 有唯一标识,可变 需要追踪其生命周期 订单、用户、商品
值对象 无标识,不可变 可替换、描述性概念 金额、地址、时间范围

5.2 不变量设计

不变量是业务规则的体现,必须在聚合边界内始终保持:

  • 数据完整性:必填字段、取值范围、格式约束
  • 业务规则:订单金额=各项之和、库存不能为负
  • 状态约束:已支付订单不能取消

Read the full file on GitHub · 460 lines

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. 2d ago First seen · 460 lines · 15 tokens per session scan A 9073de415da9

Subscribe to this mod's changes

module-seven-elements is a cursor rule published in the GitHub repository mywand/cusrsor-do-it (2 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 15 tokens to every session and 4,780 once invoked, about $0.0001 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.