zig-patterns

zig-patterns is a skill for Claude Code from kelp/agent-plugins. It costs 86 tokens per session (1,380 once invoked), scanned A, original, MIT.

A reference for writing and reviewing Zig code, including differences between Zig 0.15 and 0.16.

In plain words
What is it for?
It helps choose correct patterns for I/O, lists, formatting, filesystem access, and build files in Zig projects.
Why use it?
It addresses outdated assumptions about Zig's language and library APIs that can cause compilation errors.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the zig-claude-kit plugin — 3 skills shipped together

Good fit It helps choose correct patterns for I/O, lists, formatting, filesystem access, and build files in Zig projects.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add kelp/agent-plugins
Claude Code
/plugin install zig-claude-kit

Made for: Claude Code.

Or install zig-claude-kit, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for zig-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/kelp/agent-plugins/zig-patterns/github.svg)](https://agentmods.dev/skills/kelp/agent-plugins/zig-patterns)
Your own site
<a href="https://agentmods.dev/skills/kelp/agent-plugins/zig-patterns"><img src="https://agentmods.dev/badge/skills/kelp/agent-plugins/zig-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for zig-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/kelp/agent-plugins/zig-patterns"><img src="https://agentmods.dev/badge/skills/kelp/agent-plugins/zig-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,380 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00086 $0.01380
Opus 5.5 $0.00034 $0.00552
Sonnet 5.5 $0.00017 $0.00276
Haiku 4.5 $0.00009 $0.00138

Measured 1mo ago against content hash f545f16b8630, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

zig-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/zig-claude-kit/skills/zig-patterns/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Zig Patterns -- Quick Reference

Your Zig training is outdated. The tables below give the correct pattern for each broken one. The plugin supports both 0.15.x and 0.16.x; detect the version first, then apply the shared corrections plus the version-specific ones.

1. Detect Zig version

Run:

${CLAUDE_PLUGIN_ROOT}/scripts/detect-zig-version.sh

It prints 0.15 or 0.16.

2. Shared corrections (both versions)

What Claude Thinks Reality Quick Fix
std.io.getStdOut().writer() REMOVED (Writergate) Buffered writer pattern -- see docs
std.io.getStdErr().writer() REMOVED (Writergate) Buffered writer pattern -- see docs
usingnamespace keyword exists REMOVED from language Zero-bit fields + @fieldParentPtr
async/await keywords exist REMOVED from language Will be library features in future
std.ArrayList(T).init(allocator) Managed API removed Unmanaged list, pass allocator to methods
std.BoundedArray exists REMOVED ArrayListUnmanaged.initBuffer(&buffer)
{} in format strings calls format Ambiguous -- compile error Use {f} to call format methods
Generic writers with anytype Concrete std.Io.Writer type Non-generic with buffer in interface
std.io.BufferedWriter exists REMOVED Writers have built-in buffering
Build uses .root_source_file Moved inside .root_module b.createModule(.{ .root_source_file = ... })
/ works on runtime signed ints Must be comptime-known and positive Use @divTrunc, @divFloor, or @divExact
% works on runtime signed ints Must be comptime-known and positive Use @rem or @mod
std.mem.tokenize Renamed tokenizeAny, tokenizeScalar, tokenizeSequence
std.process.args() returns iterator Now argsAlloc(allocator) Returns owned slice, must free
std.json.Parser Complete redesign std.json.parseFromSlice(T, allocator, text, .{})
for (items) |item, i| Index requires explicit range for (items, 0..) |item, i|
std.fifo.LinearFifo exists REMOVED Use std.Io.Reader/Writer
std.RingBuffer exists REMOVED Use std.Io.Reader/Writer
Arithmetic on undefined allowed Causes illegal behavior Never operate on undefined values
std.DoublyLinkedList(T) generic De-genericified Intrusive nodes with @fieldParentPtr
std.testing.expectEqualSlices Parameters swapped Expected first, actual second
File.writer() respects O_APPEND Uses positional writes Use writerStreaming() for append

Read the full file on GitHub · 104 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 104 lines · 86 tokens per session scan A f545f16b8630

Subscribe to this mod's changes

zig-patterns is a skill published in the GitHub repository kelp/agent-plugins (2 stars, last pushed 1mo ago), licensed MIT. It adds 86 tokens to every session and 1,380 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens

bun-bundler

This skill should be used when the user asks about "bun build", "Bun.build", "bundling with Bun", "code splitting", "tree shaking", "minification", "sourcemaps", "bundle optimization", "esbuild alternative", "building for production", "bundling TypeScript", "bundling for browser", "bundling for Node", or…

secondsky/claude-skills · 90 tokens

bun-ffi

This skill should be used when the user asks about "bun:ffi", "foreign function interface", "calling C from Bun", "native libraries", "dlopen", "shared libraries", "calling native code", or integrating C/C++ libraries with Bun.

secondsky/claude-skills · 56 tokens

bun-hot-reloading

Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

secondsky/claude-skills · 42 tokens

cloudflare-workers-multi-lang

Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code.

secondsky/claude-skills · 45 tokens

dotnet-analyzers

Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA, SA). Use when fixing unnecessary usings, code style violations, analyzer warnings, or verifying format compliance.

NikiforovAll/claude-code-rules · 45 tokens