effect-resource-management

Manage scoped resource lifetimes with automatic cleanup in Effect applications.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill effect-resource-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-resource-management
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-effect/skills/effect-resource-management
Command: npx skills add https://github.com/TheBushidoCollective/han --skill effect-resource-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers resource management using Scope and finalizers in Effect.

Core Features & Use Cases

  • Scope & finalizers: Automatic cleanup.
  • Resource patterns: Database connections, file I/O, network.
  • Context & exit info: Handling exit data.

Quick Start

Create a scoped resource usage example that auto-cleans up.

Frequently Asked Questions about effect-resource-management

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

FAQPage Schema
How do I prevent resource leaks in Effect applications?

Prevent resource leaks by using Scope and finalizers to manage resource lifetime. Scope ensures automatic cleanup of resources like files, database connections, and network sockets, while finalizers execute cleanup callbacks in reverse order when the scope exits.

How do I implement deterministic cleanup for database connections and file handles?

Use Effect's Scope to wrap resource acquisition and specify finalizers for cleanup. Finalizers execute automatically in reverse order, guaranteeing deterministic cleanup of database connections, file handles, and other IO resources across synchronous and asynchronous tasks.

Can I handle different cleanup logic based on whether a task succeeded or failed?

Yes. Effect's exit-aware finalizers receive context about task success or failure, allowing you to execute different cleanup paths. This enables conditional resource release and error-specific cleanup logic within the same Scope.

What's the best way to manage multiple resources with interdependencies in Effect?

Nest Scope contexts and use addFinalizer to attach cleanup callbacks in acquisition order. Finalizers execute in reverse order automatically, ensuring dependent resources clean up before their dependencies.

Does Scope work with both synchronous and asynchronous Effect operations?

Yes. Scope and finalizers work consistently across synchronous and asynchronous tasks in Effect, providing uniform resource management regardless of operation type or timing.