Archive the differentiated YuXinGu product docs, AI engineering system, design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity over early innovation (see .ai/product/STRATEGY.md). Co-authored-by: Cursor <cursoragent@cursor.com>
1.2 KiB
1.2 KiB
Coding — Golden Rules
Size
- One responsibility per file.
- One responsibility per function.
- No function longer than 50 lines.
- No file longer than 400 lines (hard preference; split earlier if possible).
- No circular dependency.
Go
- Business packages by domain:
auth,profile,report,order,payment— notutils. - Interface defined at caller (usually handler), implemented by service.
- First parameter of I/O methods:
context.Context. - Errors:
return fmt.Errorf("create user: %w", err). - Never
panicin request path. - Never use package-level mutable globals for request state.
- Export comments required on public funcs (what / in / out / side effects).
TypeScript / Vue
strict: true. No casualany.- Components:
PascalCase.vue(UserCard.vue). - Pages under
src/pages/, composables undersrc/hooks/. - No direct
fetchin pages — use SDK. - Shared domain types go to
packages/types.
Naming
- Consistent domain words: profile, report, scale, membership, order.
- Prefer boring clear names over clever short names.
Comments
- Public APIs: always document.
- Do not narrate obvious code. Document intent, invariants, side effects.