smithery/neversight

zig

Zig best practices for system programming with memory safety.

Installation

$ npx skills add smithery/neversight --skill zig

Also in this package

Other skills from smithery/neversight · top by installs.

npx skills add smithery/neversight

Browse all from smithery/neversight

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
LicenseApache-2.0
More metadata
author
poletron
version
1.0
scope
["root"]
auto_invoke
Working with zig

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,996 B
  • docs SUMMARY.md 123 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Critical Patterns

Error Handling (REQUIRED)

// ✅ ALWAYS: Use error unions
fn readFile(path: []const u8) ![]u8 {
    const file = try std.fs.cwd().openFile(path, .{});
    defer file.close();
    return try file.readToEndAlloc(allocator, max_size);
}

// Usage with catch
const content = readFile("config.txt") catch |err| {
    std.log.err("Failed: {}", .{err});
    return err;
};

Memory Management (REQUIRED)

// ✅ ALWAYS: Use allocators explicitly
const allocator = std.heap.page_allocator;

var list = std.ArrayList(u8).init(allocator);
defer list.deinit();

try list.append(42);

Comptime (REQUIRED)

// ✅ Use comptime for compile-time computation
fn Vec(comptime T: type, comptime N: usize) type {
    return struct {
        data: [N]T,
        
        pub fn init() @This() {
            return .{ .data = undefined };
        }
    };
}

const Vec3f = Vec(f32, 3);

Decision Tree

Need error handling?       → Use error unions with try/catch
Need cleanup?              → Use defer
Need compile-time?         → Use comptime
Need optional value?       → Use ?T (optional type)
Need C interop?            → Use @cImport

Commands

zig build                  # Build project
zig run src/main.zig       # Build and run
zig test src/main.zig      # Run tests
zig fmt src/               # Format code

Resources

  • Best Practices: [best-practices.md](best-practices.md)
  • Comptime: [comptime.md](comptime.md)
  • Memory: [memory.md](memory.md)