effect-filesystem

Implements platform-abstract file I/O using Effect FileSystem with Node.js and Bun layers.

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-filesystem-mpsuesser
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: effect-filesystem
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-filesystem
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-filesystem-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/platform-node, @effect/platform-bun.

What problem does it solve? Writing file system code that works across Node.js and Bun without scattering platform-specific imports through business logic is error-prone. This Skill teaches how to use the Effect FileSystem service for typed, testable, platform-abstract file operations with proper error handling and scoped resource cleanup. ## Core Features & Use Cases - Complete File Operations: Read, write, copy, rename, remove, stat, chmod, symlink, and watch files through the FileSystem service interface. - Streaming and Scoped Resources: Stream large files with stream()/sink(), manage file handles and temp directories with automatic scoped cleanup. - Typed Error Handling: Catch PlatformError with catchTag and map system errors like NotFound or PermissionDenied into domain-specific tagged errors. - Use Case: You need to read a config file, process it in a temp directory, and clean up automatically. Yield the FileSystem service, use makeTempDirectoryScoped, and provide NodeFileSystem.layer at the entry point. ## Quick Start Ask the agent to read a file using Effect FileSystem with the Node.js layer and handle the NotFound error case.

Frequently Asked Questions about effect-filesystem

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

FAQPage Schema
How do I read and write files with Effect FileSystem?▼

Yield the FileSystem service with `yield* FileSystem.FileSystem`, then call methods like `fs.readFileString(path)` or `fs.writeFileString(path, content)`. Provide a platform layer such as NodeFileSystem.layer at your program entry point.

How do I handle file not found errors in Effect?▼

FileSystem operations fail with PlatformError containing a SystemErrorTag. Use `Effect.catchTag("PlatformError", ...)` and inspect `error.reason._tag` for values like NotFound or PermissionDenied to recover or map to domain errors.

Does Effect FileSystem work in the browser?▼

No, @effect/platform-browser does not provide a FileSystem layer. Stock layers exist for Node.js and Bun only, so browser code requires a custom or injected FileSystem implementation.

How do I stream large files with Effect FileSystem?▼

Use `fs.stream(path)` which returns a Stream directly, and `fs.sink(path)` for writing. Combine them with Stream operators to process large files without loading everything into memory.

How do I create temp directories with automatic cleanup in Effect?▼

Use `fs.makeTempDirectoryScoped()` inside an Effect wrapped with `Effect.scoped`. The temp directory is automatically removed when the scope exits, avoiding manual cleanup with fs.remove.