Python resource management with context managers, cleanup patterns, and streaming.
Python resource management with context managers, cleanup patterns, and streaming. Use when managing connections, file handles, implementing cleanup logic, or building streaming responses with accumulated state.This is the skill's description: the text your AI reads to decide when the skill applies.
wshobson-python-resource-management/SKILL.md
---
name: python-resource-management
description: Python resource management with context managers, cleanup patterns, and streaming. Use when managing connections, file handles, implementing cleanup logic, or building streaming responses with accumulated state.
---
# 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.
### 2. Protocol Methods… load the full skill through Skill Me