/odin-native:zig-testingfrom ODIN Native
Writes and runs Zig tests: test blocks, zig test commands, std.testing assertions, leak detection, comptime tests, and the fuzzer.
Ships in ODIN Native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Field | Bound contract |
|---|---|
| Trigger | The user writes a test block, wants to run a subset of tests, needs the right std.testing assertion, suspects a leak in a test, wants a comptime check, or asks about Zig's fuzzer. |
| Authority | Read-only. The skill emits test code, build.zig lines, and commands to chat; the user runs them. Rollback is not needed. No remote mutation. |
| Side effect | Chat output; scratch test runs in a scratch directory. |
| Done | The test code and run command for the request are reported and a scratch zig test of the same shape passes (or fails on the leak or condition it was written to catch) on the installed Zig. |
zig version: required. Samples ran on Zig 0.14.1; the fuzzer is present there and marked experimental.build.zig shape.test "name" { ... } blocks in the source file or a dedicated file, using const testing = std.testing;. Run one file with zig test src/math.zig; run the project with zig build test. Filter by substring with zig test --test-filter "add" src/math.zig; in build.zig, pass filters through addTest(.{ .filters = ... }), for example from b.option([]const []const u8, "test-filter", "..."), so zig build test -Dtest-filter=add selects them. zig build test --summary all prints per-step results. Done when: the chosen subset runs.build.zig: const unit_tests = b.addTest(.{ .root_module = <module> }); then b.step("test", "Run unit tests").dependOn(&b.addRunArtifact(unit_tests).step);. A second addTest on tests/integration.zig hooked to the same step runs both; a separate test-unit step runs one. Done when: zig build test runs every intended test root.std.testing: expectEqual(expected, actual), expectEqualStrings, expectEqualSlices(T, expected, actual), expectApproxEqAbs(expected, actual, tolerance) and expectApproxEqRel for floats, expectError(error.Name, result), expect(condition), expectStringStartsWith, expectStringEndsWith. Literal integers need a typed expected value, @as(i32, 5), because expectEqual coerces to the expected type. Done when: each check uses the assertion that reports the most useful failure.std.testing.allocator, which reports any allocation not freed by the end of the test and fails it ([gpa] (err): memory address ... leaked). Pattern: var list = std.ArrayList(u32).init(testing.allocator); defer list.deinit();. For code that owns its allocator, std.heap.GeneralPurposeAllocator(.{}){} (an alias of DebugAllocator on 0.14.1) returns .ok or .leak from deinit(); assert on it in a defer block. Done when: every allocating test frees through a defer and a leak fails the run.comptime { std.debug.assert(isPowerOfTwo(16)); } fails the build; inside a test block, comptime { try testing.expect(isPowerOfTwo(8)); } runs the check during compilation; type facts use @sizeOf, @alignOf, and @typeInfo(u8).int.signedness with the lowercase tag. Done when: the comptime check compiles and the negative case fails the build.test block call try std.testing.fuzz(context, testOne, .{}), where testOne has the signature fn (context: @TypeOf(context), input: []const u8) anyerror!void and calls the parser or decoder under test; .corpus in the options seeds inputs. Run zig build test --fuzz, which starts a web interface on a local port and keeps searching; a plain zig build test runs each fuzz test once with a fixed input. Done when: the fuzz test is discovered (N fuzz tests found) and the fuzz run starts.zig test on the installed Zig, including one intentionally leaking test to see the allocator report. Done when: the pass and the intended failure both appear.| Failure class | Behavior |
|---|---|
expectEqual type mismatch on a literal | Wrap the expected value in @as(T, ...). |
| Test passes alone, leaks in the suite | The leaked allocation is in shared state; free it in the test that created it or in a defer. |
| Fuzz test not found | The test block must call std.testing.fuzz; an export fn fuzz is not the entry point. |
--fuzz unavailable | The installed Zig predates the built-in fuzzer; use an external fuzzer against a C-ABI export. |
| Comptime evaluation quota exceeded | Add @setEvalBranchQuota(N) in the evaluating scope: use zig-comptime. |
A chat report with the test code, the build.zig lines when the project needs them, the run and filter commands, and the scratch-run lines showing the pass count and the leak report from the deliberately leaking test.
What SKILL.md sets; muted values are Claude Code's defaults
138 skills in this plugin
/abi-and-calling-conventionsUse when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi./adc-dac-baremetalUse when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal./af-xdpUse when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-nativeOther plugins' skills for the same job