effect-resources-scope

Manage resource lifecycles with acquireRelease, scoped, and finalizers.

Updated Nov 20, 2025
One-click install
npx skills add https://github.com/mepuka/adjunct --skill effect-resources-scope
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-resources-scope
Source: https://github.com/mepuka/adjunct/tree/main/.claude/skills/effect-resources-scope
Command: npx skills add https://github.com/mepuka/adjunct --skill effect-resources-scope

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Resource safety with acquireRelease, Effect.scoped, and finalizers. Use when opening files, sockets, servers, or external handles.

Core Features & Use Cases

  • Acquire/Release: safe acquisition and cleanup
  • Scoped: local resource lifecycles
  • Finalizers: guaranteed cleanup actions
  • Real-world snippet: wrap Promise APIs with typed errors and spans

Quick Start

Use acquireRelease to open a resource and ensure it is closed after use. Wrap the usage in a scoped block to guarantee cleanup even on interruption.

Frequently Asked Questions about effect-resources-scope

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

FAQPage Schema
How do I prevent resource leaks when working with files, sockets, and servers?

Resource leaks occur when files, sockets, or external handles aren't properly closed. acquireRelease pairs acquisition and cleanup logic, guaranteeing release even on interruption. Wrap usage in a scoped block to ensure cleanup within an Effect-based runtime.

What's the difference between acquireRelease, scoped, and finalizers for resource management?

acquireRelease combines acquire and release as paired operations. scoped creates local resource lifecycles with guaranteed cleanup. Finalizers attach cleanup actions to resources. Use acquireRelease for explicit pairs, scoped for nested contexts, and finalizers for deferred cleanup within Effect workflows.

Can I use resource lifecycle management with Promise-based APIs?

Yes. Wrap Promise APIs with typed errors and spans using acquireRelease. This converts untyped async operations into Effect's resource-safe model, applying cleanup guarantees and error handling to external handles and async workflows.

How do I ensure cleanup runs even if my Effect workflow is interrupted?

Scoped blocks and acquireRelease guarantee cleanup on interruption by registering finalizers with the Effect runtime. Resources are released regardless of success, error, or cancellation within the scoped context.

When should I use finalizers instead of explicit release logic?

Use finalizers for deferred, guaranteed cleanup when you need certainty that a cleanup action runs at scope exit. Finalizers integrate with Effect's runtime supervision, making them safer than manual release in complex async workflows with multiple error paths.

Does resource scoping work with external services and connection pooling?

Yes. Scoped resource management applies to servers, connection handles, and external services. Each scoped block binds resource acquisition to its exit, enabling safe pooling and multi-handle scenarios within an Effect runtime.