python-resource-management

Installation
Summary

Deterministic resource management with context managers, cleanup patterns, and streaming state accumulation.

  • Covers class-based and decorator-based context managers for sync and async resources, with unconditional cleanup guarantees even on exceptions
  • Includes patterns for database connections, file handles, connection pools, and dynamic resource management via ExitStack
  • Provides streaming response patterns with efficient state accumulation, metrics tracking, and time-to-first-byte measurement
  • Demonstrates selective exception suppression, nested resource cleanup, and O(n) string accumulation techniques
SKILL.md

Python Resource Management

Manage resources deterministically using context managers. Resources like database connections, file handles, and network sockets should be released reliably, even when exceptions occur.

When to Use This Skill

  • Managing database connections and connection pools
  • Working with file handles and I/O
  • Implementing custom context managers
  • Building streaming responses with state
  • Handling nested resource cleanup
  • Creating async context managers

Core Concepts

1. Context Managers

The with statement ensures resources are released automatically, even on exceptions.

Related skills

More from wshobson/agents

Installs
5.8K
Repository
wshobson/agents
GitHub Stars
35.3K
First Seen
Jan 30, 2026