# Project Constitution — 愈心谷 最高原则。与本文件冲突时,以本文件为准。 ## Absolute Laws 1. Architecture never broken. Layers: UI → API → Service → Repository → Database. No skipping. 2. Readability > Cleverness. 3. Deterministic > Magic. 4. Simple > Complex. 5. Explicit > Implicit. 6. No hidden global state. 7. Every module independently testable. 8. Every feature deployable. 9. Every API documented (OpenAPI or apps/docs). 10. Every database change versioned (migration required). 11. **Local feedback speed > local environment purity.** 本地开发追求分钟级反馈;生产/CI 追求环境一致。二者禁止混用工作流(见 `.ai/environment.md`)。 12. **Done ≠ Code Complete.** 功能完成标准见 `.ai/definition-of-done.md`;禁止仅以「有 API / 能打开页 / build 过」宣告完成。 ## Product Laws (YuXinGu) 1. Never invent medical efficacy claims. 2. Never use fortune-telling / 吉凶祸福 wording. 3. Birthday and profile data are sensitive — minimize, authorize, allow delete. 4. Billing and unlock decisions happen on the server, never trust the client alone. 5. New product code lives in `apps/` and `packages/` only. Legacy root HTML is read-only unless the task is explicit migration. ## AI Laws 1. Obey `.ai/ai-contract.md` every session. 2. Load constitution → architecture → domain before writing code. 3. Never invent APIs/DB/domain words; never reverse Accepted ADRs silently. 4. Never modify files outside the current task scope. 5. Prefer patterns + examples + playbooks over prompts. 6. Prefer small diffs. One feature per change set. 7. Think → architecture check → code → commands → review → DoD.