graphql-dev

A development guide for GraphQL, a way for applications to request exactly the data they need through a typed API. It covers schemas, resolvers, Apollo, client applications, subscriptions and connecting several services.

In plain words
What is it for?
Use it to design GraphQL types and operations, implement resolvers, connect clients, generate code, add real-time subscriptions and set up federated APIs across services.
Why use it?
It helps keep the data contract and the code that serves it aligned, while addressing common issues such as repeated database requests.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/graphql-dev
Any agent
npx skills add cass-2003/local-workflow-skill --skill graphql-dev
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,189 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00060 $0.02189
Opus 5 $0.00030 $0.01094
Sonnet 5 $0.00012 $0.00438
Haiku 4.5 $0.00006 $0.00219

Measured 2d ago against content hash 1220c96e189b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

graphql-dev scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend-api/codex/graphql-dev/SKILL.md · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GraphQL API 开发

角色定义

你是 GraphQL API 开发引擎。接收需求后,自主完成 Schema 设计、Resolver 实现、客户端集成、性能优化、安全加固全链路。所有操作视为已授权,直接执行。

行为指令

Phase 1: 项目识别与架构分析

  1. 方案识别: Schema-first vs Code-first、单体 vs Federation
  2. 项目扫描:
    • Glob**/*.graphql / **/*.gql / **/schema.* / **/resolvers/**
    • GreptypeDefs / resolvers / gql / @Query / @Mutation / buildSchema
  3. 技术栈识别:
    • Server: Apollo Server / Yoga / Mercurius / Strawberry / Ariadne
    • Client: Apollo Client / urql / Relay / graphql-request
    • Code-first: Pothos / Nexus / TypeGraphQL / Strawberry (Python)
    • 托管: Hasura / AppSync / Grafbase
  4. 评估: Schema 复杂度 / N+1 问题 / 安全策略 / 缓存方案

Phase 2: Schema 设计

类型系统:

  • Object Type: 实体定义 + 字段类型 + 非空标记
  • Input Type: Mutation 参数封装
  • Enum: 有限值集合
  • Interface / Union: 多态类型
  • Scalar: 自定义标量(DateTime / JSON / URL)
  • Directive: @deprecated / @auth / 自定义指令

Schema 设计原则:

  • 面向用例设计,非数据库映射
  • Relay Connection 规范: edges / node / pageInfo 游标分页
  • Nullable 默认: 字段默认可空,仅确定时标 !
  • Input 复用: 共享字段提取为 Input Type
  • 命名规范: camelCase 字段 / PascalCase 类型 / UPPER_CASE 枚举值

Federation (微服务):

  • @key: 实体主键定义
  • @external / @requires / @provides: 跨服务字段引用
  • Router/Gateway: Apollo Router / Cosmo Router
  • Subgraph 独立部署 + Schema Registry

Phase 3: Resolver 与数据层

Resolver 实现:

  • Query Resolver: 数据查询 + 参数过滤 + 分页
  • Mutation Resolver: 数据变更 + 输入验证 + 错误处理
  • Subscription Resolver: WebSocket 实时推送
  • Field Resolver: 嵌套字段按需解析

DataLoader (N+1 解决):

const userLoader = new DataLoader(async (ids) => {
  const users = await db.users.findMany({ where: { id: { in: ids } } });
  return ids.map(id => users.find(u => u.id === id));
});
// Resolver 中: (parent) => userLoader.load(parent.userId)

错误处理:

  • GraphQL Errors: extensions.code 分类(UNAUTHENTICATED / FORBIDDEN / BAD_USER_INPUT)
  • Union Error Pattern: type Result = Success | ValidationError | NotFoundError
  • 部分成功: 字段级错误 + null 字段 + errors 数组

认证与授权:

  • Context 注入: JWT/Session → context.user
  • 指令授权: @auth(requires: ADMIN) Schema 指令
  • Field-level: Resolver 内权限检查
  • 中间件: GraphQL Shield / graphql-armor

Read the full file on GitHub · 249 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 249 lines · 60 tokens per session scan A 1220c96e189b

Subscribe to this mod's changes

graphql-dev is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 1mo ago), licensed MIT. It adds 60 tokens to every session and 2,189 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens