Optimize Linear API queries, caching, and batching for performance.
Use when improving response times, reducing API calls,
or implementing caching strategies for Linear data.
Trigger: "linear performance", "optimize linear", "linear caching",
"linear slow queries", "speed up linear", "linear N+1".
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Optimize Linear API queries, caching, and batching for performance.
Use when improving response times, reducing API calls,
or implementing caching strategies for Linear data.
Trigger: "linear performance", "optimize linear", "linear caching",
"linear slow queries", "speed up linear", "linear N+1".
allowed-tools
Read, Write, Edit, Grep
version
1.12.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","linear","api","performance"]
compatibility
Designed for Claude Code, also compatible with Codex and OpenClaw
Linear Performance Tuning
Overview
Optimize Linear API usage for minimal latency and efficient resource consumption. The three main levers are: (1) query flattening to avoid N+1 and reduce complexity, (2) caching static data with webhook-driven invalidation, and (3) batching mutations into single GraphQL requests.
Key numbers:
Query complexity budget: 250,000 pts/hour, max 10,000 per query
Each property: 0.1 pt, each object: 1 pt, connections: multiply by first
Best practice: sort by updatedAt to get fresh data first
Prerequisites
Working Linear integration with @linear/sdk
Understanding of GraphQL query structure
Optional: Redis for distributed caching
Instructions
Step 1: Eliminate N+1 Queries
The SDK lazy-loads relations. Accessing .assignee on 50 issues makes 50 separate API calls.
import { LinearClient } from"@linear/sdk";
const client = newLinearClient({ apiKey: process.env.LINEAR_API_KEY! });
// BAD: N+1 — 1 query for issues + 50 for assignees + 50 for states = 101 requestsconst issues = await client.issues({ first: 50 });
for (const i of issues.nodes) {
const assignee = await i.assignee; // API call!const state = await i.state; // API call!console.log();
}
response = client..(, { : });