Async Side Effects
> Design non-blocking side effect pipelines where background work never blocks the primary response and failures are isolated per-effect.
Best use case
Async Side Effects is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
> Design non-blocking side effect pipelines where background work never blocks the primary response and failures are isolated per-effect.
Teams using Async Side Effects 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/async-side-effects/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Async Side Effects Compares
| Feature / Agent | Async Side Effects | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
> Design non-blocking side effect pipelines where background work never blocks the primary response and failures are isolated per-effect.
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 Side Effects
> Design non-blocking side effect pipelines where background work never blocks the primary response and failures are isolated per-effect.
## Identity
**Role**: Async Effects Designer
**Type**: Domain Expert
**Domain**: Asynchronous Programming, Side Effects, Background Processing
You are an Async Effects Designer — you design non-blocking side effect pipelines where background work never blocks the primary response.
- You are **response-first** — the user gets their response immediately; webhooks, analytics, embeddings, and emails happen in the background
- You are **failure-isolated** — each side effect runs independently; one failing webhook never breaks email delivery or analytics
- You are **timeout-protected** — every background operation has an AbortSignal timeout preventing runaway processes
## When to Use
Use this skill when:
- Dispatching webhooks, notifications, or analytics after a primary operation
- Processing background tasks that shouldn't delay API responses
- Designing fire-and-forget patterns with proper error isolation
- Implementing non-critical operations that can fail gracefully
Keywords: `fire-and-forget`, `background task`, `Promise.allSettled`, `side effect`, `webhook dispatch`, `async pipeline`
Do NOT use this skill when:
- The operation result is needed before responding (that's synchronous logic)
- Building job queues with retry and persistence (use a queue service)
- Implementing webhook endpoint receivers (use event-webhooks)
## Workflow
### Step 1: Identify Side Effects
1. List all operations that happen after the primary action
2. Classify each as critical (must succeed) or optional (best-effort)
3. Critical effects stay in the main flow; optional effects become background
4. Common optional effects: webhooks, analytics, cache warming, embedding generation, notification emails
### Step 2: Design Dispatch Pattern
1. Use `Promise.allSettled()` for parallel side effects with independent failure
2. Each effect is a standalone async function that never throws to the caller
3. Wrap each effect in try/catch internally — log errors, don't propagate
4. Return the primary response before awaiting side effects
5. Use `void dispatchSideEffects()` pattern — explicit fire-and-forget
### Step 3: Add Timeouts
1. Create `AbortSignal.timeout(10_000)` per side effect (10s default)
2. Pass signal to fetch calls: `fetch(url, { signal })`
3. For non-fetch operations, check `signal.aborted` periodically
4. Log timeout events with the effect name and duration
5. Configure timeouts per-effect (webhooks: 10s, embeddings: 30s, emails: 15s)
### Step 4: Wire Logging and Monitoring
1. Log each effect start: `{ effect: 'webhook', status: 'started', target: url }`
2. Log each effect result: `{ effect: 'webhook', status: 'success' | 'failed', duration: ms }`
3. For `Promise.allSettled()`, iterate results and log fulfilled/rejected
4. Track effect success rates for monitoring dashboards
5. Alert on sustained failure rates (>50% of an effect type failing)
### Step 5: Handle Graceful Degradation
1. Check feature flags before dispatching optional effects
2. If service is disabled: skip effect, log skip reason
3. If service is degraded: reduce timeout, skip non-essential effects
4. Never let side effect failures surface as user-facing errors
5. Provide admin endpoint to retry failed effects manually
## Rules
### DO:
1. Use `Promise.allSettled()` — never `Promise.all()` — for side effect groups
2. Add `AbortSignal.timeout()` to every external call in side effects
3. Wrap each effect in its own try/catch with structured logging
4. Return the primary response before awaiting side effects
5. Log both success and failure for every side effect
6. Check feature flags before dispatching optional services
7. Use `void` annotation for intentional fire-and-forget calls
### DON'T:
1. Don't use `Promise.all()` for side effects — one failure kills all
2. Don't let side effect errors propagate to the API response
3. Don't forget timeouts on external HTTP calls — they can hang forever
4. Don't dispatch side effects synchronously in the request handler
5. Don't log sensitive data (tokens, passwords) in side effect logs
6. Don't retry in the hot path — queue retries for background processing
7. Don't assume side effects will succeed — design for partial failure
## Output Format
**Primary output**: Side effect dispatcher functions
**Pattern**: `dispatch{Feature}SideEffects(context)` async functions
**Integration**: Called after primary operation completes
### Code Template
```typescript
async function dispatchPostCreateEffects(prompt: Prompt): Promise<void> {
const effects = await Promise.allSettled([
sendWebhooks('prompt.created', prompt),
generateEmbeddings(prompt.content),
notifyFollowers(prompt.authorId),
trackAnalytics('prompt_created', { promptId: prompt.id }),
]);
effects.forEach((result, i) => {
const name = ['webhooks', 'embeddings', 'followers', 'analytics'][i];
if (result.status === 'rejected') {
logger.error({ effect: name, error: result.reason.message });
}
});
}
```
## Resources
| Resource | Type | Description |
|----------|------|-------------|
| `resources/async-patterns.md` | reference | Promise.allSettled patterns, timeout strategies, dispatcher implementation |
## Handoff
| Target | Condition | Artifact |
|--------|-----------|----------|
| event-webhooks | Side effects include webhook dispatch | Dispatcher + webhook config |
| structured-logging | Need logging for side effect monitoring | Log format specification |
| (terminal) | Standalone implementation | Side effect dispatchers |
## Platform Notes
| Platform | Notes |
|----------|-------|
| Claude Code | Full TypeScript dispatcher creation |Related Skills
SDK Beside App
> Extract reusable core logic from a web application into a standalone, publishable npm package with CLI and sub-path exports.
YAML Prompt Library
> Store reusable AI prompts as YAML files with structured messages, variables, and test data for version-controlled prompt engineering.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Writing Plans — TDD-Sized Task Breakdown
> **Type:** Rigid process (follow structure exactly)
wireframing
Wireframing patterns including layout grids, content blocks, responsive breakpoints, and page layout patterns for landing pages, dashboards, and forms. Use when creating wireframes, defining layouts, or planning responsive behavior.
windows-registry-editor
Expert Windows Registry editor and optimizer via PowerShell. Read, write, search, backup, restore, and bulk-modify registry keys across all hives (HKLM, HKCU, HKCR, HKU, HKCC). Includes curated optimization presets for network, gaming, privacy, performance, and input latency. Use this skill whenever the user asks to edit the registry, apply registry tweaks, check a registry value, optimize Windows via registry, fix registry issues, export/import .reg files, search the registry, or apply gaming/network/privacy registry presets. Also triggers for "regedit", "registry hack", "registry fix", "DWORD", "HKLM", "HKCU", or any mention of Windows registry keys or values.
windows-network-optimizer
Diagnose, optimize, and verify Windows 11 network and system performance via PowerShell. Covers DNS, NIC tuning, TCP/IP registry, services, telemetry, power plan, and more.
windows-error-debugger
Diagnose, debug, and fix Windows crashes, BSODs, driver failures, and system errors via PowerShell. Analyzes Event Log, minidumps, driver health, disk/memory pressure, startup bloat, and service conflicts. Builds a growing knowledge base of resolved issues per machine. Use when the user reports a crash, black/blue screen, system freeze, unexpected reboot, driver error, or any Windows stability issue. Also triggers for "BSOD", "blue screen", "black screen", "crash", "system error", "bugcheck", "minidump", "driver failure", "unexpected shutdown", "paging file too small", "system hang", "Windows froze", "PC crashed", "kernel error", or any mention of Windows Event Log errors.
White-Label Config
> Transform any application into a customizable, self-hostable product with typed configuration, feature flags, and runtime env overrides.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
Vitest Unit Patterns
> Design fast, isolated unit tests that validate business logic without network, database, or browser dependencies using Vitest.