Draw Module Boundaries Inside the Monolith
Added 2026-10
Draw Module Boundaries Inside the Monolith — Chinese original prompt
这个单体应用里各业务的代码互相调用,改一处牵连一片。请先不拆服务,在代码层面按 [业务能力] 划出模块,明确每个模块对外暴露的接口和可以访问的数据。输出:模块划分图、每个模块的公开接口清单、现有跨模块调用中需要改造的部分、以及用静态检查守住边界的做法。
Site original
Chinese original
Example
Sample input
单体里订单、库存、结算互相调用,改一处牵连一片,帮我先在代码层面划模块边界。
The output should include
- 模块划分图与公开接口清单
- 跨界调用中需要改造的部分
- 用静态检查守住边界的做法
Replace these placeholders 1
Swap the bracketed parts for your own details before sending.
[业务能力]
How to use
边界要靠工具卡住,只写文档的话三个月就回到原样。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.