mcpField
G
graphql

graphql

github.com/thebeardedbearsasDevelopment108114 installsUpdated today
Repository

About graphql

A GraphQL reference skill covering federation, schema patterns, DataLoader, and query optimization. It is for developers designing APIs that span services or need guidance on performance and query controls.

Key features

  1. 01Apollo Federation service composition
  2. 02DataLoader batching and caching
  3. 03Relay pagination and error patterns
  4. 04Persisted queries and query limits

Use cases

  1. 01Compose GraphQL services through a gateway
  2. 02Reduce N+1 database queries
  3. 03Design paginated GraphQL responses
  4. 04Add query depth and cost controls

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/thebeardedbearsas/claude-craft --skill graphql

After installing, type/graphqlin Claude Code to confirm it loaded.

Details

From the project README

GraphQL — Apollo Federation, Schema Design

API GraphQL moderne avec federation, DataLoader, optimisations.

GraphQL vs REST

GraphQL — 1 query sur-mesure, no versioning, introspection auto
REST — Multiple endpoints, over-fetching, v1/v2/v3

Apollo Federation

# Users service
type User @key(fields: "id") { id: ID!, name: String! }

# Orders service
extend type User @key(fields: "id") {
  id: ID! @external
  orders: [Order!]!
}

Gateway compose automatiquement les services.

N+1 Problem — DataLoader

// ❌ N+1 queries
User: { orders: (u) => db.orders.findByUserId(u.id) }

// ✅ DataLoader batch
const loader = new DataLoader(async (ids) => {
  const orders = await db.orders.findByUserIds(ids);
  return ids.map(id => orders.filter(o => o.userId === id));
});
User: { orders: (u) => loader.load(u.id) }

Patterns

Pagination (Relay)
type UserConnection {
  edges: [{ node: User!, cursor: String! }]!
  pageInfo: { hasNextPage: Boolean!, endCursor: String }!
}
Error Handling
type CreateUserPayload {
  user: User
  errors: [{ field: String, message: String! }]
}

Optimizations

DataLoader — Batch + cache
Persisted Queries — Hash lookup
Depth Limiting — Anti-DoS
Cost Analysis — Query budget


Voir @api-designer pour design

Comments

Markdown supported