Refactoring & Modernization
Compatible with Cursor, Claude Code, Cline, Roo Code, Antigravity

Synchronous Blocking to Async / Reactive Modernization

Convert blocking I/O code into non-blocking async/await, reactive streams, or virtual threads.

AsyncConcurrencyJavaNode.jsPerformanceRefactoring
Skill Objective

Modernize blocking I/O loops and thread sleeps into non-blocking async/await, structured concurrency, or Java 21 Virtual Threads.

Execution Workflow Procedure

Ordered steps the coding agent executes when performing this skill.

1

Identify Blocking Operations

Locate blocking HTTP calls, synchronous disk reads, thread sleep calls, and synchronous database queries.

2

Apply Structured Concurrency & Limits

Implement concurrency rate limiters (semaphores) and structured concurrency scopes with cancellation tokens.

3

Handle Partial Failure Aggregation

Aggregate results cleanly and ensure failures in parallel subtasks cancel pending sibling tasks without leaking threads.

Agent Safety Guardrails & Anti-Hallucination Rules

  • DO NOT fire unbounded parallel requests without semaphore or pool rate limiting.
  • DO NOT swallow cancellation exceptions or leave orphaned promises.

Expected Output Format

Non-blocking async implementation with error cancellation.

🛠️ Modernized Async Implementation: Fully typed non-blocking code.
⚡ Performance & Concurrency Profile: Throughput and resource usage improvements.

Domain Verification Checks

Thread Pool Safety: Prevents thread pool starvation under high load.
Structured Cancellation: Cancels sibling tasks when one parallel branch fails.
Rate Limit Bounding: Protects downstream services with concurrency limits.

Example Agent Invocations

"Modernize this sequential Java loop fetching user credit scores into Java 21 Virtual Threads."
"Convert this blocking Node.js batch file processing script into an async stream pipeline with backpressure."

Install / Configure This Skill

# Place in .cursorrules or create .cursor/rules/sync-to-async-modernization.mdc
# Trigger: Whenever you perform synchronous blocking to async / reactive modernization

---
name: sync-to-async-modernization
description: Convert blocking synchronous I/O into non-blocking async/await, Virtual Threads, or stream pipelines.
version: 1.0.0
compatibility: [Cursor, Claude Code, Cline, Roo Code, Antigravity]
---

# Synchronous Blocking to Async / Reactive Modernization

## Objective
Modernize sequential blocking I/O into high-throughput structured concurrency with backpressure and cancellation support.

## Workflow
1. **Blocking Call Scan**: Identify synchronous network, database, and file I/O.
2. **Concurrency Scopes**: Apply structured concurrency (Java Virtual Threads / Promise.all) with bounded semaphores.
3. **Cancellation & Error Handling**: Ensure failures in one branch cleanly cancel sibling operations.
Complementary Agent Prompt

Need a quick one-time prompt for chat?

Try the Synchronous Blocking to Async / Reactive Modernization — a lightweight version designed for 1-click copying directly into Claude, ChatGPT, or Cursor chat.

View Prompt

SprintKit Workflow Integrations

Complementary tools and checklists to pair with this agent workflow.

Related Agent Skills

Explore related procedural workflows in this discipline.

All Skills

API Performance Bottleneck & N+1 Query Optimization

Diagnose slow database queries, serialization bottlenecks, and memory churn in sluggish API endpoints.

PerformanceSQLNode.js+3
3 workflow stepsView skill

Node.js & V8 Memory Leak / CPU Spike Investigation

Analyze heap snapshots, unclosed event listeners, and runaway closures causing Node.js OOM crashes.

Node.jsJavaScriptTypeScript+3
3 workflow stepsView skill

Safe Legacy Code Modernization with Golden Master Tests

Safely modernize fragile legacy codebases using Martin Fowler refactoring patterns and characterization tests.

RefactoringClean CodeDesign Patterns+1
4 workflow stepsView skill