zig
Auto-apply when working with Zig. Trigger this skill when the user asks to create, modify, or debug Zig code, build.zig scripts, or Zig tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Auto-apply when working with Zig. Trigger this skill when the user asks to create, modify, or debug Zig code, build.zig scripts, or Zig tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Auto-apply when working with Angular. Trigger this skill when the user asks to create, modify, or debug Angular components, services, directives, pipes, HTML templates, or run Angular CLI commands.
Auto-apply when working with Go (Golang). Trigger this skill when the user asks to create, modify, or debug Go code, HTTP handlers, middleware, CLI tools, or Go tests.
MANDATORY: Invoke this skill ONLY when modifying, adding, auditing, or refactoring the prompt files, rules, agents, commands, or skills inside this specific 'agent.files' configuration repository. It provides the structural mapping and macro-compilation logic for the Agentic Unified Prompt Compiler (AUPC).
MANDATORY: Invoke this skill when adding new prompts, agents, rules, commands, or entire configuration folders to the agent.files repository. It acts as an immune system, reviewing new knowledge for conflicts, splitting it according to the Directory Paradigm, and seamlessly enhancing existing configurations.
MANDATORY: Invoke this skill to perform a holistic architectural audit, redundancy check, and context-window optimization on the agent.files repository. You MUST invoke the 'agent-architect' skill FIRST to understand the repository structure before running this audit.
MANDATORY: Invoke this skill when adding support for a BRAND NEW AI IDE (e.g., VS Code Copilot, Windsurf) to the agent.files repository. It automates the creation of IDE-specific Host Shells by translating universal _core philosophies into the new IDE's dialect.
| name | zig |
| description | Auto-apply when working with Zig. Trigger this skill when the user asks to create, modify, or debug Zig code, build.zig scripts, or Zig tests. |
You are an expert in the Zig programming language. Zig is not yet stable (v1.0), so std.Build and stdlib APIs change between minor versions.
Rule #1: Never generate Zig code without knowing the active toolchain version.
Before answering any coding question, execute the following mental or actual checks:
zig version.build.zig.zon for .minimum_zig_version or .version.const Builder = std.build.Builder; (old) vs pub fn build(b: *std.Build) void (0.11+).zig version, stop and warn.std.build.Builder.std.Build.b.addExecutable(...) object-oriented API.std.http and std.net changes.GPA.init and root_module in build scripts.std.Io (new I/O); async/await removed.std.process.Init); @cImport removed; @Type split into @Int/@Struct/etc.; std.Io param threading mandatory; unmanaged containers; process/sync/time APIs migrated to Io. Read the migration file before generating code (see Section 5).Modern Zig projects follow this structure:
build.zig: The build script.
build.zig.zon: (Zig 0.11+) The package manifest.
src/main.zig: Standard entry point.Instruct the user to use these commands:
zig build check (if present).zig build test --summary allzig build runzig fmt . (Enforce this style).Zig is manual. Always define ownership and allocator lifetime.
// >= 0.16: Allocators and I/O come from main's init parameter
pub fn main(init: std.process.Init) !void {
const gpa = init.gpa; // general-purpose allocator
const arena = init.arena; // scratch arena (no deinit needed)
const io = init.io; // required for ALL I/O calls
_ = .{ gpa, arena, io };
}
// <= 0.15: Manual allocator setup
var gpa_inst = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa_inst.deinit();
const allocator = gpa_inst.allocator();
For library code (no main), accept allocator and io as function parameters.
!T) everywhere.try to bubble up errors.catch |err| switch (err) or if (res) |val| else |err| to handle them.for (items) |item| (Old) vs for (items) |*item| (Pointer capture) vs for (items, 0..) |item, i| (Index capture).
Zig has breaking API changes every minor version. When the detected version has a migration file, read it before generating any code to ensure no deprecated/removed APIs are used.
Available migration files (in this skill's migrations/ directory):
migrations/0.16.md — "Juicy Main", I/O threading, @cImport removal, @Type split, unmanaged containers, process/sync/time migrationWorkflow:
Docs: Context7 /websites/ziglang · Fallback: https://ziglang.org/documentation
CRITICAL: Always match documentation to the project's Zig version. Syntax and stdlib APIs change between minor releases.