zig-guide
Installation
SKILL.md
Zig Guide
Applies to: Zig 0.13+, Systems Programming, CLIs, Embedded, Game Engines, C/C++ Replacement
Core Principles
- Explicit Over Implicit: No hidden control flow, no hidden allocations, no operator overloading, no implicit conversions
- Allocator Passing: Every function that allocates receives an
std.mem.Allocatoras a parameter; never use a global allocator - Errors Are Values: Use error unions (
!) withtry,catch, anderrdefer; never silently discard errors - Comptime Over Runtime: Move computation to compile time with
comptime; use it for generics, validation, and code generation - Safety With Escape Hatches: Keep runtime safety enabled by default; disable only in measured hot paths with a justifying comment
Guardrails
Code Style
- Run
zig fmtbefore every commit (non-negotiable) camelCasefunctions/variables,PascalCasetypes/structs/enums,SCREAMING_SNAKE_CASEmodule constants- Prefer
snake_casefor file names (my_module.zig)
Related skills