idea-analogist
想法群聊室 — 类比者角色。被 idea-team 主编排器调用,或用户单独说"类比一下"、"别的行业有没有"、"yes-and 扩展"、"X 让你想到什么"、"跨界启示"时触发。**专门做跨界类比 + yes-and 扩展——不评判、不挑刺、不要求事实证据**。Do NOT use when 用户要数据(用…
Modern Zig project architecture guide. Use when creating Zig projects (systems programming, CLI tools, game dev, high-performance services). Covers explicit allocators, comptime, error handling, and build system.
$ npx -y skills add majiayu000/spellbook --skill zig-project --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/zig-projectContext preview
The summary Claude sees to decide when to auto-load this skill.
Modern Zig project architecture guide. Use when creating Zig projects (systems programming, CLI tools, game dev, high-performance services). Covers explicit allocators, comptime, error handling, and build system.
name: zig-project description: Modern Zig project architecture guide. Use when creating Zig projects (systems programming, CLI tools, game dev, high-performance services). Covers explicit allocators, comptime, error handling, and build system.
---
> **Delete unused code. Change directly. No compatibility layers.**
// ❌ BAD: Deprecated function kept around
/// Deprecated: Use newFunction instead
pub fn oldFunction() void {
@compileLog("oldFunction is deprecated");
newFunction();
}
// ❌ BAD: Alias for renamed functions
pub const old_name = new_name; // "for backwards compatibility"
// ❌ BAD: Unused parameters
fn process(_: *const Config, data: []const u8) !void {
_ = data;
}
// ✅ GOOD: Just delete and update all usages
pub fn newFunction() void {
// ...
}
// ✅ GOOD: Remove unused parameters entirely
fn process(data: []const u8) !void {
// ...
}---
> **Use LiteLLM proxy. Don't call provider APIs directly.**
const std = @import("std");
const http = std.http;
pub const LLMClient = struct {
allocator: std.mem.Allocator,
base_url: []const u8,
api_key: []const u8,
pub fn init(allocator: std.mem.Allocator, base_url: []const u8, api_key: []const u8) LLMClient {
return .{
.allocator = allocator,
.base_url = base_url, // "http://localhost:4000"
.api_key = api_key,
};
}
pub fn complete(self: *LLMClient, prompt: []const u8, model: []const u8) ![]u8 {
// Use OpenAI-compatible API through LiteLLM proxy
var client = http.Client{ .allocator = self.allocator };
defer client.deinit();
// Build request to LiteLLM proxy...
_ = prompt;
_ = model;
return "";
}
};---
# Create new project mkdir myapp && cd myapp zig init # Or create executable project zig init-exe # Or create library project zig init-lib
myapp/ ├── build.zig # Build configuration (in Zig) ├── build.zig.zon # Package manifest (dependencies) ├── src/ │ ├── main.zig # Entry point (for exe) │ ├── root.zig # Library root (for lib) │ └── lib/ # Internal modules │ └── utils.zig ├── tests/ # Integration tests (optional) └── lib/ # Vendored dependencies
**build.zig.zon** (Package Manifest)
.{
.name = "myapp",
.version = "0.1.0",
.dependencies = .{
// .some_dep = .{
// .url = "https://github.com/...",
// .hash = "...",
// },
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}**build.zig** (Build Script)
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "myapp",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
// Run step
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the application");
run_step.dependOn(&run_cmd.step);
// Test step
const unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}---
Every function that allocates must receive an allocator parameter.
const std = @import("std");
// ❌ BAD: Hidden allocation (don't do this)
var global_allocator: std.mem.Allocator = undefined;
fn badAlloc() ![]u8 {
return global_allocator.alloc(u8, 100);
}
// ✅ GOOD: Explicit allocator
fn goodAlloc(allocator: std.mem.Allocator) ![]u8 {
return allocator.alloc(u8, 100);
}const std = @import("std");
pub fn main() !void {
// General purpose (with safety checks in debug)
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
// Arena (bulk alloc/dealloc)
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const arena_alloc = arena.allocator();
// Fixed buffer (no heap)
var buffer: [1024]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(&buffer);
const fixed_alloc = fba.allocator();
// Page allocator (direct OS calls)
const page_alloc = std.heap.page_allocator;
_ = allocator;
_ = arena_alloc;
_ = fixed_alloc;
_ = page_alloc;
}fn handleRequest(permanent_allocator: std.mem.Allocator) !void {
// Create arena for this request
var arena = std.heap.ArenaAllocator.init(permanent_allocator);
defer arena.deinit(); // Free ALL request memory at once
const allocator = arena.allocator();
// All allocations use arena - no individual frees needed
const data = try fetchData(allocator);
const processed = try pCross-runtime skills for Claude Code, Codex, and multi-agent workflows.
Repo: majiayu000/spellbook
想法群聊室 — 类比者角色。被 idea-team 主编排器调用,或用户单独说"类比一下"、"别的行业有没有"、"yes-and 扩展"、"X 让你想到什么"、"跨界启示"时触发。**专门做跨界类比 + yes-and 扩展——不评判、不挑刺、不要求事实证据**。Do NOT use when 用户要数据(用…
想法群聊室 — 反方角色。被 idea-team 主编排器调用,或用户单独说"反方意见"、"挑这个想法的刺"、"为什么会失败"、"找漏洞 / 反例"、"devil's advocate"时触发。**专门挑漏洞、找隐藏假设、给反例——不安慰、不"也许可以这样"、不全盘否定**。Do NOT use when…
想法群聊室 — 调研员角色。被 idea-team 主编排器调用,或用户单独说"调研一下 X"、"X 的现状/竞品/数据"、"找 2026 数据"、"事实底"时触发。**用 WebSearch 拉真实 2026 数据、列竞品、引来源——只给事实,不评判,不建议**。Do NOT use when…
想法群聊室主持人 — 把一句话想法丢给多角色 AI 团队(调研员/反方/类比者)做查漏补缺。每个角色有自己的 voice,他们互相 @ 接话;你随时插话。**这是创意扩展工具,不打分、不否决、不堵路**。Use when 用户说"组个团队聊一下"、"开会讨论这个想法"、"找几个角度看看"、"群聊一下 X"、"team…
端到端产品教练 — 把一句话想法走到 PRD + 可点击 HTML 原型。会顶嘴、强制砍功能、用 Nielsen + Norman 做友好性硬检。Use when user 说"我有一个想法"、"想做一个产品"、"做 MVP"、"写 PRD"、"做用户友好的产品",或调用插件命令…
Mobile app UI design expert for iOS and Android. Use when designing app interfaces, creating design systems, ensuring accessibility, or following platform…