-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory.mdc
More file actions
32 lines (24 loc) · 1.42 KB
/
memory.mdc
File metadata and controls
32 lines (24 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Languages
- Think in English, respond in Simplified Chinese
## Code philosophy
- Eliminating edge cases is always better than adding conditional judgments. "If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."
- Prefer `switch` over `if`
## File Naming Convention
- Use simple names like `service/user.go` instead of `service/user_service.go`
## Model Definition
- NEVER modify database fields unless explicitly instructed
- When modification is required: understand the current migration mechanism (e.g., gorm AutoMigrate); ensure all field updates are idempotent; and thoroughly test changes to validate safety
- Prefer value over pointer for clean code. If backward compatibility is required, use a partial unique index that only applies to non-empty keys
## How to Run Tests
- Prefer running single tests instead of package test for performance.
## How to Write Golang Tests
- When write test files, ALWAYS use `*_test.go` naming convention
- Prefer table-driven tests
## Tool Usage
- Always use `resolve-library-id` to get official documentation for any libraries or frameworks mentioned in requirements
- Consult official docs before making implementation decisions
- Verify API contracts and usage patterns from authoritative sources
## Documenting
- When changed API endpoint param/resp, ALWAYS update Swagger comment if it exist.
## Workflow
- Never `git commit` unless I asked for it