Skip to content

Commit 4d1be55

Browse files
committed
DMD-920 improve CLAUDE.md
1 parent bb6e0b0 commit 4d1be55

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,43 @@ func processChildren(children []Child) {
182182
- **Direct "zap" logger** - Use `internal/pkg/log` package
183183
- **Naked returns**
184184
- **Underscores in package names**
185+
- **Deprecated functions** - Remove deprecated functions instead of keeping them; don't mark as deprecated if still needed
186+
- **Variables only used for logging** - Don't create variables solely for debug/info logging; inline or remove them
187+
- **Pseudo-version SDK dependencies** - Use tagged versions (e.g., `v2.12.0`) instead of pseudo-versions (e.g., `v2.9.1-0.20260109014800-d596b2c092e2`)
188+
189+
### Go Naming Conventions
190+
- **No "Get" prefix for getters** - Use `Type()` not `GetType()`, `Name()` not `GetName()`, `Source()` not `GetSource()`
191+
- **Use "Get" only when it fetches external data** - e.g., `GetFromAPI()`, `GetFromDatabase()`
192+
193+
### Function Return Values
194+
- **Wrap multiple return values** - When returning more than 3 values, wrap them in a struct
195+
- **Return errors, don't silently continue** - When an operation fails, return the error instead of continuing with empty/default values
196+
197+
Example - instead of:
198+
```go
199+
func fetchData() (a, b, c, d Type, err error)
200+
```
201+
Use:
202+
```go
203+
type fetchResult struct {
204+
A, B, C, D Type
205+
}
206+
func fetchData() (fetchResult, error)
207+
```
208+
209+
### String Building
210+
- **Use `strings.Builder` for concatenation** - More efficient than `fmt.Sprintf` or `+` for building strings
211+
212+
Example:
213+
```go
214+
func buildUID(prefix, name string) string {
215+
var b strings.Builder
216+
b.WriteString(prefix)
217+
b.WriteByte(':')
218+
b.WriteString(name)
219+
return b.String()
220+
}
221+
```
185222

186223
### Required Patterns
187224
- **Context handling**: Pass context as first parameter; respect cancellation; never store in structs

0 commit comments

Comments
 (0)