Zig Project Taste

Zig Project Taste

Lays down a developer's Zig project preferences as rules: pinned versions, build.zig-driven builds, explicit allocators, error sets, in-file tests and cross-compiled releases.

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

Public domain (CC0 1.0) · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 12,142 prompts

More by @OpenSourceBuffGuy

See all
Campus rain romance from umbrella to café prompt image

Campus rain romance from umbrella to café

Generates a 30-second live-action campus romance vlog: a shared umbrella in a sudden storm, a cosy café and golden sunlight after the rain.

video-prompt, vlog, romance, rain, photorealistic, handheld, timed-beats, short-film, lip-sync, golden-hour, cozy, negative-prompt, united-states, higher-education, dating, seedance, cinematic, quick

AI Debt Detector prompt image

AI Debt Detector

Audits AI-generated code for hidden debt such as missing error handling, orphaned resources, edge cases and hallucinated packages before merging.

agent-skill, audit, code-review, clean-code, vibe-coding, debugging, checklist, best-practices, for-developers, self-critique, refactoring, security-review, testing, structured-output, react, coding, quick, guardrails, ai-agents, claude-code, technical-debt

Charcoal Volt Open-Frame Photo Poster prompt image

Charcoal Volt Open-Frame Photo Poster

Gives a JSON style template for sparse low-key photo posters: a charcoal field, one bottom-centred subject, huge volt-lime geometric headline and a thin broken frame.

image-prompt, json-prompt, placeholders, template, poster, text-rendering, typography, graphic-design, minimalist, negative-space, symmetry, studio-lighting, moody, product-photography, photorealistic, limited-palette, for-designers, for-artists, advanced, long-form, structured-output, vertical-format, square-format

Reviews

Loading reviews…

Discussion

Loading comments…