0

Zig Project taste

# Zig Project taste of a systems developer who likes boring, explicit builds - Pin the Zig version per project (a .zig-version file or mise/zigup) because the language still breaks between releases. Confidence: 0.90 - Dr

Prompt · برومبتdevelopers

Works with

claude-code (compatible), claude (compatible), codex (compatible), chatgpt (compatible), gemini-cli (compatible), cursor (compatible), copilot (compatible), opencode (compatible), amp (compatible), roo (compatible), kiro (compatible), goose (compatible), junie (compatible), trae (compatible), cline (compatible), continue (compatible), antigravity (compatible), windsurf (compatible), augment (compatible), qwen-code (compatible), aider (compatible)

Content

Zig Project taste of a systems developer who likes boring, explicit builds

  • Pin the Zig version per project (a .zig-version file or mise/zigup) because the language still breaks between releases. Confidence: 0.90
  • Drive everything through build.zig: build, test, run and install steps, with no Makefile or shell wrappers. Confidence: 0.90
  • Declare dependencies in build.zig.zon with content hashes and fetch them with zig fetch --save. Confidence: 0.90
  • Use b.standardTargetOptions and b.standardOptimizeOption so any target and release mode work from the command line. Confidence: 0.85
  • Pass allocators explicitly into every function that allocates; never hide a global allocator. Confidence: 0.95
  • Use std.testing.allocator in tests so leaks and double frees fail the test. Confidence: 0.90
  • Pair every allocation with defer or errdefer on the very next line. Confidence: 0.90
  • Prefer an ArenaAllocator for short-lived request or frame work instead of freeing many small objects. Confidence: 0.80
  • Use the GeneralPurposeAllocator (DebugAllocator) in debug builds and check its leak report on exit. Confidence: 0.80
  • Return error unions and propagate with try; reserve catch unreachable for cases you can prove. Confidence: 0.90
  • Define small, specific error sets for public APIs instead of anyerror. Confidence: 0.80
  • Write tests in the same file as the code with test blocks, and run them all with zig build test. Confidence: 0.90
  • Keep comptime for real needs such as generics and lookup tables, not for clever metaprogramming. Confidence: 0.80
  • Use slices and sentinel-terminated types instead of raw many-item pointers wherever possible. Confidence: 0.85
  • Ship ReleaseSafe by default and use ReleaseFast only for measured hot paths. Confidence: 0.75
  • Use @import("std").log with scoped loggers instead of std.debug.print in library code. Confidence: 0.75
  • Wrap C libraries through @cImport in one small module and expose a Zig-style API from it. Confidence: 0.80
  • Use zig cc and zig build to cross-compile C and Zig code from one machine instead of separate toolchains. Confidence: 0.85
  • Run zig fmt in CI and fail the build when it would change any file. Confidence: 0.90
  • Test in CI on Linux, macOS and Windows, plus at least one cross-compiled target. Confidence: 0.80
  • Keep public library APIs in one root.zig and mark everything else non-pub. Confidence: 0.80
  • Generate API docs with -femit-docs and publish them with each release. Confidence: 0.65

Source and license

Source
Prompts Chat
Original
f/awesome-chatgpt-prompts/prompts.csv#zig-project-taste
License
MIT