Zig C interoperability skill. An agent skill from mohitmishra786/low-level-dev-skills.

MITAuto-check passedWriting & Content

Install Zig Cinterop

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

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

GitHub CLI
$ gh skill install mohitmishra786/low-level-dev-skills zig-cinterop --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-cinterop .claude/skills/zig-cinterop && 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-cinterop
GitHub stars
253
Token cost
~1.5k tokens
SKILL.md length
289 words
Files
2 (incl. references)
Skills in repo
138
Repo updated
First seen
Licence
MIT

At a glance

Zig C interoperability skill. An agent skill from mohitmishra786/low-level-dev-skills.

  • Works in 9 steps: Calling C from Zig with @cImport → translate-c — inspect C header translation → C type mapping → …
  • Calling C from Zig
  • 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 Cinterop is an agent skill from mohitmishra786/low-level-dev-skills. Zig C interoperability skill. Use when calling C from Zig, calling Zig from C, using @cImport and @cInclude, running translate-c on C headers, defining extern structs and packed structs, matching C ABI types, or building mixed C/Zig projects. Activates on queries about @cImport, @cInclude, translate-c, extern struct, packed struct, Zig C ABI, calling C from Zig, exporting Zig to C, or bindgen equivalents.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/translate-c-guide.md`).

It sits in Writing & Content, covering Translation. It works with Rust. 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

  • Calling C from Zig
  • Calling Zig from C
  • Using @cImport and @cInclude
  • Running translate-c on C headers

Example prompts

  • “/zig-cinterop”

Workflow steps

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

  1. Calling C from Zig with @cImport
  2. translate-c — inspect C header translation
  3. C type mapping
  4. extern struct — ABI-compatible structs
  5. packed struct — bit-level layout
  6. Exporting Zig to C
  7. Calling Zig from C in build.zig
  8. Opaque types and forward declarations
  9. Variadic functions

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, bash and c).

    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 Cinterop loads about 1.5k tokens when it runs, and up to ~2.7k if it reads all its reference files. Until then it costs about 105 tokens; SKILL.md has 289 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~105
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.7k

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). 289 words, ~1,519 tokens.

Download SKILL.mdSave it as .claude/skills/zig-cinterop/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
zig-cinterop
description
Zig C interoperability skill. Use when calling C from Zig, calling Zig from C, using @cImport and @cInclude, running translate-c on C headers, defining extern structs and packed structs, matching C ABI types, or building mixed C/Zig projects. Activates on queries about @cImport, @cInclude, translate-c, extern struct, packed struct, Zig C ABI, calling C from Zig, exporting Zig to C, or bindgen equivalents.

Zig C Interop

Purpose

Guide agents through Zig's C interoperability: @cImport/@cInclude for calling C, translate-c for header inspection, extern struct and packed struct for ABI-compatible types, exporting Zig for C consumption, and zig cc for mixed C/Zig builds.

Triggers

  • "How do I call a C function from Zig?"
  • "How do I use @cImport and @cInclude?"
  • "How do I export Zig functions to be called from C?"
  • "How do I define a struct that matches a C struct?"
  • "What does translate-c do?"
  • "How do I build a mixed C and Zig project?"

Workflow

1. Calling C from Zig with @cImport
zig
const c = @cImport({
    @cInclude("stdio.h");
    @cInclude("string.h");
    @cInclude("mylib.h");
    @cDefine("MY_FEATURE", "1");  // Equivalent to -DMY_FEATURE=1
    @cUndef("SOME_MACRO");
});

pub fn main() void {
    _ = c.printf("Hello from C: %d\n", @as(c_int, 42));

    var buf: [256]u8 = undefined;
    _ = c.snprintf(&buf, buf.len, "formatted: %d", @as(c_int, 100));
}

In build.zig:

zig
exe.linkLibC();  // Required when using C functions
exe.addIncludePath(b.path("include/"));
2. translate-c — inspect C header translation

translate-c converts C headers to Zig declarations, letting you see exactly how Zig sees a C API:

bash
# Translate a header file
zig translate-c /usr/include/stdio.h > stdio.zig

# Translate with defines/includes
zig translate-c -I include/ -DFEATURE=1 mylib.h > mylib.zig

# Translate and inspect specific types
zig translate-c mylib.h | grep -A5 "struct MyStruct"

This is Zig's equivalent of bindgen — you use it to understand what Zig generates, then use @cImport directly in code.

3. C type mapping
C typeZig type
intc_int
unsigned intc_uint
longc_long
unsigned longc_ulong
long longc_longlong
size_tusize
ssize_tisize
char *[*:0]u8 (null-terminated)
const char *[*:0]const u8
void **anyopaque
NULLnull
boolbool (C99) or c_int (older)
floatf32
doublef64
zig
// Passing strings to C
const str = "hello";
_ = c.puts(str);  // Zig string literals are [*:0]const u8

// Dynamic strings — need null terminator
var buf: [64:0]u8 = undefined;
const len = std.fmt.bufPrint(buf[0..63], "hello {d}", .{42}) catch unreachable;
buf[len] = 0;
_ = c.puts(&buf);
4. extern struct — ABI-compatible structs

Use extern struct to match a C struct's memory layout exactly:

zig
// Matches: struct Point { int x; int y; };
const Point = extern struct {
    x: c_int,
    y: c_int,
};

// Matches: struct Header { uint32_t magic; uint16_t version; uint16_t flags; };
const Header = extern struct {
    magic: u32,
    version: u16,
    flags: u16,
};

// Use with C API
var p = Point{ .x = 10, .y = 20 };
_ = c.draw_point(&p);
5. packed struct — bit-level layout
zig
// Matches C bitfield: struct { uint8_t flags : 4; uint8_t type : 4; };
const Flags = packed struct(u8) {
    mode: u4,
    kind: u4,
};

// Packed struct for wire protocols
const IpHeader = packed struct(u32) {
    ihl: u4,
    version: u4,
    tos: u8,
    total_length: u16,
};

var h: IpHeader = @bitCast(@as(u32, raw_bytes));
6. Exporting Zig to C
zig
// Export a function callable from C
export fn zig_add(a: c_int, b: c_int) c_int {
    return a + b;
}

// Export with specific calling convention
pub fn my_func(x: u32) callconv(.C) u32 {
    return x * 2;
}

// Export a struct (use extern struct for C layout)
export const VERSION: c_int = 42;

Generate a C header (manual or with tools):

c
/* mylib.h */
#ifndef MYLIB_H
#define MYLIB_H
#include <stdint.h>

int zig_add(int a, int b);
uint32_t my_func(uint32_t x);
extern int VERSION;

#endif
7. Calling Zig from C in build.zig
zig
// Build Zig as a C-compatible static library
const lib = b.addStaticLibrary(.{
    .name = "myzig",
    .root_source_file = b.path("src/lib.zig"),
    .target = target,
    .optimize = optimize,
});

// The C code that uses the Zig library
const c_exe = b.addExecutable(.{
    .name = "c_consumer",
    .target = target,
    .optimize = optimize,
});
c_exe.addCSourceFile(.{
    .file = b.path("src/main.c"),
    .flags = &.{"-std=c11"},
});
c_exe.linkLibrary(lib);
c_exe.linkLibC();
b.installArtifact(c_exe);
8. Opaque types and forward declarations
zig
// Forward-declared C struct (opaque)
const FILE = opaque {};
extern fn fopen(path: [*:0]const u8, mode: [*:0]const u8) ?*FILE;
extern fn fclose(file: *FILE) c_int;
extern fn fprintf(file: *FILE, fmt: [*:0]const u8, ...) c_int;

// Opaque handle pattern
const MyHandle = opaque {};
extern fn lib_create() ?*MyHandle;
extern fn lib_destroy(h: *MyHandle) void;
9. Variadic functions
zig
// Call variadic C functions using @call with variadic args
const c = @cImport(@cInclude("stdio.h"));

// printf works directly through @cImport
_ = c.printf("value: %d\n", @as(c_int, 42));

// For custom variadic C functions, use extern with ...
extern fn my_log(level: c_int, fmt: [*:0]const u8, ...) void;

For translate-c output guide and C ABI types reference, see references/translate-c-guide.md.

  • Use skills/zig/zig-compiler for zig cc C compilation and basic Zig builds
  • Use skills/zig/zig-build-system for build.zig with mixed C/Zig projects
  • Use skills/binaries/elf-inspection to verify symbol exports and ABI
  • Use skills/rust/rust-ffi for comparison with Rust's C FFI approach

© 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

SKILL.md and 1 other file (references) in skills/zig/zig-cinterop of mohitmishra786/low-level-dev-skills.

  • SKILL.md
  • references/translate-c-guide.md

Open the folder on GitHubat commit bdc5847

Compare with similar skills

Zig Cinterop 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 Cinterop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Zig Cinterop this skillmohitmishra786/low-level-dev-skills253—~1.5kAutomated safety check: PassMIT
Update TranslationsRaicuparta/rai-pal732—~839Automated safety check: PassGPL-3.0
Vero Source Verussunblaze-ucb/vero107—~1.8kAutomated safety check: NotesApache-2.0
Code TranslationArabelaTso/Skills-4-SE253—~3.1kAutomated safety check: PassApache-2.0
Add UI Stringopenfootmanager/openfootmanager1.1k—~2.6kAutomated safety check: PassGPL-3.0
Translate It Doc En Zhmxsm/rocketmq-rust1.5k—~1.2kAutomated safety check: PassApache-2.0

Similar skills

  • Update Translations

    Raicuparta/rai-pal

    A skill your agent uses when asked to update translations, localize strings, add new languages, fix missing translation keys, or sync language files in this project.

    732 GitHub stars~839 tokensUpdated 2 days ago
    Writing & ContentAuto-check passed
  • Vero Source Verus

    sunblaze-ucb/vero

    Load BEFORE translating Verus source (Rust with verus!. An agent skill from sunblaze-ucb/vero.

    107 GitHub stars~1.8k tokensUpdated 1 mo ago
    Writing & ContentAuto-check: notes
  • Code Translation

    ArabelaTso/Skills-4-SE

    Convert code between programming languages while preserving functionality and semantics.

    253 GitHub stars~3.1k tokensUpdated 1 mo ago
    Writing & ContentAuto-check passed
  • Add UI String

    openfootmanager/openfootmanager

    Add or change any text a player can see, in every locale the game ships in.

    1.1k GitHub stars~2.6k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Translate It Doc En Zh

    mxsm/rocketmq-rust

    Translate English IT and software engineering documents into professional, accurate Chinese.

    1.5k GitHub stars~1.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Translation Diff Export

    Devolutions/UniGetUI

    Compares UniGetUI JSON locale files against English, identifies untranslated or source-changed keys, and generates patch, reference, and handoff files for a target language.

    26k GitHub stars~1.1k tokensUpdated yesterday
    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 Cinterop

What does Zig Cinterop do?

Zig C interoperability skill. An agent skill from mohitmishra786/low-level-dev-skills. Zig Cinterop is an agent skill from mohitmishra786/low-level-dev-skills. Zig C interoperability skill.

When should I use Zig Cinterop?

Zig Cinterop fits situations like: calling C from Zig; calling Zig from C; using @cImport and @cInclude; running translate-c on C headers.

How do I install Zig Cinterop in Claude Code?

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

How do I install Zig Cinterop in Codex?

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

Can I use Zig Cinterop 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-cinterop -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-cinterop, .gemini/skills/zig-cinterop, .github/skills/zig-cinterop and .opencode/skills/zig-cinterop in your project.

What does Zig Cinterop need to run?

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

Does Zig Cinterop 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 Cinterop 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 Cinterop use?

Zig Cinterop 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 Cinterop use?

About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.2k tokens, read only when the agent opens those files.

What are the alternatives to Zig Cinterop?

Skills that share tags, products or a category with Zig Cinterop: Update Translations (Raicuparta/rai-pal, 732 stars), Vero Source Verus (sunblaze-ucb/vero, 107 stars), Code Translation (ArabelaTso/Skills-4-SE, 253 stars) and Add UI String (openfootmanager/openfootmanager, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Zig Cinterop?

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.