stand-odin
Skill1 starsChanged 12 days agoMITView on GitHub
Odin coding standards. Use when writing Odin code. Covers idiomatic error handling with or_else and or_return, memory/allocator patterns, attributes, naming and API conventions, and testing with core:testing.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-codeSkill
- analyze-projectSkill
- analyze-testsSkill
- audit-mergesSkill
- babysit-prSkill
- backlogSkill
- branchSkill
- coderabbitSkill
- commitSkill
- greptileSkill
- implement-issuesSkill
- issueSkill
- jiraSkill
- lintro-addSkill
- lintro-reviewSkill
- lintro-verifySkill
- lintSkill
- properizeSkill
- pr-raycastSkill
- prSkill
- raycastSkill
- rebaseSkill
- reconcileSkill
- scorecardSkill
- stand-ciSkill
- stand-generalSkill
- stand-pySkill
- stand-rustSkill
- stand-tsSkill
- sweep-prsSkill
- test-apiSkill
- test-shellSkill
- testSkill
- test-ui-qsfSkill
- test-uiSkill
- turbo-addSkill
- turbo-testSkill
- turbo-verifySkill
- which-prSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Prefer or_else when every failure path returns the same default:
- Very specific: line 46
Use or_return to propagate errors instead of check-and-return blocks:
- Very specific: line 57
Use explicit (value, ok) checks only when failure modes differ (log, branch, or propagate differently per case).
- Very specific: line 72
Do not expand (value, ok) into multi-branch control flow when every branch returns the same value — use or_else
- Very specific: line 74
Do not hardcode a 0 fallback when a default parameter is appropriate
- Very specific: line 75
Do not pre-check v == "" before trimming when a failed parse of the empty string already yields the fallback — only distinguish missing vs …
- Very specific: line 78
Do not write Go-style if err != nil { return err } ladders — use or_return
- Distinctive: line 114
Prefer default-parameter fallbacks for config/env parsing helpers
- Distinctive: line 120
Use default parameter values for fallbacks instead of sentinel checks
- Very specific: line 123
Prefer plain procs and struct composition — Odin has no classes or inheritance.
- Very specific: line 128
Use core:testing with the @(test) attribute.
- Very specific: line 151
Follow the lint skill where a project has lintro configured.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
// 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:
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:
// 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_returnUse 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:
@(private = "file")
trimmed :: proc(s: string) -> string { return strings.trim_space(s) }
@(require_results)
checksum :: proc(data: []byte) -> u32 { ... }Anti-Patterns
- Do not expand
(value, ok)into multi-branch control flow when every branch returns the same value — useor_else - Do not hardcode a
0fallback when adefaultparameter is appropriate - Do not pre-check
v == ""before trimming when a failed parse of the empty string already yields the fallback — only distinguish missing vs empty vs invalid when the caller needs the distinction - Do not write Go-style
if err != nil { return err }ladders — useor_return
Memory & Allocators
context.temp_allocatorfor short-lived scratch data (env lookups, parse buffers, per-frame strings); free in bulk withfree_all(context.temp_allocator)at a natural boundary (frame/request)context.allocatorfor general heap allocation; pairmake/newwithdelete/free, typically viadefer- In library code, take an explicit
allocator := context.allocatorparameter instead of allocating from implicit globals:
// Don't — caller cannot control allocation
clone_name :: proc(s: string) -> string { return strings.clone(s) }
// Do — caller controls allocation; allocator errors propagate
clone_name :: proc(s: string, allocator := context.allocator) -> (string, mem.Allocator_Error) {
return strings.clone(s, allocator)
}- Copy strings that must outlive their source; temp-allocate strings that do not escape the current scope
Error Handling
or_else— same default for every failureor_return— early exit from a procedure whose final return value is an error orokboolean- Explicit
(value, ok)— failure modes need different handling - Model recoverable failures as error enums or unions returned as the last
value; reserve
panicfor unrecoverable programmer error, never library control flow assert/#assertonly for invariants, not input validation- Prefer default-parameter fallbacks for config/env parsing helpers
Types & API Design
snake_casefor procedures and variables;Ada_Casefor types (Entity_Kind,Parse_Error);SCREAMING_SNAKE_CASEfor constants- Use default parameter values for fallbacks instead of sentinel checks
- Encode domain constraints in the name (
parse_env_f64_nonneg) or via post-parse validation (max(0, x)) - Prefer plain
procs and struct composition — Odin has no classes or inheritance; do not simulate them
Testing
- Use
core:testingwith the@(test)attribute; run viaodin test - Table-driven cases over one-proc-per-case:
import "core:testing"
@(test)
parse_env_int_defaults :: proc(t: ^testing.T) {
cases := [][2]int{{-3, -3}, {0, 0}, {42, 42}}
for c in cases {
testing.expect_value(t, parse_env_int("MISSING_KEY", c[0]), c[1])
}
}- For parsing helpers, cover: missing, empty, whitespace-only, invalid, valid, and domain edges (e.g. negative clamp)
- Defer global coverage/commit rules to
stand-general
Toolchain
odin checkis the primary validation gate;odin build -vet -strict-stylecatches unused values and style drift- Follow the
lintskill where a project has lintro configured; no lintro Odin plugin exists yet, so the compiler vet flags are the linter
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

