Update CLAUDE.md.
This commit is contained in:
29
CLAUDE.md
29
CLAUDE.md
@@ -50,3 +50,32 @@ LEFT JOIN cuisine_translations ct ON ct.cuisine_slug = c.slug AND ct.lang = $lan
|
||||
|
||||
When adding a new entity with text fields, always create a `{table}_translations`
|
||||
companion table and use LEFT JOIN COALESCE in all read queries.
|
||||
|
||||
## Naming
|
||||
|
||||
**No abbreviated variable names.** Variables must use full descriptive names.
|
||||
Single- or two-letter names are only allowed when the abbreviation *is* the full description
|
||||
(e.g., a loop index `i`, a matrix coordinate `x`).
|
||||
|
||||
### Examples
|
||||
|
||||
| Avoid | Use instead |
|
||||
|-------|-------------|
|
||||
| `err` | `parseError`, `writeError`, `dbError`, `validationError` |
|
||||
| `ctx` | `requestContext`, `handlerContext`, `queryContext` |
|
||||
| `s` | `service`, `server` |
|
||||
| `r` | `request`, `repository` |
|
||||
| `w` | `writer`, `responseWriter` |
|
||||
| `h` | `handler` |
|
||||
| `req` | `request` |
|
||||
| `res` | `response`, `result` |
|
||||
| `msg` | `message` |
|
||||
| `cfg` | `config` |
|
||||
| `db` | `database` |
|
||||
| `tx` | `transaction` |
|
||||
| `buf` | `buffer` |
|
||||
| `tmp` | `temp`, or a descriptive name |
|
||||
|
||||
This rule applies to all languages in this repo (Go and Dart).
|
||||
In Go, name variables to avoid shadowing the `error` built-in and the `context` package —
|
||||
use descriptive prefixes: `parseError`, `requestContext`, etc.
|
||||
|
||||
Reference in New Issue
Block a user