Skip to content
Back to skills

Graphql

ASecurity

GraphQL API design, Apollo Federation, schema stitching, resolvers, N+1 query problem. Use when implementing GraphQL API, federation, or optimizing queries.

  • 105 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
ai-agentsjavascriptjavanodeapi

Works with

  • cursor
  • api

Security analysis

A100/100

Scanned September 5, 2026

npx -y skills add TheBeardedBearSAS/claude-craft --skill graphql --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Graphql?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Graphql
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thebeardedbearsas-graphql/badge)](https://www.skillsdirectory.com/skills/thebeardedbearsas-graphql)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: graphql
description: GraphQL API design, Apollo Federation, schema stitching, resolvers, N+1 query problem. Use when implementing GraphQL API, federation, or optimizing queries.
context: fork
  files: ["**/graphql/**", "**/*.graphql", "**/*.gql", "**/schema.gql"]
---

# 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

```graphql
# 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

```javascript
// ❌ 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)

```graphql
type UserConnection {
  edges: [{ node: User!, cursor: String! }]!
  pageInfo: { hasNextPage: Boolean!, endCursor: String }!
}
```

### Error Handling

```graphql
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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…