effect-platform-layers

Structure Effect platform layer provision for cross-platform Node.js and Bun applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Effect applications often leak platform-specific imports (like Node's fs module) into business logic, making code untestable and locked to a single runtime. This Skill enforces a clean boundary where application code depends only on abstract Effect services and platform layers are provided at the entry point. ## Core Features & Use Cases - Abstract Service Boundaries: Application code imports FileSystem, Path, Terminal, Crypto, and ChildProcessSpawner from effect, never from @effect/platform-node directly. - Layer Composition Patterns: Compose custom service layers with NodeServices.layer or BunServices.layer, including override and conditional platform loading patterns. - Testable Mock Layers: Build test contexts with FileSystem.makeNoop, FileSystem.layerNoop, and Layer.succeed so unit tests never touch real platform modules. - Use Case: You are building a CLI tool that must run on both Node.js and Bun. Structure services against abstract Effect interfaces, then provide NodeServices.layer or BunServices.layer only in main.ts. ## Quick Start Ask the AI to refactor your Effect application so all platform-specific layers are provided at the entry point and application code uses only abstract services.

Frequently Asked Questions about effect-platform-layers

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

FAQPage Schema
How do I structure Effect platform layers for Node.js and Bun?

Keep application code importing abstract services like FileSystem and Path from the effect package, then provide NodeServices.layer or BunServices.layer only at the program entry point. Runtime-facing adapter modules may own their platform wiring via a defaultLayer export.

What services does NodeServices.layer provide in Effect?

NodeServices.layer provides FileSystem, Path, Stdio, Terminal, Crypto, and ChildProcessSpawner. It does not include HTTP clients, sockets, workers, or Redis; those require specialized layers such as NodeSocket.layerWebSocket.

How do I mock FileSystem in Effect tests?

Use FileSystem.makeNoop or FileSystem.layerNoop to get default stub implementations, then override only the methods your test needs, such as readFileString or exists. Combine multiple mocks with Layer.mergeAll for multi-service tests.

Can I use @effect/platform-node imports in application code?

No, importing platform-specific modules in application code ties it to one runtime and breaks testability. Only the entry point or a runtime-facing adapter module should import from @effect/platform-node or @effect/platform-bun.

How do I override a platform service in an Effect layer?

Provide your custom layer after the platform layer using Effect.provide, for example a Layer.succeed(FileSystem.FileSystem, customImpl) applied after NodeServices.layer. Later provisions take precedence in the composition.