effect-managed-runtime

Bridge Effect services into Hono, Express, Lambda, and Workers using ManagedRuntime.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Effect applications normally own the process lifecycle via runMain, but many real-world systems embed business logic inside external frameworks like Hono, Express, AWS Lambda, or Cloudflare Workers. This Skill shows how to run Effect services from non-Effect hosts using ManagedRuntime without losing layer-based dependency injection or resource safety. ## Core Features & Use Cases - ManagedRuntime creation and sharing: Build a runtime from a Layer, share a MemoMap across multiple runtimes, and reuse one runtime across requests instead of creating one per request. - Execution methods: Run effects with runPromise, runSync, runFork, runCallback, and Exit variants depending on the host's execution model. - Lifecycle management: Dispose runtimes on SIGINT/SIGTERM for servers, or keep module-scoped runtimes warm for Lambda and Cloudflare Workers. - Use Case: A Hono API whose routes call a TodoRepo Effect service — create one ManagedRuntime at module scope, call runtime.runPromise inside each handler, and dispose on shutdown. ## Quick Start Show me how to call my Effect service layer from a Hono HTTP handler using ManagedRuntime with proper shutdown handling.

Frequently Asked Questions about effect-managed-runtime

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

FAQPage Schema
How do I run Effect services inside an Express or Hono handler?

Create a ManagedRuntime once at module scope with ManagedRuntime.make(YourLayer), then call runtime.runPromise(effect) inside each handler. The runtime injects the layer's services into every effect you run.

ManagedRuntime vs runMain: which should I use?

Use runMain when Effect owns the entire process, such as CLI apps or standalone services, since it handles signals and scope automatically. Use ManagedRuntime when Effect code is embedded in a larger non-Effect system with multiple entry points.

Can I use ManagedRuntime in AWS Lambda or Cloudflare Workers?

Yes. Create the runtime at module scope so it is reused across warm invocations, and do not dispose it after every request. Dispose only when the runtime is no longer needed or the host exposes a real shutdown hook.

Why should I share a MemoMap between multiple ManagedRuntimes?

Memoized layers are built only once per MemoMap, so sharing one via Layer.makeMemoMapUnsafe() prevents duplicate layer construction across runtimes. With a single runtime you can omit the option and one is created automatically.

What happens if I forget to dispose a ManagedRuntime?

Resources acquired during layer construction, such as database pools and HTTP clients, leak because ManagedRuntime owns their scope. Wire runtime.dispose() to SIGINT/SIGTERM handlers for long-running hosts.

When should I not use ManagedRuntime?

Avoid it when Effect owns the whole process — use NodeRuntime.runMain or BunRuntime.runMain instead — or when a long-running Effect service is the application, where Layer.launch is the right fit.