Skip to content
Back to skills

Architecture

ASecurity

Design of a GraphQL schema — nullability, DataLoader batching, cursor pagination, depth and cost limits, federation. Use when writing or reviewing a GraphQL API or fixing N+1 resolvers.

  • 24 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added October 14, 2026
ai-agentsgonodeapidatabasesecurity

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned November 22, 2026

npx -y skills add andreibesleaga/GABBE --skill architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Architecture?

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

Security grade badge for Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/andreibesleaga-architecture-c2c6fecd/badge)](https://www.skillsdirectory.com/skills/andreibesleaga-architecture-c2c6fecd)

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-schema
description: Design of a GraphQL schema — nullability, DataLoader batching, cursor pagination, depth and cost limits, federation. Use when writing or reviewing a GraphQL API or fixing N+1 resolvers.
triggers: [graphql schema, graphql, dataloader, n+1 resolvers, apollo federation, relay pagination]
tags: [architecture]
role: eng-api
context_cost: low
---
# graphql-schema Skill

## Goal
This skill prevents "Graph Spaghetti" and ensuring performant Graph APIs.

## Steps
## 1. Schema Design
- **Consumption-First**: Design for the UI needs, not the DB schema.
- **Naming**: `User.posts` (Good), `User.getPosts` (Bad - it's a field, not a method).
- **Nullability**:
  - Default to **Nullable** for fields (resilience: if one field fails, partial data returns).
  - Use **Non-Null (!)** only for IDs and essential arguments.

## 2. N+1 Problem (The Graph Killer)
- **Scenario**: Querying `users { posts { comments } }`.
- **Solution**: **DataLoader** pattern.
  - Batches IDs from multiple resolvers.
  - Runs *one* DB query: `SELECT * FROM posts WHERE user_id IN (1, 2, 3)`.
  - Distributes results back to resolvers.

## 3. Pagination
- Avoid `offset`/`limit`.
- Use **Relay Connection Specification** (Cursor-based):
  ```graphql
  users(first: 10, after: "cursor") {
    edges {
      node { name }
      cursor
    }
    pageInfo { hasNextPage }
  }
  ```

## 4. Security
- **Depth Limiting**: Block queries deeper than 5 levels (prevent cyclic recursion DoS).
- **Cost Analysis**: Assign points to fields. Block query if Cost > 1000.
- **Introspection**: Disable in Production.

## 5. Federation (Apollo)
- Use when splitting Graph across microservices.
- **Entity**: A type shared across subgraphs (`@key(fields: "id")`).
- **Gateway**: Composes the Supergraph.

## Constraints
- Design for what the UI needs, not for the database schema.
- Batch resolvers with DataLoader; no offset pagination.

## Output Format
The schema in SDL with notes on resolvers, limits and federation.

## Limits and safety
- The design carries depth, cost and pagination limits, and introspection is off in production; confirm the production setting with the human.
- Authorization sits in the field resolvers, not only at the HTTP endpoint; a sensitive field the user may not see returns an authorization error or is hidden, never `null`.
- Never put fields such as `passwordHash` into the schema.
- Mutations take idempotency keys, and rate limits count every mutation in a batched request.
- In federation, subgraphs authenticate the gateway and are not reachable directly.

Files in this skill

  • adaptive-architecture.skill.md3.7 KB
  • api-design.skill.md4.7 KB
  • api-standards.skill.md1.7 KB
  • arch-debt.skill.md8.2 KB
  • arch-design.skill.md12.6 KB
  • arch-patterns.skill.md3.9 KB
  • arch-review.skill.md14.1 KB
  • architecture-governance.skill.md3.6 KB
  • attribute-driven-design.skill.md7.5 KB
  • blockchain-dlt.skill.md1.9 KB
  • compatibility-design.skill.md3.6 KB
  • critical-systems-arch.skill.md2 KB
  • design-patterns.skill.md4.3 KB
  • diagramming.skill.md13.9 KB
  • domain-model.skill.md12.1 KB
  • enterprise-migration-scenario.skill.md2 KB
  • enterprise-patterns.skill.md1.9 KB
  • error-handling-strategy.skill.md3.9 KB
  • event-driven-architecture.skill.md1.8 KB
  • event-governance.skill.md3.4 KB

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.