async-patterns

Coordinate multiple coroutines with fail-fast cancellation and optional timeout.

4|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/gigaverse-app/skillet --skill async-patterns-gigaverse-app
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: async-patterns
Source: https://github.com/gigaverse-app/skillet/tree/main/python-standards/skills/async-patterns
Command: npx skills add https://github.com/gigaverse-app/skillet --skill async-patterns-gigaverse-app

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps software engineers write robust asynchronous code by providing safe patterns for coordinating multiple coroutines, including fail-fast cancellation and timeout support.

Core Features & Use Cases

  • Centralized guidance on using safe_gather vs asyncio.gather for both full-success and partial-result workflows.
  • Clear patterns for initialization, data gathering, validation, and cleanup across concurrent tasks.
  • Practical migration guidance from asyncio.gather to safe_gather for new code and existing code where benefits justify the change.

Quick Start

Use safe_gather to run multiple coroutines concurrently with optional timeout and fail-fast cancellation.

Frequently Asked Questions about async-patterns

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

FAQPage Schema
How do I handle asyncio gather cancellation when one task fails?

To run coroutines concurrently with a timeout, use safe_gather with its optional timeout support. This enforces fail-fast cancellation to abort pending tasks if the specified duration is exceeded, preventing hanging operations.

What is the best way to gather partial results from multiple async coroutines?

You should migrate from asyncio.gather to safe_gather for new code or existing code where benefits justify the change. safe_gather enforces fail-safe defaults, including automatic fail-fast cancellation and deterministic cleanup, which standard asyncio.gather lacks.

How do I ensure deterministic cleanup across concurrent asyncio tasks?

To ensure deterministic cleanup across concurrent asyncio tasks, coordinate them using safe_gather. It provides structured patterns for initialization, data gathering, validation, and cleanup, guaranteeing resources are released properly even during failures.

Can I use safe_gather for both full-success and partial-result workflows?

Yes, you can use safe_gather for both full-success and partial-result workflows. It provides centralized guidance to switch between fail-fast cancellation for full-success operations and return_exceptions for workflows requiring partial results.