api-graphql-mercurius

Installation
SKILL.md

GraphQL with Mercurius

Quick Guide: Use Mercurius as a Fastify plugin for GraphQL APIs with built-in loader batching (solves N+1), JIT query compilation, subscriptions via WebSocket, and federation support. Register with app.register(mercurius, { schema, resolvers, loaders }). Loaders are Mercurius's killer feature: define them per-type to batch field resolution automatically. Use jit: 1 to enable query compilation for production performance.


<critical_requirements>

CRITICAL: Before Using This Skill

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST define loaders for any field that fetches related data — loaders solve the N+1 problem automatically through batching)

(You MUST use named constants for all numeric values — JIT thresholds, query depth limits, port numbers)

(You MUST return an array from loaders matching the exact length and order of the queries parameter)

(You MUST use fastify.graphql.pubsub.publish() inside mutations to trigger subscriptions — not external pubsub directly)

Installs
5
GitHub Stars
23
First Seen
Jul 25, 2026
api-graphql-mercurius — agents-inc/skills