effect-batching

Batch and deduplicate concurrent Effect.request calls with RequestResolver.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-batching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-batching
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-batching
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-batching

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents N+1 query problems by batching many concurrent lookups into fewer resolver executions, while deduplicating identical requests inside the batch window.

Core Features & Use Cases

  • Automatic request batching & deduplication: Use Effect.request with Request and a RequestResolver to collect concurrent requests and resolve them together.
  • Precise resolver control: Implement resolvers that must complete every entry, with utilities for pure, effectful, grouped, tagged, and combinator-based resolver behavior.
  • Batch tuning, caching, and observability: Configure delay, batch size, and caching, and add spans for tracing batch execution details.
  • SQL-aware batching integration: Use SqlResolver (ordered, grouped, findById, void) for schema-validated batched SQL execution with transaction awareness.
  • Use Case: When fetching users by ID for 200 items, define a per-item GetUserById request and let the resolver batch them into a single fetch, returning typed errors for misses.

Quick Start

Use the effect-batching skill to implement a RequestResolver that batches GetUserById lookups into one fetch and deduplicates identical IDs automatically.

Frequently Asked Questions about effect-batching

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

FAQPage Schema
How do I solve the N+1 query problem when fetching related data in Effect TypeScript?

To solve the N+1 query problem in Effect TypeScript, use RequestResolver to batch concurrent Effect.request calls together. This Skill collects concurrent lookups and resolves them in a single execution, deduplicating identical requests inside the batch window to prevent redundant fetches.

How does request batching and deduplication work with RequestResolver?

Request batching and deduplication works by collecting concurrent Effect.request calls into a single resolver execution window. Identical requests made within the configured batch delay are automatically deduplicated, ensuring only one execution occurs per unique request.

How do I configure batch size and delay for resolvers in Effect?

You configure batch size and delay for resolvers in Effect by tuning the RequestResolver settings. You can adjust the batch window delay and maximum batch size to control how many concurrent requests are collected together before execution.

Does effect-batching support SqlResolver for schema-validated SQL execution?

Yes, effect-batching supports SqlResolver for schema-validated batched SQL execution. It provides ordered, grouped, findById, and void resolver variants with transaction awareness to integrate batching directly into your SQL data access layer.

Can I add tracing and observability to batched resolver execution?

Yes, you can add tracing and observability to batched resolver execution by instrumenting resolvers with spans. This allows you to trace batch execution details, monitor cache behavior, and observe batch delay and size performance metrics.

What happens if a resolver does not complete every entry in a batch?

If a resolver does not complete every entry in a batch, the execution is considered incomplete. The Skill requires that every resolver entry is properly completed, returning typed errors for misses such as when a requested ID is not found in the data source.