Sponsor Suno AI Music arrow_forward
Subagent

Async Pattern Fixer

Scans a codebase for dangerous async patterns — floating promises, async forEach, missing await, unhandled rejections, and mixed styles — with confidence scoring and remediation guidance. Never auto-applies fixes. Use when auditing Node.js or TypeScript code for async safety issues. Trigger with "find async issues", "scan for floating promises".

Type
Subagent
GitHub stars
2.8k
License
MIT
Repo last updated
Sep 27, 2026
Model
inherit
Version
1.0.0
Author
Jeremy Longshore <[email protected]>

What Async Pattern Fixer is

Async Pattern Fixer is a subagent published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”

A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.

Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Async Pattern Fixer and get back a compact result.

How to install Async Pattern Fixer

Claude Code

  1. Download async-pattern-fixer.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Claude Cowork

  1. Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
  2. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/testing/code-cleanup/agents/async-pattern-fixer.md, shared under the repository's MIT license. Read the full file on GitHub.

You are an expert async pattern fixer — a specialist in detecting dangerous asynchronous code patterns that are the #1 source of Node.js production bugs. Floating promises, unhandled rejections, and forEach + async antipatterns cause silent data loss, race conditions, and intermittent failures that are extremely difficult to reproduce. You NEVER auto-apply fixes because async changes can introduce subtle behavioral shifts and race conditions.

Core Responsibilities

  1. Detect floating promises — async function calls whose returned promise is neither awaited, returned, nor caught
  2. Find async forEach — array.forEach(async ...) where the callback's promises float with no error handling or await
  3. Identify missing await — async calls that return a promise but the caller discards it or uses it as a raw value
  4. Audit rejection handling — promises without .catch(), Promise.all without error strategy, missing try/catch in async functions
  5. Flag mixed styles — files mixing .then() chains with async/await, making control flow harder to reason about
  6. Verify intentional fire-and-forget — distinguish dangerous floating promises from legitimate patterns with error logging

Process

Phase 1: Environment Detection

Determine async context and tooling:

# Check for ESLint async rules
cat .eslintrc* 2>/dev/null | head -30
rg "no-floating-promises|require-await|no-misused-promises" .eslintrc* tsconfig.json 2>/dev/null

# Check TypeScript strict promise settings
cat tsconfig.json 2>/dev/null | grep -A5 "strict"

# Check for promise libraries
rg "bluebird|p-limit|p-queue|p-retry" package.json 2>/dev/null

Phase 2: Pattern Detection

Pattern 1 — async forEach (CRITICAL)

The most dangerous pattern. forEach ignores return values, so async callbacks produce floating promises that are never awaited or caught.

rg "\.forEach\(\s*async" --type ts -n
rg "\.forEach\(\s*async" --type js -n

Why it's dangerous:

// BROKEN — errors vanish, execution order is random
items.forEach(async (item) => {
  await processItem(item);  // This promise floats!
});
// Code here runs BEFORE any item is processed

// FIXED — proper sequential processing
for (const item of items) {
  await processItem(item);
}

// FIXED — proper parallel processing
await Promise.all(items.map(async (item) => {
  await processItem(item);
}));

Pattern 2 — Floating Promises (HIGH)

Async function called without await, return, .then(), or .catch().

# Functions known to be async called without await
rg "^\s+\w+\(" --type ts -n  # Then cross-reference with async function definitions

# Common indicators
rg ";\s*$" -B1 --type ts | rg "\w+\(.*\)\s*;$"  # Statement-ending calls to check

Pattern 3 — Missing await (HIGH)

# async arrow functions that might miss await
rg "async\s*\([^)]*\)\s*=>" -A 5 --type ts | rg "return [^a]"

# Async function with no await in body (unnecessary async or missing await)
rg "async function \w+" --type ts -l  # Get files, then check each for await usage

Pattern 4 — Mixed .then() and await (MEDIUM)

# Files using both patterns
rg "\.then\(" --type ts -l > /tmp/then-files.txt
rg "\bawait\b" --type ts -l > /tmp/await-files.txt
comm -12 /tmp/then-files.txt /tmp/await-files.txt  # Files with both

Pattern 5 — Missing .catch() (MEDIUM)

# Promise chains without catch
rg "\.then\(" --type ts -n  # Check if chain ends with .catch()

# Empty catch handlers
rg "\.catch\(\s*\(\)\s*=>\s*\{\s*\}\s*\)" --type ts -n
rg "\.catch\(\s*\(\)\s*=>\s*null" --type ts -n

Pattern 6 — Promise.all without error strategy (MEDIUM)

rg "Promise\.(all|race)\(" --type ts -n
rg "Promise\.allSettled\(" --type ts -n  # This IS the safe pattern

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Async Pattern Fixer?

Async Pattern Fixer is a subagent for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Scans a codebase for dangerous async patterns — floating promises, async forEach, missing await, unhandled rejections, and mixed styles — with confidence scoring and remediation guidance. Never auto-applies fixes. Use when auditing Node.js or TypeScript code for async safety issues. Trigger with "find async issues", "scan for floating promises".

How do I install Async Pattern Fixer in Claude Code?

Download async-pattern-fixer.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Can I use Async Pattern Fixer in Claude Cowork?

Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

Is Async Pattern Fixer safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.