- Home
- Skills
- Agents & Orchestration
- Repair Async Generator Cleanup Bugs
Works with the AI tools you already use
Repair Async Generator Cleanup Bugs
Repair async-generator cleanup leaks after early break, return, throw, timeout, cancellation, or pending-next races.
$8.99
Repair Async Generator Cleanup Bugs
Example session with this skill installed
Our TypeScript service wraps a broker subscription in two async-generator adapters. Breaking from for-await closes the outer generator, but the inner subscription keeps receiving messages and its heartbeat timer survives. A pending next() can also resolve after cancellation and publish one more value. Repair locally with a fake subscription and controlled promises. Preserve message order, buffer size, retry behavior, and timeout values; do not connect to the broker.
- Read your context and instructions
- Compiled the repair async generator
Cleanup leak found. The adapter forwards next but not return, so breaking from for-await leaves the source producer and subscription alive. The repair forwards all terminal operations, makes finalization single-owner, cancels the pending read, preserves the original error, and verifies that no value or resource survives termination.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
The problem
Async generators often leak resources or keep producers running long after a consumer exits or an early break occurs. Improperly handled cancellation signals and races between pending next calls and disposal lead to flaky tests and memory leaks.
What it does
- Identifies orphaned producer tasks and unreleased resource leases in async iteration flows.
- Enforces a canonical termination contract across early returns, throws, and timeouts.
- Wires AbortSignal cancellation through nested adapters to ensure it reaches the producer.
- Ensures idempotent cleanup that preserves the original error instead of masking it.
- Implements deterministic test barriers to replace unreliable wall-clock sleeps.
Frameworks & tools
Works with JavaScript/TypeScript async iterators, Node.js streams, AbortController, and repository-level concurrency primitives.
Why this beats prompting it yourself
Generic prompts often miss the nuances of the async event loop, such as settling pending promises during disposal. This skill uses a formal Resource Ownership Register to trace every generator generation, preventing the "swallowed error" and "double cleanup" bugs common in manual patches.
Use cases
- Fixing database cursors that remain open after a
for-await...ofloop breaks. - Propagating cancellation from a UI component down to a background data stream.
- Repairing iterator adapters that accidentally convert a throw into a normal completion.
- Eliminating race conditions where a producer publishes a value after the consumer disconnected.
Known limitations
Does not change payload ordering, retry policies, or protocol semantics. It cannot contact live production brokers or databases and relies on local fakes for validation.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 19 days ago
- Passed all security checks, Safe to install