跳到正文
cccskills
免费在 GitHub 公开

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.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(10)

  • SKILL.md4.0 KB
  • commands/async-operations.md116 B
  • hooks/post-execute.cjs310 B
  • hooks/pre-execute.cjs427 B
  • references/research-requirements.md462 B
  • rules/async-operations.md470 B
  • schemas/input.schema.json650 B
  • schemas/output.schema.json260 B
  • scripts/main.cjs1.1 KB
  • templates/implementation-template.md190 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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-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.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

查看 oimiragieo 的全部技能

报告此技能的问题