zig-system-calls

Implement Zig system calls and file I/O using bun.sys.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/zhcndoc/bun --skill zig-system-calls
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zig-system-calls
Source: https://github.com/zhcndoc/bun/tree/main/.claude/skills/zig-system-calls
Command: npx skills add https://github.com/zhcndoc/bun --skill zig-system-calls

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides using bun.sys for system calls and file I/O in Zig. Use when implementing file operations instead of std.fs or std.posix.

Core Features & Use Cases

  • bun.sys.File wrapper for common file operations with cross-platform error handling.
  • bun.sys low-level functions for opening, reading, writing, and stat-like operations.
  • Patterns for handling Maybe(T) and errno-based errors, with automatic EINTR retry where supported.

Quick Start

Use bun.sys to implement a small Zig function that opens a file for writing and writes a byte slice using bun.sys.File, including basic error handling.

Frequently Asked Questions about zig-system-calls

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use bun.sys for file I/O and system calls in Zig?

Use bun.sys for file I/O and system calls in Zig by wrapping file operations with bun.sys.File and using low-level functions for opening, reading, writing, and stat-like queries with cross-platform error handling.

How does the Maybe(T) pattern handle errno-based errors in bun.sys?

The Maybe(T) pattern in bun.sys handles errno-based errors by capturing system-level failure codes and applying automatic EINTR retry logic where supported for robust cross-platform operations.

Should I use bun.sys instead of std.fs for Zig file operations?

Use bun.sys instead of std.fs or std.posix when implementing file operations in Zig to leverage bun.O flags, cross-platform error handling, and direct syscall integration with automatic EINTR retry.

Can I perform cross-platform file reading and writing with bun.sys?

Yes, you can perform cross-platform file reading and writing with bun.sys by utilizing the bun.sys.File wrapper and bun.O flags to ensure safe, consistent operations across different platforms.

How do I open a file for writing and write a byte slice using bun.sys.File?

Open a file for writing and write a byte slice using bun.sys.File by passing bun.O flags to the open function and invoking the write method, including basic error handling for robust operation.

What are the limitations of using bun.sys for direct system calls in Zig?

Limitations of using bun.sys for direct system calls in Zig include managing Maybe(T) patterns and errno-aware errors manually, requiring careful handling of EINTR retries and platform-specific behaviors.