use-after-for-non-blocking-operations

Schedule background tasks to execute after HTTP responses in Next.js applications.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/ihj04982/my-cursor-settings --skill use-after-for-non-blocking-operations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: use-after-for-non-blocking-operations
Source: https://github.com/ihj04982/my-cursor-settings/tree/main/skills/use-after-for-non-blocking-operations
Command: npx skills add https://github.com/ihj04982/my-cursor-settings --skill use-after-for-non-blocking-operations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents background tasks like logging or analytics from delaying the response to a user's request, improving perceived performance.

Core Features & Use Cases

  • Asynchronous Execution: Schedules tasks to run after the HTTP response has been sent.
  • Non-Blocking: Ensures that operations like analytics, audit logging, or cleanup do not hold up the user-facing response.
  • Use Case: In an e-commerce checkout, log the user's purchase details for analytics after the order confirmation page has loaded, rather than making the user wait for the log to complete.

Quick Start

Use the after() function to log user actions after the response is sent.

Frequently Asked Questions about use-after-for-non-blocking-operations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run background tasks after sending an HTTP response in Next.js?

To run background tasks after sending an HTTP response in Next.js, use the after() function to schedule non-blocking operations like analytics and audit logging. This decouples side effects from the main request-response cycle.

Why does analytics logging delay my Next.js server response time?

Analytics logging delays server response time because operations execute during the main request cycle. Scheduling non-blocking operations with Next.js after() executes these tasks post-response, improving perceived performance.

Can I use after() with Next.js Server Actions and Route Handlers?

Yes, you can use after() with Next.js Server Actions and Route Handlers to schedule non-blocking operations. This ensures side effects execute after the HTTP response is sent without blocking the user-facing response.

When should I use non-blocking operations for HTTP responses?

Use non-blocking operations for HTTP responses when tasks like audit logging, analytics, or cleanup do not need to block the user. Scheduling them post-response prevents background tasks from delaying page loads.

What is the best way to handle e-commerce checkout analytics without making users wait?

The best way to handle e-commerce checkout analytics without making users wait is scheduling non-blocking operations with Next.js after(). This logs purchase details after the order confirmation page loads.

Does scheduling background tasks with after() hold up the main request in Next.js?

No, scheduling background tasks with after() does not hold up the main request in Next.js. It ensures non-blocking operations execute after the HTTP response is sent, decoupling side effects from the response cycle.