module-engineering-practices

A guide for designing software modules, covering technical debt, required design sections, reviews, tailoring, and how modules evolve.

In plain words
What is it for?
Use it when designing a module, choosing a minimum design document, recording technical debt, reviewing changes, or planning future revisions.
Why use it?
It helps teams decide which design information is necessary and keep known maintenance problems visible and planned.

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

Made for: Cursor.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,564 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.00012 $0.05564
Opus 5 $0.00006 $0.02782
Sonnet 5 $0.00002 $0.01113
Haiku 4.5 $0.00001 $0.00556

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

Security

Grade A, and why

module-engineering-practices 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-engineering-practices.mdc · 489 lines

How it starts

The opening of the file, as written. The whole thing — 489 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

本文档内容:第16-24章 - 工程实践指南

📚 文档导航

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

16. 技术债管理

16.1 技术债记录表

技术债ID 类别 描述 影响范围 严重程度 记录日期 计划清理版本 负责人
TD-001 性能 未实现批量查询优化 查询接口 2025-10-01 v2.0 @张三
TD-002 安全 缺少敏感数据加密 数据存储 2025-10-05 v1.1 @李四

16.2 技术债管理原则

  • 记录透明:所有已知技术债都应记录在案
  • 优先级评估:根据影响范围和严重程度确定优先级
  • 定期审查:每个迭代评审技术债清单
  • 主动清理:预留 20% 迭代时间用于清理技术债
  • 防止累积:新增技术债必须说明原因和清理计划

17. 裁剪准则与模板定制

17.1 MVP 最小集

必选章节(任何模块设计都必须包含):

  • 第0章:核心设计原则(至少阅读)
  • 第3章:背景与目标
  • 第5章:模型与不变量
  • 第8章:接口与事件契约
  • 第9章:数据存储设计

可选章节(根据复杂度裁剪):

  • 第4章:角色与用例(简单CRUD可省略)
  • 第6章:流程与时序(无复杂流程可省略)
  • 第7章:状态机(无状态转换可省略)
  • 第10-16章:根据实际需求选择

17.2 裁剪决策流程

flowchart TD
    Start([开始设计]) --> Q1{是否有复杂<br>业务流程?}
    Q1 -->|是| KeepFlow[保留第4/6章]
    Q1 -->|否| SkipFlow[可省略第4/6章]
    
    KeepFlow --> Q2{是否有<br>状态转换?}
    SkipFlow --> Q2
    Q2 -->|是| KeepState[保留第7章]
    Q2 -->|否| SkipState[可省略第7章]
    
    KeepState --> Q3{是否有严格<br>NFR要求?}
    SkipState --> Q3
    Q3 -->|是| KeepNFR[保留第10-13章]
    Q3 -->|否| SkipNFR[简化第10-13章]
    
    KeepNFR --> Q4{是否需要<br>数据迁移?}
    SkipNFR --> Q4
    Q4 -->|是| KeepMigration[保留第14章]
    Q4 -->|否| SkipMigration[可省略第14章]
    
    KeepMigration --> MVP[生成MVP文档]
    SkipMigration --> MVP
    
    style Start fill:#e0f2fe
    style MVP fill:#86efac

17.3 与系统架构章节映射

模块文档章节 系统架构对应章节 关系 是否可裁剪
第0章 核心设计原则 系统级设计原则 遵循 ❌ 必读
第3章 背景与目标 系统目标与范围 对齐 ❌ 必填
第5章 模型与不变量 领域模型 细化 ❌ 必填
第8章 接口契约 API规范 实现 ❌ 必填
第9章 数据存储 数据架构 实例化 ❌ 必填
第4章 角色与用例 用户旅程 细化 ✅ 简单功能可省略
第6章 流程与时序 系统交互图 细化 ✅ 无复杂流程可省略
第7章 状态机 生命周期管理 细化 ✅ 无状态转换可省略
第10-13章 质量属性 NFR规范 继承+补充 ✅ 可简化
第14章 迁移策略 发布策略 实例化 ✅ 新模块可省略

Read the full file on GitHub · 489 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 · 489 lines · 12 tokens per session scan A 040757df6f64

Subscribe to this mod's changes

module-engineering-practices 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 12 tokens to every session and 5,564 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.