effect-platform-abstraction

Implement cross-platform file I/O, process spawning, HTTP, and crypto using Effect platform services.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing filesystem, process, HTTP, crypto, or terminal code with runtime-specific APIs like fs, child_process, fetch, or Bun.file locks your code to one platform and makes it untestable. This Skill guides you to use Effect platform abstractions so the same code runs on Node.js, Bun, and browsers with typed errors and mockable services. ## Core Features & Use Cases - Platform Service Patterns: Replace direct fs, path, child_process, fetch, and console usage with FileSystem, Path, ChildProcessSpawner, HttpClient, Crypto, Terminal, and KeyValueStore services. - Anti-Pattern Detection: Side-by-side wrong/correct examples show exactly which Node, Bun, and browser APIs to avoid and what to use instead. - Layer Setup Guidance: Instructions for providing NodeServices.layer, BunServices.layer, and service-specific layers for HTTP, sockets, and browser crypto. - Use Case: You are building a CLI tool that reads config files, spawns git commands, and calls an HTTP API. This Skill shows how to write it once with Effect services and run it on both Node.js and Bun with full testability via mock layers. ## Quick Start Rewrite my Node.js script that uses fs and fetch to use Effect platform services so it runs on both Node and Bun.

Frequently Asked Questions about effect-platform-abstraction

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

FAQPage Schema
How do I read files cross-platform with Effect?

Use the FileSystem.FileSystem service from the effect package instead of fs or Bun.file. Access it with yield* FileSystem.FileSystem inside Effect.gen, then call readFileString or readFile, and provide NodeServices.layer or BunServices.layer at runtime.

What should I use instead of fetch in Effect?

Use the HttpClient service from effect/unstable/http instead of fetch or axios. It integrates with the Effect type system for typed errors, supports Schema-based response parsing, retries with Schedule, and works across platforms with layers like FetchHttpClient.layer or NodeHttpClient.layerUndici.

Does Effect platform abstraction work on both Node.js and Bun?

Yes, the same Effect code runs on both runtimes. Provide NodeServices.layer with NodeRuntime for Node.js or BunServices.layer with BunRuntime for Bun; both layers include FileSystem, Path, ChildProcessSpawner, Terminal, and Crypto services.

How do I spawn child processes with Effect?

Use ChildProcess.make to build commands and ChildProcessSpawner from effect/unstable/process to execute them. The spawner supports string output, line collection, piping between commands, environment variables, and streaming stdout with exit code handling.

Why does my Effect program fail with a missing service error?

The error occurs when platform services are required but no layer is provided. Provide NodeServices.layer or BunServices.layer via Effect.provide before running; note that HTTP clients, sockets, and workers need separate service-specific layers.

How do I test Effect code that uses FileSystem?

Create a mock layer with Layer.succeed and FileSystem.makeNoop, overriding only the methods your code calls. Provide this test layer with Effect.provide to run your program without touching the real filesystem.