AGENTS.md

## Zig Development

5 stars

Best use case

AGENTS.md is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

## Zig Development

Teams using AGENTS.md should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/zig/SKILL.md --create-dirs "https://raw.githubusercontent.com/loclv/llm-lean-log/main/zig/.agents/skills/zig/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/zig/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How AGENTS.md Compares

Feature / AgentAGENTS.mdStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

## Zig Development

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# AGENTS.md

## Zig Development

Always use `zigdoc` to discover APIs for the Zig standard library and any third-party dependencies.
Examples:
```bash
zigdoc std.fs
zigdoc std.posix.getuid
zigdoc ghostty-vt.Terminal
zigdoc vaxis.Window
```

## Common Zig Patterns

These patterns reflect current Zig APIs and may differ from older documentation.
ArrayList:
```zig
var list: std.ArrayList(u32) = .empty;
defer list.deinit(allocator);
try list.append(allocator, 42);
```

HashMap/StringHashMap (unmanaged):
```zig
var map: std.StringHashMapUnmanaged(u32) = .empty;
defer map.deinit(allocator);
try map.put(allocator, "key", 42);
```

HashMap/StringHashMap (managed):
```zig
var map: std.StringHashMap(u32) = std.StringHashMap(u32).init(allocator);
defer map.deinit();
try map.put("key", 42);
```

stdout/stderr Writer:
```zig
var buf: [4096]u8 = undefined;
const writer = std.fs.File.stdout().writer(&buf);
defer writer.flush() catch {};
try writer.print("hello {s}\n", .{"world"});
```

build.zig executable/test:
```zig
b.addExecutable(.{
    .name = "foo",
    .root_module = b.createModule(.{
        .root_source_file = b.path("src/main.zig"),
        .target = target,
        .optimize = optimize,
    }),
});
```

JSON writing:
```zig
// Use std.json.Stringify with a buffered writer
var buf: [4096]u8 = undefined;
var writer = std.fs.File.stdout().writer(&buf);
defer writer.interface.flush() catch {};

var jw: std.json.Stringify = .{
    .writer = &writer.interface,
    .options = .{ .whitespace = .indent_2 },
};
try jw.write(my_struct);  // Serialize any struct/value directly
```

Allocating writer (dynamic buffer):
```zig
var writer: std.Io.Writer.Allocating = .init(allocator);
defer writer.deinit();
try writer.writer.print("hello {s}", .{"world"});
const output = writer.toOwnedSlice();  // Get result
```

## Zig Code Style

Naming:
- `camelCase` for functions and methods
- `snake_case` for variables and parameters
- `PascalCase` for types, structs, and enums
- `SCREAMING_SNAKE_CASE` for constants

Struct initialization: Prefer explicit type annotation with anonymous literals:
```zig
const foo: Type = .{ .field = value };  // Good
const foo = Type{ .field = value };     // Avoid
```

File structure:
1. `//!` doc comment describing the module
2. `const Self = @This();` (for self-referential types)
3. Imports: `std` → `builtin` → project modules
4. `const log = std.log.scoped(.module_name);`

Functions: Order methods as `init` → `deinit` → public API → private helpers
Memory: Pass allocators explicitly, use `errdefer` for cleanup on error

Documentation: Use `///` for public API, `//` for implementation notes. Always explain why, not just what.
Tests: Inline in the same file, register in src/main.zig test block

## Safety Conventions

Inspired by [TigerStyle](https://github.com/tigerbeetle/tigerbeetle/blob/main/docs/TIGER_STYLE.md).
Assertions:
- Add assertions that catch real bugs, not trivially true statements
- Focus on API boundaries and state transitions where invariants matter
- Good: bounds checks, null checks before dereference, state machine transitions
- Avoid: asserting something immediately after setting it, checking internal function arguments

Function size:
- Soft limit of 70 lines per function
- Centralize control flow (switch/if) in parent functions
- Push pure computation to helper functions

Comments:
- Explain why the code exists, not what it does
- Document non-obvious thresholds, timing values, protocol details

Related Skills

gitnexus-refactoring

5
from loclv/llm-lean-log

Use when the user wants to rename, extract, split, move, or restructure code safely. Examples: "Rename this function", "Extract this into a module", "Refactor this class", "Move this to a separate file"

gitnexus-impact-analysis

5
from loclv/llm-lean-log

Use when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: "Is it safe to change X?", "What depends on this?", "What will break?"

gitnexus-guide

5
from loclv/llm-lean-log

Use when the user asks about GitNexus itself — available tools, how to query the knowledge graph, MCP resources, graph schema, or workflow reference. Examples: "What GitNexus tools are available?", "How do I use GitNexus?"

gitnexus-exploring

5
from loclv/llm-lean-log

Use when the user asks how code works, wants to understand architecture, trace execution flows, or explore unfamiliar parts of the codebase. Examples: "How does X work?", "What calls this function?", "Show me the auth flow"

gitnexus-debugging

5
from loclv/llm-lean-log

Use when the user is debugging a bug, tracing an error, or asking why something fails. Examples: "Why is X failing?", "Where does this error come from?", "Trace this bug"

gitnexus-cli

5
from loclv/llm-lean-log

Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki, or list indexed repos. Examples: "Index this repo", "Reanalyze the codebase", "Generate a wiki"

Bun - JS runtime

5
from loclv/llm-lean-log

## File API

agent-developing-agents

9
from wahidyankf/open-sharia-enterprise

AI agent development standards including frontmatter structure, naming conventions, tool access patterns, model selection, and reference documentation structure

parallel-agents

9
from jpoutrin/product-forge

Use when parallelizing development, running multiple agents, splitting work across agents, coordinating parallel tasks, or decomposing PRDs for concurrent execution. Breaks work into independent agent workstreams.

create-agents-md

8
from siviter-xyz/dot-agent

Create AGENTS.md files for project-specific inline rules. Use when adding small, project-specific instructions that should be committed in repos.

claude-to-agents

8
from reidemeister94/development-skills

Use when user wants to make a project's agent context compatible with both Claude Code and Codex CLI and AGENTS.md standards

coding-agents-prompt-authoring

8
from griddynamics/rosetta

Author, update, and validate prompts (skills, agents, subagents, workflows, commands, rules, templates, or just any generic prompt). Produces a final prompt with analytics artifacts (brief, contracts, and a validation pack). Use when creating, editing, refactoring, reviewing, validating, or migrating prompts for AI coding agents.