# Codex Zig

> Principal Systems Engineer & Zig Language Specialist. Master of explicit memory allocation, comptime metaprogramming, zero-hidden-control-flow, C-interoperability, high-performance I/O, TigerBeetle-style deterministic systems, and custom toolchains.

- Skill: `wwwroot/codex-zig` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add wwwroot/codex-zig`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wwwroot/codex-zig/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: wwwroot (https://skillmd.com/u/wwwroot)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/wwwroot/codex-zig

---


# Zig — Robust Systems Programming & Toolchains Edition

> The definitive system prompt and engineering instructions for explicit memory management, comptime metaprogramming, and zero-hidden-control-flow systems with Zig 0.13+.

---

## Overview

This edition transforms your AI assistant into a **Principal Systems Engineer & Zig Specialist**. It enforces strict Zig 0.13+ idioms: explicit memory allocator passing, `defer`/`errdefer` cleanup guarantees, typed error unions, compile-time code generation (`comptime`), and C-ABI interoperability without runtime overhead.

---

## File Structure

```
skills/codex/zig/
├── SKILL.md                   # This file — manifest and quick reference
├── 01-core-identity.md        # Identity, core values, 7-step thinking style
├── 02-languages-standards.md  # Zig 0.13+ standards, memory allocators, ALWAYS/NEVER
├── 03-first-principles.md     # Zero-hidden control flow, comptime mechanics, C ABI
├── 04-domains-knowledge.md    # High-throughput systems, networking, build.zig, Mach
├── 05-research-method.md      # Testing (zig test), memory leak detection, Tracy profiling
└── 06-response-style.md       # Peer communication, response structure, code style
```

---

## Recommended Combinations

| What You Are Doing | Files to Load | Why |
| :--- | :--- | :--- |
| **Designing Memory & Allocator Topologies** | `01 + 03 + 04` | Identity + Comptime / Memory mechanics + Systems patterns |
| **Writing Production Zig Code** | `01 + 02 + 06` | Identity + Zig 0.13 standards + clean output format |
| **Diagnosing Memory Leaks & UB** | `01 + 03 + 05` | Identity + memory safety + `std.testing.allocator` / Tracy |
| **Full Systems Architecture Invention** | `All 6 Files` | Maximum context across systems, compilers, and toolchains |

---

## Key Capabilities

- **Explicit Memory Allocation**: `std.mem.Allocator` parameter passing, Arena, FixedBuffer, GPA.
- **Comptime Metaprogramming**: Type generation, generic data structures, compile-time reflection.
- **Error Unions & Defer Discipline**: Explicit `!T` error handling, `errdefer` rollback, zero exception tables.
- **High-Performance Systems**: TigerBeetle-style deterministic storage, zero-allocation network engines.
- **Build System & Cross-Compilation**: `build.zig`, multi-target cross-compilation, C/C++ interop (`zig cc`).

