effect-filesystem

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

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-filesystem-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-filesystem
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-filesystem
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-filesystem-lambdasolver2

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, Bun, and browser environments without scattering platform-specific imports through business logic is difficult. This Skill provides the patterns for using Effect's FileSystem service so file operations stay testable, typed, and platform-agnostic. ## Core Features & Use Cases - Full FileSystem API coverage: Reading, writing, streaming, copying, directory management, metadata, permissions, links, and file watching through the FileSystem.FileSystem service. - Scoped resource management: Automatic cleanup of temp directories and file handles using makeTempDirectoryScoped and Effect.scoped. - Typed error handling: Recover from PlatformError failures with catchTag and map them into domain errors via Schema.TaggedError. - Use Case: You need to read a config file, process it in a temp directory, and clean up automatically. Inject the FileSystem service, use makeTempDirectoryScoped, and provide NodeFileSystem.layer at the entry point. ## Quick Start Ask the AI to write an Effect program that reads a file using the FileSystem service and runs it with the Node.js layer.

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?

Inject the service with yield* FileSystem.FileSystem inside Effect.gen, then call fs.readFileString or fs.writeFileString. Provide a platform layer such as NodeFileSystem.layer at the entry point before running the program.

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

FileSystem operations fail with PlatformError containing a SystemErrorTag like NotFound or PermissionDenied. Use Effect.catchTag("PlatformError", ...) to recover, or map errors into typed domain errors with Schema.TaggedError.

Does Effect FileSystem work in the browser?

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

How do I create a temp directory with automatic cleanup in Effect?

Use fs.makeTempDirectoryScoped() inside an Effect.gen and wrap the program with Effect.scoped. The temp directory is removed automatically when the scope exits, avoiding manual fs.remove calls.

Should I use node:fs or Effect FileSystem in an Effect app?

Use Effect FileSystem. Importing node:fs or fs/promises in business logic breaks platform abstraction and testability. Provide NodeFileSystem.layer once at the entry point and inject the service everywhere else.