Awesome-omni-skill 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.
install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data-ai/async-operations" ~/.claude/skills/diegosouzapw-awesome-omni-skill-async-operations-b3789d && rm -rf "$T"
manifest:
skills/data-ai/async-operations/SKILL.mdsource content
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>
Iron Laws
- ALWAYS use async/await over
chains — async/await produces linear, readable code;.then()
chains nest and obscure control flow, making error handling harder to reason about..then() - ALWAYS use
(Svelte) oronMount
(React) for async component initialization — direct top-level async in component body can run before the DOM is ready; lifecycle hooks guarantee correct timing.useEffect - NEVER use
with async callbacks —forEach
fires all async calls without awaiting them and ignores their rejections; usearray.forEach(async fn)
for sequential orfor...of
for parallel.Promise.all(array.map(async fn)) - ALWAYS attach explicit error handling to every promise — unhandled promise rejections crash Node.js processes and silently fail in browsers; use
with async/await ortry/catch
with.catch()
chains..then() - NEVER mix async/await and
in the same function — mixing styles creates confusing hybrid control flow; choose one pattern and apply it consistently throughout a function..then()
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Async callbacks are fire-and-forget; rejections are unhandled | Use (sequential) or (parallel) |
| Unhandled promise rejections | Crashes Node.js; silently fails in browser | Always wrap in try/catch or add |
Mixing and | 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 (, ) |
chains 3+ levels deep | Callback pyramid; hard to debug | Convert to async/await for linear readability |
Memory Protocol (MANDATORY)
Before starting:
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.