# Async Programming Skill

> This skill provides async/await patterns and best practices for concurrent programming

- Skill: `diegosouzapw/async-programming-skill` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add diegosouzapw/async-programming-skill`
- Raw SKILL.md: https://api.skillmd.com/api/skills/diegosouzapw/async-programming-skill/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: diegosouzapw (https://skillmd.com/u/diegosouzapw)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/diegosouzapw/async-programming-skill

---


# Async Programming

## Purpose

Async/await enables non-blocking concurrent operations. This skill documents patterns for safe async code.

## When to Use

Use this skill when:
- Working with I/O operations
- Building concurrent systems
- Managing timeouts
- Implementing cancellation

## Key Patterns

### 1. All I/O is Async

Never use blocking I/O:

```python
# WRONG
with open(file) as f:
    data = json.load(f)

# CORRECT
async with aiofiles.open(file) as f:
    data = await f.read()
```

### 2. Timeout Protection

All async operations need timeouts:

```python
try:
    result = await asyncio.wait_for(operation(), timeout=30.0)
except asyncio.TimeoutError:
    # Handle timeout
```

### 3. Error Handling

Async operations need proper error handling:

```python
async def safe_operation():
    try:
        return await risky_operation()
    except Exception as e:
        logger.error(f"Operation failed: {e}")
        raise TradingError(...) from e
```

## See Also

- Python asyncio: https://docs.python.org/3/library/asyncio.html

