Логотип Zig Tiger Style

Zig Tiger Style

Організація
zigcc
zig-tiger-style

Рекомендації з написання коду на Zig за TigerStyle — узагальнені на основі промислової кодової бази TigerBeetle. Використовуйте цю навичку, коли користувач пише, перевіряє або рефакторить код Zig, запитує про ідіоми Zig, найкращі практики, твердження, розташування в пам’яті, правила іменування чи стиль коду. Також використовуйте її, коли користувач запитує, як структурувати структури Zig, обробляти помилки, писати безпечні цикли або проєктувати API Zig. Навіть якщо користувач просто каже «напиши мені щось на Zig» або надсилає код Zig на перевірку, спочатку зверніться до цієї навички.

Add to TypingMind

Огляд

Видавецьzigcc
Репозиторійskills
Назва навичкиzig-tiger-style
Зірки
53
Форки
3
Файли в пакеті
Лише інструкції
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Усе необхідне — в інструкціях

    Усе потрібне моделі міститься в інструкціях — жодних додаткових файлів для синхронізації.

  • Відкритий вихідний код

    Видавець на GitHub: zigcc. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Zig Tiger Style у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/zigcc/skills/tree/main/zig-tiger-style
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zigcc/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/zig-tiger-style .claude/skills/zig-tiger-style
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Zig Tiger Style в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Zig Tiger Style, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Zig Tiger Style не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

TigerStyle: Zig Coding Guidelines

Distilled from TigerBeetle's TIGER_STYLE.md. Design goal priority: Safety > Performance > Developer Experience.


1. Safety

Control Flow

  • Use only simple, explicit control flow. No recursion unless provably bounded.

  • Split compound conditions into nested if/else branches — ensure both the positive and negative spaces are handled or asserted.

  • State invariants positively:

    zig
    // preferred
    if (index < length) { ... } else { ... }
    
    // avoid
    if (index >= length) { ... }
  • Every if branch should prompt the question: does a corresponding else also need to be handled?

Assertions

Assertions detect programmer errors — not expected runtime errors. The only correct response to corrupt state is to crash. Assertions downgrade catastrophic correctness bugs into liveness bugs.

  • A function must not operate blindly on data it has not checked; assert arguments at the entry point.

  • Pair assertions: for any property you want to enforce, add assertions on at least two different code paths (e.g. just before writing to disk, and immediately after reading back).

  • Split compound assertions:

    zig
    // preferred
    assert(a);
    assert(b);
    
    // avoid
    assert(a and b);
  • Use a single-line if to assert an implication: if (a) assert(b);

  • Assert relationships between compile-time constants to verify design integrity before the program even runs:

    zig
    comptime assert(@sizeOf(Header) == 128);
    comptime assert(config.pipeline_max <= config.batch_max);
  • Assert both the positive space (what you expect to be true) and the negative space (what you expect to be false) — the boundary between valid and invalid is where bugs hide.

Memory

  • Initialize large structs in-place via an out pointer to eliminate intermediate copies and guarantee pointer stability:

    zig
    // preferred
    fn init(target: *LargeStruct) !void {
        target.* = .{ ... };
    }
    
    // avoid
    fn init() !LargeStruct {
        return LargeStruct{ ... };
    }

Variable Scope

  • Declare variables at the smallest possible scope to reduce the chance of misuse.
  • Declare variables close to where they are used — do not introduce them before they are needed. This avoids POCPOU bugs (a distant cousin of TOCTOU).

Loops and Queues

  • All loops and queues must have a fixed upper bound to prevent infinite loops or tail-latency spikes. Follow the fail-fast principle.
  • Loops that genuinely cannot terminate (e.g. an event loop) must be explicitly asserted as such.

Error Handling

  • All errors must be handled. Most catastrophic production failures stem from incorrect handling of non-fatal errors.
  • Never discard error return values with _.

Other

  • Use explicitly-sized integer types (u32, i64, etc.), avoid architecture-dependent usize when possible
  • Enable and respect the compiler's strictest warning settings — zero tolerance for warnings.
  • Do not react directly to external events inline; let the program run at its own pace (enables batching and maintains control-flow ownership).
  • Keep functions as small as possible. When splitting, find semantically clean cut points:
    • Centralize all if/switch in the "parent" function; extract pure logic into helpers.
    • Let the parent own all mutable state; helpers compute what to change but don't apply it.
    • Rule of thumb: "push ifs up and fors down".

2. Performance

  • Solve performance in the design phase — the biggest wins (1000x) come from architecture, not post-hoc profiling.

  • Do back-of-the-envelope sketches across the four resources (network, disk, memory, CPU) and their two characteristics (bandwidth, latency).

  • Optimize slowest resources first: network → disk → memory → CPU, weighted by access frequency.

  • Batching is the primary tool: amortize network, disk, memory, and CPU costs.

  • Distinguish control plane from data plane; batching lets both coexist safely and fast.

  • Extract hot-path loops into standalone functions with primitive arguments (no self) so the compiler can cache fields in registers and humans can spot redundant work:

    zig
    // hot loop extracted, no self
    fn process_batch(items: []const Item, result: []Output) void { ... }
  • Be explicit. Do not rely on the compiler to do the right thing.

  • Always pass options explicitly at library call sites — never rely on defaults:

    zig
    // preferred
    @prefetch(a, .{ .cache = .data, .rw = .read, .locality = 3 });
    
    // avoid
    @prefetch(a, .{});

3. Naming

  • In general, functions are camelCase, types are PascalCase, variables are lowercase_with_underscores. One exception to those rules is functions that return types. They are PascalCase:

    zig
    pub fn ArrayList(comptime T: type) type {
      return ArrayListAligned(T, null);
    }
  • Normally, file names are lowercase_with_underscore. However, files that expose a type directly should be PascalCase.

  • Do not abbreviate variable names (except primitive integer loop indices in sorts/matrices).

  • Acronyms are fully capitalized: VSRState, not VsrState.

  • Append units and qualifiers to names, ordered by descending significance, so the most important word comes first:

    zig
    latency_ms_max    // not max_latency_ms
    latency_ms_min    // aligns nicely with the above
    message_size_max
  • Choose related names with the same character count so they align visually:

    zig
    source         // same length as target
    target
    source_offset
    target_offset
  • Name helper/callback functions with the caller's name as a prefix: read_sector() → read_sector_callback()

  • Callbacks go last in the parameter list (mirrors invocation order).

  • Infuse names with meaning: gpa: Allocator and arena: Allocator are far more informative than allocator: Allocator.

  • Functions that take two or more arguments of the same type must use a named options: struct parameter to prevent argument confusion.

Struct and File Layout

zig
// Struct order: fields → type definitions → methods
time: Time,
process_id: ProcessID,

const ProcessID = struct { cluster: u128, replica: u8 };
const Tracer = @This();

pub fn init(gpa: std.mem.Allocator, time: Time) !Tracer { ... }
  • The main function goes at the top of the file — readers see the most important thing first.
  • Promote complex nested types to top-level structs.

4. Comments

  • Comments are full sentences: space after //, capital letter, ending with a period (or colon when introducing something). Inline end-of-line comments may be phrases without punctuation.
  • Always say why. Code shows what and how; comments explain the reasoning behind decisions.
  • Add a description at the top of tests explaining the goal and methodology.
  • On occasion, use an obviously-true assertion instead of a comment to document a critical, surprising invariant — the assertion is stronger documentation.

5. Formatting

  • Always run zig fmt.

  • Use 4 spaces of indentation (more visually obvious than 2 at a distance).

  • Hard limit of 100 columns per line, no exceptions. Add a trailing comma and let zig fmt handle the wrapping.

  • Always add braces to if statements unless the whole thing fits on one line:

    zig
    // single-line ok without braces
    if (ok) return;
    
    // multi-line always needs braces
    if (condition) {
        do_something();
    }

Division — be explicit about rounding intent

zig
@divExact(a, b)   // asserts no remainder
@divFloor(a, b)   // rounds toward negative infinity
div_ceil(a, b)    // rounds toward positive infinity

6. Off-by-One Errors

index (0-based), count (1-based), and size (= count × unit) are distinct types with clear conversion rules:

  • index → count: add 1
  • count → size: multiply by the unit size
  • Include units and qualifiers in variable names (see Naming) to make these conversions visible.

7. Dependencies and Tooling

  • Zero-dependencies policy: no external dependencies beyond the Zig toolchain.
  • Write scripts as scripts/*.zig instead of *.sh — cross-platform, type-safe, more reliable.
  • Standardize on Zig for tooling to reduce dimensionality as the team grows.

Pre-Commit Checklist

Before submitting, verify:

  • All lines are <= 100 columns; zig fmt has been run
  • All errors are handled (no _ discards)
  • Variable names include units/qualifiers and are not abbreviated
  • Compound conditions are split into nested if/else
  • All loops have an explicit upper bound
  • Comments explain why, not just what
  • Compile-time constant relationships are verified with comptime assert

Поширені запитання

Що робить навичка ШІ Zig Tiger Style?

Рекомендації з написання коду на Zig за TigerStyle — узагальнені на основі промислової кодової бази TigerBeetle. Використовуйте цю навичку, коли користувач пише, перевіряє або рефакторить код Zig, запитує про ідіоми Zig, найкращі практики, твердження, розташування в пам’яті, правила іменування чи стиль коду. Також використовуйте її, коли користувач запитує, як структурувати структури Zig, обробляти помилки, писати безпечні цикли або проєктувати API Zig. Навіть якщо користувач просто каже «напиши мені щось на Zig» або надсилає код Zig на перевірку, спочатку зверніться до цієї навички.

Навіщо використовувати Zig Tiger Style у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Zig Tiger Style — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Zig Tiger Style у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/zigcc/skills/tree/main/zig-tiger-style. TypingMind прочитає файл SKILL.md і встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Zig Tiger Style?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Zig Tiger Style?

Зі скількома забажаєте. У TypingMind ви можете використовувати Zig Tiger Style із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Zig Tiger Style?

На GitHub цю навичку публікує zigcc. Умови ліцензування дивіться в репозиторії. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі
Логотип openclaw

Graincrawl

openclaw
ОрганізаціяПопулярне

Архів Granola: пошук, актуальність синхронізації, нотатки, транскрипти, панелі, підрахунки SQL і робота з репозиторіями Graincrawl.

82.2K
391K
Файлів: 1
Відкрити
Логотип openclaw

Openclaw Changelog Update

openclaw
ОрганізаціяПопулярне

Повторно створюйте розділи журналу змін релізу OpenClaw на основі історії git перед випусками beta, stable або extended-stable.

82.2K
391K
Файлів: 1
Відкрити
Логотип openclaw

Openclaw Ci Limits

openclaw
ОрганізаціяПопулярне

Керуйте GitHub Actions для OpenClaw і пропускною здатністю CI у Blacksmith, бюджетами реєстрації раннерів, обмеженнями fanout, одночасним запуском лише одного завдання для кожного push у main, розміром шард, перенесенням завдань на хостовані раннери, станом черги та безпечним…

82.2K
391K
Файлів: 1
Відкрити
Логотип openclaw

Openclaw Debugging

openclaw
ОрганізаціяПопулярне

Діагностуйте проблеми з моделями, провайдерами, інтерфейсом інструментів, режимом коду, потоковою передачею та роботою OpenClaw у реальному часі/Crabbox. Перш ніж змінювати код, добирайте потрібні журнали, перевірки та спосіб підтвердження, зокрема отримуйте збережені…

82.2K
391K
Файлів: 1
Відкрити

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇