Toolverse
All skills

python-resource-management

by wshobson

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.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Author
wshobson
Category
Backend
Views
3

About this skill

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.

How to use

  1. Zainstaluj skill python-resource-management z repozytorium wshobson/agents — umieść go w katalogu plugins/python-development/skills swojego projektu agenta.
  2. Zaimportuj contextmanager z biblioteki contextlib lub zdefiniuj własną klasę implementującą protokół context managera z metodami __enter__ i __exit__.
  3. Dla prostych zasobów użyj dekoratora @contextmanager — zdefiniuj funkcję, która nabywa zasób, yield go w bloku try, a następnie czyści go w finally.
  4. Dla złożonych zasobów stwórz klasę z metodami __init__, __enter__ (zwracającą zasób) i __exit__ (wykonującą czyszczenie niezależnie od wyjątków).
  5. Używaj zasobu w bloku with — interpreter automatycznie wywoła __exit__ po zakończeniu bloku, nawet jeśli wystąpi wyjątek.
  6. Dla zasobów asynchronicznych implementuj __aenter__ i __aexit__, a następnie używaj zasobu w bloku async with — przydatne do zarządzania połączeniami bazodanowymi i responsów strumieniowych ze stanem.

Related skills

fastapi-templates

by wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

Backend
327582

postgresql-psql

by timelessco

Comprehensive guide for PostgreSQL psql - the interactive terminal client for PostgreSQL. Use when connecting to PostgreSQL databases, executing queries, managing databases/tables, configuring connection options, formatting output, writing scripts, managing transactions, and

Backend
34173

sql-optimization-patterns

by wshobson

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

Backend
40163

openspec

by ruan-cat

OpenSpec 中文版规范助手 - 规范驱动的 AI 编程开发,帮助初始化、创建提案、编写规格、校验格式并归档变更。触发条件: 当用户提及 openspec、规范文档、需求管理、变更提案、spec-driven development 等关键词时主动调用。

Backend
27122

pdf-to-markdown

by aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions \

Backend
355664

fastapi-pro

by sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

Backend
54128