effect-platform-layers

Structure Effect applications with abstract interfaces and platform-specific layers.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-platform-layers
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: effect-platform-layers
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-platform-layers
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-platform-layers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the confusion and brittleness that happens when an Effect application accidentally hard-codes platform-specific imports (Node vs Bun) inside business logic, making the codebase harder to reuse and test.

Core Features & Use Cases

  • Clear platform boundary (“Golden Rule”): application code depends on abstract Effect services, while platform-specific wiring happens at entry points or adapter modules via defaultLayer.
  • Node vs Bun runtime integration guidance: shows the correct provide(NodeServices.layer | BunServices.layer) pattern with the matching runtime runner.
  • Layer composition and overriding: demonstrates how to merge multiple layers, add custom services, and override platform services in a predictable order for tests and applications.
  • Mocking strategy for tests: emphasizes using mock abstract services (e.g., Layer.succeed / FileSystem.makeNoop) instead of importing platform modules during unit tests.

Quick Start

Use effect-platform-layers to restructure your app so domain/services import abstract services from effect, then wire NodeServices.layer or BunServices.layer only in your entry point with NodeRuntime.runMain or BunRuntime.runMain.

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 an Effect application to support both Node.js and Bun runtimes?▼

Structure Effect applications for cross-runtime portability by keeping platform-specific wiring in entry points and adapter modules, injecting NodeServices.layer or BunServices.layer at the boundary.

Why does my Effect app break when switching between Node and Bun runtimes?▼

Effect apps break across runtimes when business logic hard-codes platform-specific imports, causing cross-runtime coupling; abstracting services into layers at module boundaries prevents this brittleness.

What is the best way to mock Effect platform services like FileSystem during unit tests?▼

Mock Effect platform services in unit tests by overriding layers with mock abstract services, such as Layer.succeed or FileSystem.makeNoop, rather than importing platform-specific modules directly.

Can I use dependency injection to override platform layers in Effect for testing?▼

Yes, you can use dependency injection in Effect to override platform layers, merging multiple layers and adding custom services in a predictable order to supply test mocks at boundaries.

When do I need to use defaultLayer provisioning in Effect runtime entry points?▼

Use defaultLayer provisioning in Effect runtime entry points when you need to supply platform-specific service implementations, ensuring application code depends solely on abstract interfaces.

Does effect-platform-layers support composing multiple layers for custom service implementations?▼

Yes, effect-platform-layers supports composing multiple layers, allowing you to merge platform layers with custom services and override them predictably for both application wiring and tests.