stand-odinlisted
Install: claude install-skill lgtm-hq/ai-skills
# Odin Standards
Standards for Odin code. Odin is underrepresented in training data — do not
transplant Go/Rust/C error-handling patterns verbatim; reach for Odin
constructs first.
## Idioms
Prefer `or_else` when every failure path returns the same default:
```odin
// Don't — all branches return the same fallback
parse_env_int :: proc(key: string, default: int = 0) -> int {
v, ok := os.lookup_env(key, context.temp_allocator)
if !ok || v == "" { return default }
x, ok2 := strconv.parse_int(strings.trim_space(v), 10)
if !ok2 { return default }
return x
}
// Do
parse_env_int :: proc(key: string, default: int = 0) -> int {
v := os.lookup_env(key, context.temp_allocator) or_else ""
return strconv.parse_int(strings.trim_space(v), 10) or_else default
}
```
Domain validation after parse is one line, not a rewrite:
```odin
parse_env_f64_nonneg :: proc(key: string, default: f64 = 0) -> f64 {
v := os.lookup_env(key, context.temp_allocator) or_else ""
x := strconv.parse_f64(strings.trim_space(v)) or_else default
return max(0, x)
}
```
Use `or_return` to propagate errors instead of check-and-return blocks:
```odin
// Don't
data, err := os.read_entire_file_or_err(path)
if err != nil { return nil, err }
// Do
data := os.read_entire_file_or_err(path) or_return
```
Use explicit `(value, ok)` checks only when failure modes differ (log,
branch, or propagate differently per case).
Mark file-local helpers and must-use results with attributes:
`