一键导入
zig-patterns
Zig language idioms, comptime, memory management, error handling, and C interop patterns for safe, performant systems programming.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Zig language idioms, comptime, memory management, error handling, and C interop patterns for safe, performant systems programming.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
ann-benchmarks フレームワーク規約(algos.yaml/HDF5/Pareto frontier分析)と ANN ベクトル検索の SIMD 距離カーネル最適化における落とし穴パターン(AVX2/AVX-512 ディスパッチャ検証・量子化の数学的等価性確認・部分集合とフルスケールの混同防止)。ArcFlare/NGT/NGTAQ 等の ANN R&D 作業時の参照用。実装作業自体は ann-perf-engineer agent に委譲する。
Use this skill to measure performance baselines, detect regressions before/after PRs, and compare stack alternatives.
Claude API / Anthropic Go SDK usage patterns, prompt caching, streaming, tool use, and model selection for Go applications.
C++ coding standards based on the C++ Core Guidelines (isocpp.github.io). Use when writing, reviewing, or refactoring C++ code to enforce modern, safe, and idiomatic practices.
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.
非推奨・後方互換用リダイレクト。旧 dig(コードベース深掘り分析→設計インタビュー→実装計画→自律実行)は swarm-loop に完全統合された。/dig と入力された場合は本ファイルの指示に従い、そのまま swarm-loop skill を 同じ目標・同じ引数で起動すること。dig 独自のロジックはここには存在しない。
基于 SOC 职业分类
| name | zig-patterns |
| description | Zig language idioms, comptime, memory management, error handling, and C interop patterns for safe, performant systems programming. |
| trigger | /zig-patterns |
// Error union: T!E
const result = try parseValue(input);
// Catch and handle
const value = parseValue(input) catch |err| switch (err) {
error.InvalidInput => return error.BadRequest,
error.Overflow => 0,
};
// errdefer for cleanup
fn openFile(path: []const u8) !std.fs.File {
const file = try std.fs.cwd().openFile(path, .{});
errdefer file.close();
return file;
}
// Always pass allocator explicitly
fn processItems(allocator: std.mem.Allocator, items: []const Item) ![]Result {
const results = try allocator.alloc(Result, items.len);
errdefer allocator.free(results);
return results;
}
// Arena for request-scoped allocations
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = arena.allocator();
// Stack arrays for known sizes
var buf: [4096]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(&buf);
// Generic data structure
fn Stack(comptime T: type) type {
return struct {
items: std.ArrayList(T),
pub fn push(self: *@This(), item: T) !void {
try self.items.append(item);
}
};
}
// Comptime type validation
fn assertNumeric(comptime T: type) void {
comptime {
const info = @typeInfo(T);
if (info != .Int and info != .Float) {
@compileError("Expected numeric type, got " ++ @typeName(T));
}
}
}
// Packed struct for bit fields / C ABI
const Flags = packed struct(u32) {
readable: bool,
writable: bool,
executable: bool,
_padding: u29 = 0,
};
// Tagged union
const Value = union(enum) {
int: i64,
float: f64,
string: []const u8,
};
const c = @cImport({
@cInclude("stdlib.h");
@cInclude("mylib.h");
});
export fn myFunc(x: c_int) c_int {
return x * 2;
}
test "stack operations" {
var stack = Stack(i32){ .items = std.ArrayList(i32).init(std.testing.allocator) };
defer stack.items.deinit();
try stack.push(1);
try std.testing.expectEqual(@as(i32, 1), stack.items.items[0]);
}
_ = try — always handle or propagate@panic in library code — return errors instead