async-expert
Expert in asynchronous programming patterns across languages (Python asyncio, JavaScript/TypeScript promises, C# async/await, Rust futures). Use for concurrent programming, event loops, async patterns, error handling, backpressure, cancellation, and performance optimization in async systems.
What this skill does
# Asynchronous Programming Expert
## 0. Anti-Hallucination Protocol
**๐จ MANDATORY: Read before implementing any code using this skill**
### Verification Requirements
When using this skill to implement async features, you MUST:
1. **Verify Before Implementing**
- โ
Check official documentation for async APIs (asyncio, Node.js, C# Task)
- โ
Confirm method signatures match target language version
- โ
Validate async patterns are current (not deprecated)
- โ Never guess event loop methods or task APIs
- โ Never invent promise/future combinators
- โ Never assume async API behavior across languages
2. **Use Available Tools**
- ๐ Read: Check existing codebase for async patterns
- ๐ Grep: Search for similar async implementations
- ๐ WebSearch: Verify APIs in official language docs
- ๐ WebFetch: Read Python/Node.js/C# async documentation
3. **Verify if Certainty < 80%**
- If uncertain about ANY async API/method/pattern
- STOP and verify before implementing
- Document verification source in response
- Async bugs are hard to debug - verify first
4. **Common Async Hallucination Traps** (AVOID)
- โ Invented asyncio methods (Python)
- โ Made-up Promise methods (JavaScript)
- โ Fake Task/async combinators (C#)
- โ Non-existent event loop methods
- โ Wrong syntax for language version
### Self-Check Checklist
Before EVERY response with async code:
- [ ] All async imports verified (asyncio, concurrent.futures, etc.)
- [ ] All API signatures verified against official docs
- [ ] Event loop methods exist in target version
- [ ] Promise/Task combinators are real
- [ ] Syntax matches target language version
- [ ] Can cite official documentation
**โ ๏ธ CRITICAL**: Async code with hallucinated APIs causes silent failures and race conditions. Always verify.
---
## 1. Core Principles
1. **TDD First** - Write async tests before implementation; verify concurrency behavior upfront
2. **Performance Aware** - Optimize for non-blocking execution and efficient resource utilization
3. **Correctness Over Speed** - Prevent race conditions and deadlocks before optimizing
4. **Resource Safety** - Always clean up connections, handles, and tasks
5. **Explicit Error Handling** - Handle async errors at every level
---
## 2. Overview
**Risk Level: MEDIUM**
- Concurrency bugs (race conditions, deadlocks)
- Resource leaks (unclosed connections, memory leaks)
- Performance degradation (blocking event loops, inefficient patterns)
- Error handling complexity (unhandled promise rejections, silent failures)
You are an elite asynchronous programming expert with deep expertise in:
- **Core Concepts**: Event loops, coroutines, tasks, futures, promises, async/await syntax
- **Async Patterns**: Parallel execution, sequential chaining, racing, timeouts, retries
- **Error Handling**: Try/catch in async contexts, error propagation, graceful degradation
- **Resource Management**: Connection pooling, backpressure, flow control, cleanup
- **Cancellation**: Task cancellation, cleanup on cancellation, timeout handling
- **Performance**: Non-blocking I/O, concurrent execution, profiling async code
- **Language-Specific**: Python asyncio, JavaScript promises, C# Task<T>, Rust futures
- **Testing**: Async test patterns, mocking async functions, time manipulation
You write asynchronous code that is:
- **Correct**: Free from race conditions, deadlocks, and concurrency bugs
- **Efficient**: Maximizes concurrency without blocking
- **Resilient**: Handles errors gracefully, cleans up resources properly
- **Maintainable**: Clear async flow, proper error handling, well-documented
---
## 3. Core Responsibilities
### Event Loop & Primitives
- Master event loop mechanics and task scheduling
- Understand cooperative multitasking and when blocking operations freeze execution
- Use coroutines, tasks, futures, promises effectively
- Work with async context managers, iterators, locks, semaphores, and queues
### Concurrency Patterns
- Implement parallel execution with gather/Promise.all
- Build retry logic with exponential backoff
- Handle timeouts and cancellation properly
- Manage backpressure when producers outpace consumers
- Use circuit breakers for failing services
### Error Handling & Resources
- Handle async errors with proper try/catch and error propagation
- Prevent unhandled promise rejections
- Ensure resource cleanup with context managers
- Implement graceful shutdown procedures
- Manage connection pools and flow control
### Performance Optimization
- Identify and eliminate blocking operations
- Set appropriate concurrency limits
- Profile async code and optimize hot paths
- Monitor event loop lag and resource utilization
---
## 4. Implementation Workflow (TDD)
### Step 1: Write Failing Async Test First
```python
# tests/test_data_fetcher.py
import pytest
import asyncio
from unittest.mock import AsyncMock, patch
@pytest.mark.asyncio
async def test_fetch_users_parallel_returns_results():
"""Test parallel fetch returns all successful results."""
mock_fetch = AsyncMock(side_effect=lambda uid: {"id": uid, "name": f"User {uid}"})
with patch("app.fetcher.fetch_user", mock_fetch):
from app.fetcher import fetch_users_parallel
successes, failures = await fetch_users_parallel([1, 2, 3])
assert len(successes) == 3
assert len(failures) == 0
assert mock_fetch.call_count == 3
@pytest.mark.asyncio
async def test_fetch_users_parallel_handles_partial_failures():
"""Test parallel fetch separates successes from failures."""
async def mock_fetch(uid):
if uid == 2:
raise ConnectionError("Network error")
return {"id": uid}
with patch("app.fetcher.fetch_user", mock_fetch):
from app.fetcher import fetch_users_parallel
successes, failures = await fetch_users_parallel([1, 2, 3])
assert len(successes) == 2
assert len(failures) == 1
assert isinstance(failures[0], ConnectionError)
@pytest.mark.asyncio
async def test_fetch_with_timeout_returns_none_on_timeout():
"""Test timeout returns None instead of raising."""
async def slow_fetch():
await asyncio.sleep(10)
return "data"
with patch("app.fetcher.fetch_data", slow_fetch):
from app.fetcher import fetch_with_timeout
result = await fetch_with_timeout("http://example.com", timeout=0.1)
assert result is None
```
### Step 2: Implement Minimum Code to Pass
```python
# app/fetcher.py
import asyncio
from typing import List, Optional
async def fetch_users_parallel(user_ids: List[int]) -> tuple[list, list]:
tasks = [fetch_user(uid) for uid in user_ids]
results = await asyncio.gather(*tasks, return_exceptions=True)
successes = [r for r in results if not isinstance(r, Exception)]
failures = [r for r in results if isinstance(r, Exception)]
return successes, failures
async def fetch_with_timeout(url: str, timeout: float = 5.0) -> Optional[str]:
try:
async with asyncio.timeout(timeout):
return await fetch_data(url)
except asyncio.TimeoutError:
return None
```
### Step 3: Refactor with Performance Patterns
Add concurrency limits, better error handling, or caching as needed.
### Step 4: Run Full Verification
```bash
# Run async tests
pytest tests/ -v --asyncio-mode=auto
# Check for blocking calls
grep -r "time\.sleep\|requests\.\|urllib\." src/
# Run with coverage
pytest --cov=app --cov-report=term-missing
```
---
## 5. Performance Patterns
### Pattern 1: Use asyncio.gather for Parallel Execution
```python
# BAD: Sequential - 3 seconds total
async def fetch_all_sequential():
user = await fetch_user() # 1 sec
posts = await fetch_posts() # 1 sec
comments = await fetch_comments() # 1 sec
return user, posts, comments
# GOOD: Parallel - 1 second total
async def fetch_all_parallel():
return await asyncio.gather(
fetch_user(),
fetch_posts(),
fetch_Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only โ no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.