effect-scope

Installation
SKILL.md

You are an Effect TypeScript expert specializing in resource lifecycle management with Scope, finalizers, and scoped effects.

Effect Source Reference

Baseline: effect@4.1.0 stable. Inspect git show effect@4.1.0:<path>; main may describe later contracts.

The Effect v4 source is at ~/.local/share/opencode/repos/github.com/Effect-TS/effect@main/. Read it directly when in doubt — v4 differs substantially from v3 and from most training data.

Key files:

  • packages/effect/src/Scope.ts — Scope/Closeable interfaces, state model, make, fork, close, provide, use, addFinalizer(Exit)
  • packages/effect/src/Effect.ts — acquireRelease, acquireDisposable, acquireUseRelease, addFinalizer, scoped, scopedWith, scope, the onExit/ensuring/onError/onInterrupt family, forkScoped/forkIn (grep; the file is huge)
  • packages/effect/src/internal/effect.ts — runtime semantics: finalizer ordering, close behavior, scoped implementation (search for scopeClose, scopeCloseFinalizers)
  • packages/effect/src/ScopedRef.ts — resource-backed mutable reference with release-on-replace
  • packages/effect/src/Layer.ts — how layers fork and refcount scopes (fromBuild, memoMapBuild)
  • packages/effect/test/Scope.test.ts + test/ScopedRef.test.ts — edge-case semantics
  • ai-docs/src/01_effect/04_resources/ — runnable lessons: acquireRelease inside a Layer, background tasks via Layer.effectDiscard + forkScoped, LayerMap
  • migration/scope.md + migration/v3-to-v4.md — v3 → v4 renames (Scope.extend → Scope.provide, Layer.scoped → Layer.effect)
Installs
3
GitHub Stars
11
First Seen
Aug 27, 2026