skills/async-python/SKILL.md
Converts one or more named Python functions from synchronous to asynchronous using asyncio. Searches the current repo for the functions, analyzes their call graph and inter-function communication (shared queues, data structures), applies async/await syntax, and replaces sync I/O libraries with async equivalents (http/requests → aiohttp, pika → aio-pika, botocore/boto3 → aiobotocore, kafka-python → aiokafka, queue.Queue → asyncio.Queue). Use when asked to "convert this function to async", "make these functions asynchronous", "asyncify functions", or "convert to asyncio". Accepts multiple space-separated function names. Do NOT use for explaining asyncio concepts or for converting entire modules at once.
npx skillsauth add armandli/get-skilled async-pythonInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Convert the following Python functions to async: $ARGUMENTS
Work through these steps methodically and apply all changes before reporting.
Parse $ARGUMENTS as a space-separated list of function names.
For each name:
def <name>( and async def <name>(async def, skip it and notify the userRead every file containing at least one target function in full.
For each pair of target functions, determine their relationship:
queue.Queue / queue.LifoQueue / queue.PriorityQueue instance (passed as a parameter or a module-level variable)?list, dict, or collections.deque for communication?Build a dependency order for conversion: convert leaf functions (no async dependencies) first, then callers.
For each target function, identify:
time.sleep(n) calls → replace with await asyncio.sleep(n) (blocking sleep halts the entire event loop)http.client.*, requests.*, pika.*, boto3.*, botocore.*, kafka.*queue.Queue, queue.LifoQueue, queue.PriorityQueue → candidates for asyncio.Queue, asyncio.LifoQueue, asyncio.PriorityQueuewith) that become async withfor) over async iterables that become async forawait added)asyncio.gather() or TaskGroup (see references/concurrency-patterns.md)For each shared queue between any two target functions:
queue.Queue()/etc. instantiation with asyncio.Queue()/etc.put() → await put() and get() → await get() at every point of access across all functionstask_done() is called after each get() in consumer functionsSee references/library-conversions.md for queue conversion rules.
Check imports at the top of each file; list all libraries to swap.
Process functions in dependency order (callees before callers).
For each target function:
def <name>( → async def <name>(await before all calls to async library calls, other target functions in the list, and any calls identified in Step 3with <async_ctx> → async with <async_ctx>for item in <async_iterable> → async for item in <async_iterable>time.sleep(n) → await asyncio.sleep(n)For shared resources:
8. Replace any shared queue.Queue instantiation with asyncio.Queue
9. Apply all put()/get() call updates across every access point in every file
For call sites of the target functions (outside the target set):
async def: prepend awaitmain(), module level): wrap with asyncio.run(...)asyncio.gather(fn1(), fn2(), ...) — see references/concurrency-patterns.md for the full decision guideApply all changes to each file in a single edit per file.
For each helper function called by a target that performs I/O but is NOT in the target list:
/async-python <helper_name>"Output a structured summary:
## Async Conversion Report
### Converted Functions (N)
- <file>:<line> — `def <name>` → `async def <name>`
### Inter-Function Communication Updated
- <description> — e.g., shared queue.Queue → asyncio.Queue between <fn1> and <fn2>
### Libraries Replaced
- <old_import> → <new_import>
### Imports Added
- <list>
### Imports Removed (no longer used)
- <list>
### Call Sites Updated (N)
- <file>:<line> — added `await` / wrapped with `asyncio.run()`
### Flagged for Manual Review
- <file>:<line> — <reason>
### Helper Functions Needing Conversion
- <name> at <file>:<line> — called by <target_fn>, performs I/O
async defthreading.Thread(target=fn)), flag it — async functions cannot be used as sync callbacksasyncio.QueueAfter the skill's primary task completes, run:
python3 ${PWD}/.claude/skills/skill-stat/scripts/record-stat.py "async-python"
tools
--- name: update-readme description: Updates a project README.md with build instructions, unit test instructions, and a mermaid architecture diagram. Use when a project README needs to be created or refreshed. Trigger phrases: "update readme", "generate readme", "create readme", "refresh readme docs". Emphasizes project interfaces, extension points, and customization hooks in the diagram — not concrete implementations. Do NOT use for documentation sites, wikis, or non-project READMEs. argument-h
business
--- name: skill-stat description: Records skill usage statistics and issue reports into .claude/skill-stats.md. Increments the Uses count for a skill name, and optionally logs an issue report that increments the Issues count and appends a row to the Issue Reports table. Use when tracking how often a skill is invoked, when a user reports a problem with a skill, or when another skill needs to log its own usage. Trigger phrases: "record skill stat", "log skill usage", "report skill issue". Do NOT u
testing
--- name: revert description: Reverts ALL git changes in the working directory: staged changes, unstaged modifications, and new untracked files. Use when user asks to "revert all changes", "undo all changes", "discard all changes", "reset all git changes", or "clean working directory". Do NOT use for reverting a specific file or a specific commit — those need targeted git commands. disable-model-invocation: true --- Revert all git changes in the working directory. This is destructive and cannot
tools
Scans a Python codebase for duplicate or near-duplicate logic patterns across functions, classes, and files, then extracts those patterns into typed utility classes in a shared module. Use when the user asks to "refactor this Python code", "find duplicate logic", "extract shared utilities", "apply DRY to Python", "deduplicate Python code", or "find repeated patterns in Python". Groups extracted helpers by the object type they operate on (strings, numbers, dates, collections, etc.). Do NOT use for performance optimization (use optimize-python), for debugging logic errors, or for explaining code. Do NOT extract code that appears only once. Run this skill before optimize-python.