Zig comptime skill for compile-time evaluation and metaprogramming.

MITAuto-check passed

Install Zig Comptime

skills CLI
$ npx skills add mohitmishra786/low-level-dev-skills --skill zig-comptime -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mohitmishra786/low-level-dev-skills zig-comptime --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/zig/zig-comptime .claude/skills/zig-comptime && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
zig-comptime
GitHub stars
253
Token cost
~2.1k tokens
SKILL.md length
232 words
Files
1
Skills in repo
138
Repo updated
First seen
Licence
MIT

At a glance

Zig comptime skill for compile-time evaluation and metaprogramming.

  • Works in 7 steps: comptime basics → Generic functions with comptime type… → anytype — duck-typed comptime parameters → …
  • Using comptime parameters
  • SKILL.md covers Purpose, Triggers, Workflow and Related skills
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Zig Comptime is an agent skill from mohitmishra786/low-level-dev-skills. Zig comptime skill for compile-time evaluation and metaprogramming. Use when using comptime parameters, comptime types, generics via anytype, comptime reflection with @typeInfo, or metaprogramming patterns that replace C++ templates. Activates on queries about Zig comptime, compile-time evaluation, Zig generics, anytype, @typeInfo, comptime types, or Zig metaprogramming.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with C++. The repository describes itself as: A curated suite of AI agent skills for systems and low-level programming with C/C++, Rust, and Zig toolchains, covering compilers, debuggers, profilers, build systems…. The licence is MIT.

When your agent uses it

  • Using comptime parameters
  • Generics via anytype
  • Comptime reflection with @typeInfo
  • Metaprogramming patterns that replace C++ templates

Example prompts

  • “/zig-comptime”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. comptime basics
  2. Generic functions with comptime type parameters
  3. anytype — duck-typed comptime parameters
  4. Type reflection with @typeInfo
  5. Comptime-generated code patterns
  6. comptime vs C++ templates comparison
  7. Common comptime patterns

What it can do on your machine

Read from SKILL.md and the folder at commit bdc5847. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are zig).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Zig Comptime loads about 2.1k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 232 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mohitmishra786/low-level-dev-skills at commit bdc5847, republished under its MIT licence (© mohitmishra786). 232 words, ~2,052 tokens.

Download SKILL.mdSave it as .claude/skills/zig-comptime/SKILL.md (or your agent's skills folder).
name
zig-comptime
description
Zig comptime skill for compile-time evaluation and metaprogramming. Use when using comptime parameters, comptime types, generics via anytype, comptime reflection with @typeInfo, or metaprogramming patterns that replace C++ templates. Activates on queries about Zig comptime, compile-time evaluation, Zig generics, anytype, @typeInfo, comptime types, or Zig metaprogramming.

Zig comptime

Purpose

Guide agents through Zig's comptime system: compile-time function evaluation, comptime type parameters, generics via anytype, type reflection with @typeInfo, and metaprogramming patterns that replace C++ templates and macros.

Triggers

  • "How does comptime work in Zig?"
  • "How do I write a generic function in Zig?"
  • "How do I use @typeInfo for reflection?"
  • "How do I generate code at compile time in Zig?"
  • "How does anytype work in Zig?"
  • "How do Zig generics compare to C++ templates?"

Workflow

1. comptime basics
zig
// comptime keyword forces compile-time evaluation
const x: comptime_int = 42;         // comptime integer (arbitrary precision)
const y: comptime_float = 3.14159;  // comptime float (arbitrary precision)

// comptime block — runs at compile time
comptime {
    const val = fibonacci(20);       // computed at compile time
    std.debug.assert(val == 6765);   // compile-time assertion
}

// comptime parameter — caller must provide a comptime-known value
fn makeArray(comptime T: type, comptime n: usize) [n]T {
    return [_]T{0} ** n;             // array of n zeros of type T
}

const arr = makeArray(f32, 8);      // [8]f32 computed at compile time
2. Generic functions with comptime type parameters
zig
const std = @import("std");

// Generic max function — T must be comptime-known
fn max(comptime T: type, a: T, b: T) T {
    return if (a > b) a else b;
}

// Usage: T is inferred from arguments or specified explicitly
const r1 = max(i32, 3, 7);          // 7
const r2 = max(f64, 2.5, 1.8);     // 2.5

// Generic Stack data structure
fn Stack(comptime T: type) type {
    return struct {
        items: []T,
        top: usize,
        allocator: std.mem.Allocator,

        const Self = @This();

        pub fn init(allocator: std.mem.Allocator) !Self {
            return Self{
                .items = try allocator.alloc(T, 64),
                .top = 0,
                .allocator = allocator,
            };
        }

        pub fn push(self: *Self, value: T) void {
            self.items[self.top] = value;
            self.top += 1;
        }

        pub fn pop(self: *Self) ?T {
            if (self.top == 0) return null;
            self.top -= 1;
            return self.items[self.top];
        }

        pub fn deinit(self: *Self) void {
            self.allocator.free(self.items);
        }
    };
}

// Usage: Stack(i32) and Stack(f64) are distinct types
var int_stack = try Stack(i32).init(allocator);
defer int_stack.deinit();
int_stack.push(42);
3. anytype — duck-typed comptime parameters

anytype accepts any type and the compiler infers it at the call site:

zig
// anytype: function works for any type with .len field
fn printLength(thing: anytype) void {
    std.debug.print("Length: {}\n", .{thing.len});
}

printLength("hello");                // string literal — works
printLength([_]u8{1, 2, 3});        // array — works
printLength(std.ArrayList(u32){});   // ArrayList — works

// anytype with comptime checks for better errors
fn serialize(writer: anytype, value: anytype) !void {
    // Verify writer has write method at comptime
    if (!@hasDecl(@TypeOf(writer), "write")) {
        @compileError("writer must have a write method");
    }
    try writer.write(std.mem.asBytes(&value));
}

// anytype in struct methods (used throughout std library)
pub fn format(
    self: MyType,
    comptime fmt: []const u8,
    options: std.fmt.FormatOptions,
    writer: anytype,    // any writer: file, buffer, etc.
) !void {
    try writer.print("{} {}", .{self.x, self.y});
}
4. Type reflection with @typeInfo

@typeInfo returns a tagged union describing a type's structure at comptime:

zig
const std = @import("std");
const TypeInfo = std.builtin.Type;

fn printTypeInfo(comptime T: type) void {
    const info = @typeInfo(T);
    switch (info) {
        .Int => |i| std.debug.print("Int: {} bits, {s}\n",
            .{i.bits, @tagName(i.signedness)}),
        .Float => |f| std.debug.print("Float: {} bits\n", .{f.bits}),
        .Struct => |s| {
            std.debug.print("Struct with {} fields:\n", .{s.fields.len});
            inline for (s.fields) |field| {
                std.debug.print("  {s}: {}\n", .{field.name, field.type});
            }
        },
        .Enum => |e| {
            std.debug.print("Enum with {} values:\n", .{e.fields.len});
            inline for (e.fields) |field| {
                std.debug.print("  {s} = {}\n", .{field.name, field.value});
            }
        },
        .Optional => |o| std.debug.print("Optional({s})\n", .{@typeName(o.child)}),
        .Array => |a| std.debug.print("[{}]{s}\n", .{a.len, @typeName(a.child)}),
        else => std.debug.print("Other type: {s}\n", .{@typeName(T)}),
    }
}

// Usage at comptime
comptime { printTypeInfo(u32); }   // Int: 32 bits, unsigned
comptime { printTypeInfo(f64); }   // Float: 64 bits
5. Comptime-generated code patterns
zig
// Generate a lookup table at comptime
const sin_table = blk: {
    const N = 256;
    var table: [N]f32 = undefined;
    @setEvalBranchQuota(10000);     // increase for expensive comptime eval
    for (0..N) |i| {
        const angle = @as(f32, @floatFromInt(i)) * (2.0 * std.math.pi / N);
        table[i] = @sin(angle);
    }
    break :blk table;
};

// Comptime string processing
fn upperCase(comptime s: []const u8) [s.len]u8 {
    var result: [s.len]u8 = undefined;
    for (s, 0..) |c, i| {
        result[i] = std.ascii.toUpper(c);
    }
    return result;
}
const HELLO = upperCase("hello");  // computed at compile time

// Structural typing: accept any struct with specific fields
fn area(shape: anytype) f64 {
    const T = @TypeOf(shape);
    if (@hasField(T, "width") and @hasField(T, "height")) {
        return @as(f64, shape.width) * @as(f64, shape.height);
    } else if (@hasField(T, "radius")) {
        return std.math.pi * @as(f64, shape.radius) * @as(f64, shape.radius);
    } else {
        @compileError("shape must have width+height or radius fields");
    }
}
6. comptime vs C++ templates comparison
FeatureC++ templatesZig comptime
Syntaxtemplate<typename T>fn foo(comptime T: type)
Error messagesCryptic instantiation stacksClear, at definition point
Specializationtemplate<> class Foo<int>if (T == i32) { ... } with inline if
SFINAEComplex enable_if@hasDecl, @hasField, @compileError
Variadictemplate<typename... Ts>anytype, tuples, inline for
Compile timeCan be very slowExplicit, bounded by @setEvalBranchQuota
ValuesRequires constexprAny expression can be comptime
MacrosSeparate #define systemComptime functions replace most macros
7. Common comptime patterns
zig
// Pattern: compile error for unsupported types
fn serializeInt(comptime T: type, value: T) []const u8 {
    if (@typeInfo(T) != .Int) {
        @compileError("serializeInt requires an integer type, got: " ++ @typeName(T));
    }
    // ...
}

// Pattern: conditional compilation
const is_debug = @import("builtin").mode == .Debug;
if (comptime is_debug) {
    // included only in debug builds
    validateInvariant(self);
}

// Pattern: inline for over comptime-known slice
const fields = std.meta.fields(MyStruct);
inline for (fields) |field| {
    // field.name, field.type available at comptime
    std.debug.print("{s}\n", .{field.name});
}
  • Use skills/zig/zig-testing for comptime assertions and testing comptime code
  • Use skills/zig/zig-build-system for comptime-based build.zig configuration
  • Use skills/compilers/cpp-templates for C++ template equivalent patterns

© mohitmishra786, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/zig/zig-comptime of mohitmishra786/low-level-dev-skills.

Open the folder on GitHubat commit bdc5847

Compare with similar skills

Zig Comptime next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Zig Comptime compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Zig Comptime this skillmohitmishra786/low-level-dev-skills253—~2.1kAutomated safety check: PassMIT
Paddle BuildPaddlePaddle/Paddle24k—~1kAutomated safety check: PassApache-2.0
Fory Releaseapache/fory4.6k—~2.9kAutomated safety check: PassApache-2.0
ONNX Runtime Shape Inference Safety Auditmicrosoft/onnxruntime22k—~3.3kAutomated safety check: PassMIT
Code Audit3stoneBrother/code-audit8931 repos~2.7kAutomated safety check: PassNone
Qt C++ Code Reviewx-tools-author/x-tools1.1k2 repos~4.3kAutomated safety check: PassBSD-3-Clause

Similar skills

  • Paddle Build

    PaddlePaddle/Paddle

    A skill your agent uses when needing to compile, rebuild, or install Paddle from source after code changes.

    24k GitHub stars~1k tokensUpdated 9 days ago
    AI & LLM EngineeringAuto-check passed
  • Fory Release

    apache/fory

    Prepare an Apache Fory release candidate from a clean release branch, including the version bump, RC tag, JVM staging, ASF source artifacts, SVN upload, and vote email.

    4.6k GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Official

    Finds and fixes out-of-range output writes in ONNX Runtime operator shape-inference functions where a getNumOutputs guard admits too few outputs.

    22k GitHub stars~3.3k tokensUpdated today
    SecurityAuto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    893 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • Qt C++ Code Review

    x-tools-author/x-tools

    Read-only review of Qt6 C++ code that combines a deterministic lint script with six parallel analysis agents and reports only high-confidence issues.

    1.1k GitHub starsUsed in 2 repos~4.3k tokens
    DevelopmentAuto-check passed
  • Translation

    doxygen/doxygen

    Keeps all Doxygen and Doxywizard translations up to date across three mechanisms: translator C++ classes (src/translatorxx.h), Qt .ts locale files for the Doxywizard GUI (addon/doxywizard/i18n/)…

    6.6k GitHub stars~5.2k tokensUpdated 8 days ago
    Writing & ContentAuto-check passed

More from mohitmishra786/low-level-dev-skills

All 138 skills in this repo
  • ARM and AArch64 Assembly

    mohitmishra786/low-level-dev-skills

    Guides reading and writing AArch64 and ARM Thumb assembly: compiler output, inline asm, registers, the AAPCS calling convention and NEON or SVE basics.

    253 GitHub stars~1.9k tokensUpdated 3 mo ago
    Auto-check passed
  • RISC-V Assembly Guide

    mohitmishra786/low-level-dev-skills

    Reference for RISC-V assembly on RV32 and RV64: register names and calling convention, extension naming, GCC and Clang inline asm, and QEMU with GDB debugging.

    253 GitHub stars~1.8k tokensUpdated 3 mo ago
    Auto-check passed
  • x86-64 Assembly Reference

    mohitmishra786/low-level-dev-skills

    Explains x86-64 registers, the System V AMD64 calling convention, and how to read compiler-generated or inline assembly.

    253 GitHub stars~1.5k tokensUpdated 3 mo ago
    Auto-check passed
  • Bazel for C and C++

    mohitmishra786/low-level-dev-skills

    Guides your agent through Bazel for C/C++ projects: BUILD files, Bzlmod dependencies, toolchain registration, remote execution, dependency queries and sandbox debugging.

    253 GitHub stars~1.5k tokensUpdated 3 mo ago
    Auto-check passed
  • Binary Hardening

    mohitmishra786/low-level-dev-skills

    Binary hardening skill for security-hardened C/C++ builds. An agent skill from mohitmishra786/low-level-dev-skills.

    253 GitHub stars~2k tokensUpdated 3 mo ago
    Auto-check passed
  • Binutils

    mohitmishra786/low-level-dev-skills

    GNU binutils skill for binary manipulation and analysis. An agent skill from mohitmishra786/low-level-dev-skills.

    253 GitHub stars~1.2k tokensUpdated 3 mo ago
    Auto-check passed

Works with

Questions about Zig Comptime

What does Zig Comptime do?

Zig comptime skill for compile-time evaluation and metaprogramming. Zig Comptime is an agent skill from mohitmishra786/low-level-dev-skills. Zig comptime skill for compile-time evaluation and metaprogramming.

When should I use Zig Comptime?

Zig Comptime fits situations like: using comptime parameters; generics via anytype; comptime reflection with @typeInfo; metaprogramming patterns that replace C++ templates.

How do I install Zig Comptime in Claude Code?

Run `npx skills add mohitmishra786/low-level-dev-skills --skill zig-comptime -a claude-code`. Or copy the skill folder (skills/zig/zig-comptime in mohitmishra786/low-level-dev-skills) into .claude/skills/zig-comptime in your project. Claude Code loads it when a task matches its description.

How do I install Zig Comptime in Codex?

Run `npx skills add mohitmishra786/low-level-dev-skills --skill zig-comptime -a codex`. Or copy the skill folder (skills/zig/zig-comptime in mohitmishra786/low-level-dev-skills) into .agents/skills/zig-comptime in your project. Codex loads it when a task matches its description.

Can I use Zig Comptime in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mohitmishra786/low-level-dev-skills --skill zig-comptime -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/zig-comptime, .gemini/skills/zig-comptime, .github/skills/zig-comptime and .opencode/skills/zig-comptime in your project.

What does Zig Comptime need to run?

SKILL.md names no scripts, command-line tools or credentials: Zig Comptime is instructions for the agent only.

Does Zig Comptime access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Zig Comptime safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Zig Comptime use?

Zig Comptime is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Zig Comptime use?

About 2.1k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Zig Comptime?

Skills that share tags, products or a category with Zig Comptime: Paddle Build (PaddlePaddle/Paddle, 24k stars), Fory Release (apache/fory, 4.6k stars), ONNX Runtime Shape Inference Safety Audit (microsoft/onnxruntime, 22k stars) and Code Audit (3stoneBrother/code-audit, 893 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Zig Comptime?

mohitmishra786 (a GitHub user) maintains it in mohitmishra786/low-level-dev-skills, which has 253 GitHub stars. The repository holds 138 skills in this directory. The repository was last updated on June 27, 2026.

Source: mohitmishra786/low-level-dev-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.