Resource Management

Automates resource cleanup in Effect-TS programs via acquireRelease and Layer.scoped patterns.

8|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/andrueandersoncs/claude-skill-effect-ts --skill resource-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Resource Management
Source: https://github.com/andrueandersoncs/claude-skill-effect-ts/tree/main/skills/resource-management
Command: npx skills add https://github.com/andrueandersoncs/claude-skill-effect-ts --skill resource-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Resource Management guarantees cleanup of resources used within Effect-TS programs, preventing leaks and ensuring finalizers run even on errors or interruptions.

Core Features & Use Cases

  • Acquire/Release and Acquire/Use/Release patterns to safely manage resources such as files, pools, and locks.
  • Scope and Layered resources via Scope.scoped and Layer.scoped to tie lifetimes to code blocks or services.
  • Finalizers and Ensuring to run cleanup code deterministically after success or failure, including on interruption.

Quick Start

Install the Effect-TS library in your project, then create a small resource (for example a file handle) using Effect.acquireRelease and run it inside Effect.scoped to guarantee cleanup.

Frequently Asked Questions about Resource Management

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

FAQPage Schema
How do I guarantee resource cleanup in Effect-TS when a program fails or is interrupted?

Resource cleanup in Effect-TS is guaranteed by using acquireRelease and acquireUseRelease patterns, which ensure finalizers run deterministically across success, failure, or interruption, preventing resource leaks.

What is the best way to manage database connections and file handles in TypeScript using Effect-TS?

The best way to manage database connections and file handles in Effect-TS is by applying acquireRelease and Layer.scoped patterns, tying resource lifetimes to code blocks or services for safe acquisition and release.

How do I use addFinalizer and ensuring to run cleanup code in Effect-TS?

You use addFinalizer and ensuring in Effect-TS to register cleanup code that executes deterministically after success or failure, ensuring resources are released even when the program is interrupted.

Can I scope resource lifetimes to specific services using Layer.scoped in Effect-TS?

Yes, you can scope resource lifetimes to specific services in Effect-TS using Layer.scoped, which ties resource acquisition and cleanup to the service lifecycle, ensuring finalizers execute when the layer is closed.

Does Effect-TS resource management work for pools and locks in Node applications?

Effect-TS resource management works for pools and locks in Node applications by implementing acquireUseRelease and Scope.scoped patterns, automatically managing lifecycle and cleanup to prevent leaks.

Why do I need Effect.scoped to manage resources in TypeScript?

You need Effect.scoped to manage resources in TypeScript because it creates a scope that guarantees all acquired resources are released when the scope closes, running finalizers even on errors or interruptions.