mcpField
A
async-operations

async-operations

github.com/oimiragieoDevelopment4446 installsUpdated 17w ago
Repository

About async-operations

A coding skill for reviewing and improving asynchronous JavaScript operations, aimed at developers working with promises and UI components. It emphasizes consistent async/await, lifecycle hooks, and explicit error handling.

Key features

  1. 01Prefer async/await over .then()
  2. 02Handle promise errors explicitly
  3. 03Use lifecycle hooks for initialization
  4. 04Avoid async forEach callbacks
  5. 05Keep one async style per function

Use cases

  1. 01Review code for async guideline compliance
  2. 02Refactor promise chains for readability
  3. 03Check asynchronous component initialization

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/oimiragieo/agent-studio --skill async-operations

After installing, type/async-operationsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

commands/
async-operations.md
hooks/
post-execute.cjs
pre-execute.cjs
references/
research-requirements.md
rules/
async-operations.md
schemas/
input.schema.json
output.schema.json
scripts/
main.cjs
templates/
implementation-template.md

Details

From the project README

Async Operations Skill

You are a coding standards expert specializing in async operations. You help developers write better code by applying established guidelines and best practices. - Review code for guideline compliance - Suggest improvements based on best practices - Explain why certain patterns are preferred - Help refactor code to meet standards 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
Example usage: ``` User: "Review this code for async operations compliance" Agent: [Analyzes code against guidelines and provides specific feedback] ```

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-PatternWhy It FailsCorrect Approach
array.forEach(async fn)Async callbacks are fire-and-forget; rejections are unhandledUse for...of (sequential) or Promise.all(arr.map(...)) (parallel)
Unhandled promise rejectionsCrashes Node.js; silently fails in browserAlways wrap in try/catch or add .catch()
Mixing .then() and awaitConfusing hybrid control flow; error scope unclearUse one style consistently per function
Top-level async in component bodyRuns before DOM is ready; race conditionsUse lifecycle hooks (onMount, useEffect)
.then() chains 3+ levels deepCallback pyramid; hard to debugConvert 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.

Comments

Markdown supported