async-operations

Specifies the preferred syntax for asynchronous operations using async/await and onMount for component initialization. This results in cleaner and more readable asynchronous code.

16 stars

Best use case

async-operations is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Specifies the preferred syntax for asynchronous operations using async/await and onMount for component initialization. This results in cleaner and more readable asynchronous code.

Teams using async-operations should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/async-operations/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/data-ai/async-operations/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/async-operations/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How async-operations Compares

Feature / Agentasync-operationsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Specifies the preferred syntax for asynchronous operations using async/await and onMount for component initialization. This results in cleaner and more readable asynchronous code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Async Operations Skill

<identity>
You are a coding standards expert specializing in async operations.
You help developers write better code by applying established guidelines and best practices.
</identity>

<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>

<instructions>
When reviewing or writing code, apply these guidelines:

- Async Operations
  - Prefer async/await syntax over .then() chains
  - Use onMount for component initialization that requires async operations
    </instructions>

<examples>
Example usage:
```
User: "Review this code for async operations compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>

## Iron Laws

1. **ALWAYS use async/await over `.then()` chains** — async/await produces linear, readable code; `.then()` chains nest and obscure control flow, making error handling harder to reason about.
2. **ALWAYS use `onMount` (Svelte) or `useEffect` (React) for async component initialization** — direct top-level async in component body can run before the DOM is ready; lifecycle hooks guarantee correct timing.
3. **NEVER use `forEach` with async callbacks** — `array.forEach(async fn)` fires all async calls without awaiting them and ignores their rejections; use `for...of` for sequential or `Promise.all(array.map(async fn))` for parallel.
4. **ALWAYS attach explicit error handling to every promise** — unhandled promise rejections crash Node.js processes and silently fail in browsers; use `try/catch` with async/await or `.catch()` with `.then()` chains.
5. **NEVER mix async/await and `.then()` in the same function** — mixing styles creates confusing hybrid control flow; choose one pattern and apply it consistently throughout a function.

## Anti-Patterns

| Anti-Pattern                      | Why It Fails                                                  | Correct Approach                                                      |
| --------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------- |
| `array.forEach(async fn)`         | Async callbacks are fire-and-forget; rejections are unhandled | Use `for...of` (sequential) or `Promise.all(arr.map(...))` (parallel) |
| Unhandled promise rejections      | Crashes Node.js; silently fails in browser                    | Always wrap in try/catch or add `.catch()`                            |
| Mixing `.then()` and `await`      | Confusing hybrid control flow; error scope unclear            | Use one style consistently per function                               |
| Top-level async in component body | Runs before DOM is ready; race conditions                     | Use lifecycle hooks (`onMount`, `useEffect`)                          |
| `.then()` chains 3+ levels deep   | Callback pyramid; hard to debug                               | Convert to async/await for linear readability                         |

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:** Record any new patterns or exceptions discovered.

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Related Skills

asynchronous-programming-preference

16
from diegosouzapw/awesome-omni-skill

Favors the use of async and await for asynchronous programming in Python.

search-operations

16
from diegosouzapw/awesome-omni-skill

Search GitHub - find code, issues, users, and repositories across GitHub using gh CLI

async-repl-protocol

16
from diegosouzapw/awesome-omni-skill

Async REPL Protocol

Sales Operations Automation

16
from diegosouzapw/awesome-omni-skill

* **Depends on**: None * **Compatible with**: None * **Conflicts with**: None * **Related Skills**: None # Sales Operations Automation

asyncredux-undo-redo

16
from diegosouzapw/awesome-omni-skill

Implement undo/redo functionality using state observers. Covers recording state history with stateObserver, creating a RecoverStateAction, implementing undo for the full state or partial state, and managing history limits.

asyncredux-observers

16
from diegosouzapw/awesome-omni-skill

Set up observers for debugging and monitoring. Covers implementing actionObservers for dispatch logging, stateObserver for state change tracking, combining observers with globalWrapError, and using observers for analytics.

asyncredux-nonreentrant-mixin

16
from diegosouzapw/awesome-omni-skill

Add the NonReentrant mixin to prevent an action from dispatching while already in progress. Covers preventing duplicate form submissions, avoiding race conditions, and protecting long-running operations.

asyncredux-async-actions

16
from diegosouzapw/awesome-omni-skill

Creates AsyncRedux (Flutter) asynchronous actions for API calls, database operations, and other async work.

asyncpg-detection

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks to "detect asyncpg usage", "find asyncpg patterns", "scan for asyncpg imports", or "identify asyncpg database code in FastAPI projects". It automatically scans Python files to identify asyncpg imports, connection patterns, and query execution methods that need conversion to SQLAlchemy.

asyncio

16
from diegosouzapw/awesome-omni-skill

Python asyncio - Modern concurrent programming with async/await, event loops, tasks, coroutines, primitives, aiohttp, and FastAPI async patterns

asyncapi-docs

16
from diegosouzapw/awesome-omni-skill

AsyncAPI specification handling for event-driven API documentation. Parse, validate, and generate documentation for message-based APIs including Kafka, MQTT, WebSocket, and AMQP systems.

asyncapi-design

16
from diegosouzapw/awesome-omni-skill

Event-driven API specification with AsyncAPI 3.0 for message-based architectures