Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.
Agentic Workflow: Read -> Reason -> Act (batch-requests)
You are Batch Requests (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for batch-requests
- Domain: Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.
- jsonrpc-batch: Send batched JSON-RPC requests. —
curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"js
- graphql-batching: Execute multiple GraphQL operations in one HTTP round trip. —
curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/jso
- server-batch: Create and test dedicated batch endpoints. —
curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json"
- Check
knowledge and prerequisites: jq
2. Reason — think for batch-requests
- For
jsonrpc-batch: Send batched JSON-RPC requests. — decide which checks to run
- For
graphql-batching: Execute multiple GraphQL operations in one HTTP round trip. — decide which checks to run
- For
server-batch: Create and test dedicated batch endpoints. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with batch-requests tools
- Tools:
Glob, Grep, Read, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
batch-requests:35a840f7
Batch Requests
What this skill does
Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.
When to use
- Clients make many small calls that can be grouped
- Reducing round trips over high-latency networks
- Bulk reads or writes in one operation
Real commands
# JSON-RPC batch
curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'
# GraphQL batch (JSON array of operations)
curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '[{"query":"{users{id}}"},{"query":"{posts{id}}"}]'
# Dedicated batch endpoint
curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"},{"path":"/posts","method":"GET"}]}'
Testing
- Compare time_total for N single calls vs one batch call
- Assert per-item status codes in the batch response
Best practices
- Cap batch sizes to bound server work (e.g. 100 items)
- Return per-item errors, not all-or-nothing
- Use id/alias mapping so clients can correlate responses
- Batch only idempotent or cache-friendly reads by default
Capabilities
jsonrpc-batch
Send batched JSON-RPC requests.
Parameters:
endpoint (string): JSON-RPC endpoint
batch_file (string): File with JSON-RPC requests
Commands:
curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'
curl -X POST https://api.your-app.test/rpc -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"getUser","params":[1],"id":1},{"jsonrpc":"2.0","method":"getOrder","params":[42],"id":2}]'
jq -c '.[]' batch.json | while read r; do curl -s -X POST https://api.your-app.test/rpc -d "$r"; done
Examples:
- curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'
- curl -s -X POST https://api.your-app.test/rpc -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"getUser","params":[1],"id":1}]' | jq .
- jq -c '.[]' batch.json | xargs -I{} curl -s -X POST https://api.your-app.test/rpc -H 'Content-Type: application/json' -d '{}'
graphql-batching
Execute multiple GraphQL operations in one HTTP round trip.
Parameters:
query (string): GraphQL query document(s)
operations (string): JSON array of operations
Commands:
curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '[{"query":"{users{id}}"},{"query":"{posts{id}}"}]'
curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"query { users { id } posts { id } }"}'
curl -s -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"{ a: users { id } b: posts { id } }"}'
Examples:
server-batch
Create and test dedicated batch endpoints.
Parameters:
batch_url (string): Batch endpoint URL
requests_json (string): Batch request list JSON
Commands:
curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"},{"path":"/posts","method":"GET"}]}'
curl -s -o /dev/null -w "%{http_code} %{time_total}\n" -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"}]}'
curl -s -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"}]}' | jq '.responses | length'
Examples:
References
1---2name: "batch-requests"3description: "Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks. Use when working with jsonrpc batch, graphql batching, server batch, api or when the user mentions jsonrpc batch, graphql batching, server batch, api."4license: "MIT"5compatibility: "Requires jq. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/batch-requests8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(jq:*)"12---1314Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.1516## Agentic Workflow: Read -> Reason -> Act (batch-requests)1718You are **Batch Requests** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `batch-requests`21- Domain: Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.22- **jsonrpc-batch**: Send batched JSON-RPC requests. — `curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"js`23- **graphql-batching**: Execute multiple GraphQL operations in one HTTP round trip. — `curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/jso`24- **server-batch**: Create and test dedicated batch endpoints. — `curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json"`25- Check `knowledge` and `prerequisites: jq`2627### 2. Reason — think for `batch-requests`28- For `jsonrpc-batch`: Send batched JSON-RPC requests. — decide which checks to run29- For `graphql-batching`: Execute multiple GraphQL operations in one HTTP round trip. — decide which checks to run30- For `server-batch`: Create and test dedicated batch endpoints. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `batch-requests` tools34- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `batch-requests:35a840f7`3738# Batch Requests3940## What this skill does4142Combines multiple API calls into single HTTP round trips using JSON-RPC batch arrays, GraphQL operation aliases, and dedicated batch endpoints to reduce client-side latency over high-latency networks.4344## When to use4546- Clients make many small calls that can be grouped47- Reducing round trips over high-latency networks48- Bulk reads or writes in one operation4950## Real commands5152```bash53# JSON-RPC batch54curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'5556# GraphQL batch (JSON array of operations)57curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '[{"query":"{users{id}}"},{"query":"{posts{id}}"}]'5859# Dedicated batch endpoint60curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"},{"path":"/posts","method":"GET"}]}'61```6263## Testing6465- Compare time_total for N single calls vs one batch call66- Assert per-item status codes in the batch response6768## Best practices6970- Cap batch sizes to bound server work (e.g. 100 items)71- Return per-item errors, not all-or-nothing72- Use id/alias mapping so clients can correlate responses73- Batch only idempotent or cache-friendly reads by default7475## Capabilities7677### jsonrpc-batch78Send batched JSON-RPC requests.7980**Parameters:**81- `endpoint` (string): JSON-RPC endpoint82- `batch_file` (string): File with JSON-RPC requests8384**Commands:**85- `curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'`86- `curl -X POST https://api.your-app.test/rpc -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"getUser","params":[1],"id":1},{"jsonrpc":"2.0","method":"getOrder","params":[42],"id":2}]'`87- `jq -c '.[]' batch.json | while read r; do curl -s -X POST https://api.your-app.test/rpc -d "$r"; done`8889**Examples:**90- curl -X POST http://localhost:8545 -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","id":1},{"jsonrpc":"2.0","method":"eth_chainId","id":2}]'91- curl -s -X POST https://api.your-app.test/rpc -H "Content-Type: application/json" -d '[{"jsonrpc":"2.0","method":"getUser","params":[1],"id":1}]' | jq .92- jq -c '.[]' batch.json | xargs -I{} curl -s -X POST https://api.your-app.test/rpc -H 'Content-Type: application/json' -d '{}'9394### graphql-batching95Execute multiple GraphQL operations in one HTTP round trip.9697**Parameters:**98- `query` (string): GraphQL query document(s)99- `operations` (string): JSON array of operations100101**Commands:**102- `curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '[{"query":"{users{id}}"},{"query":"{posts{id}}"}]'`103- `curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"query { users { id } posts { id } }"}'`104- `curl -s -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"{ a: users { id } b: posts { id } }"}'`105106**Examples:**107- curl -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '[{"query":"{users{id}}"},{"query":"{posts{id}}"}]'108- curl -s -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"query A { users { id } } query B { posts { id } }"}'109- curl -s -X POST https://api.your-app.test/graphql -H "Content-Type: application/json" -d '{"query":"{ a: users { id } b: posts { id } }"}' | jq '.data | keys'110111### server-batch112Create and test dedicated batch endpoints.113114**Parameters:**115- `batch_url` (string): Batch endpoint URL116- `requests_json` (string): Batch request list JSON117118**Commands:**119- `curl -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"},{"path":"/posts","method":"GET"}]}'`120- `curl -s -o /dev/null -w "%{http_code} %{time_total}\n" -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"}]}'`121- `curl -s -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"}]}' | jq '.responses | length'`122123**Examples:**124- curl -s -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users/1","method":"GET"},{"path":"/users/2","method":"GET"}]}'125- curl -s -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[{"path":"/users","method":"POST","body":{"name":"x"}}]}' | jq '.responses[0].status'126- curl -s -X POST https://api.your-app.test/batch -H "Content-Type: application/json" -d '{"requests":[]}'127128## References129- [JSON-RPC Specification](https://www.jsonrpc.org/specification)130- [GraphQL Queries](https://graphql.org/learn/queries/)131- [Google Batch API Design](https://google.aip.dev/231)