Token导航 LogoToken导航

Agent Skill · 研究检索

graphql(GraphQL 接口开发)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

graphql 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 11,221。

总安装 11,525周安装 490GitHub Stars 35,662下载 4,038核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:graphql(GraphQL 接口开发)
来源仓库:https://github.com/sickn33/antigravity-awesome-skills
仓库路径:skills/graphql
安装命令:
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill graphql
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill graphql

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

GraphQL 架构设计、解析器模式和生产安全最佳实践。

涵盖九个核心功能,包括架构设计、解析器、联合、订阅、DataLoader、代码生成以及适用于服务器和客户端的 Apollo 工具 强调关键的生产危害:N+1 查询问题、导致 DoS 的无限查询深度、内省暴露和不正确的授权范围 提供类型安全模式的模式,具有有意为空性、通过 DataLoader 进行批量查询优化以及规范化的客户端缓存 包括有关字段级授权、查询成本分析和订阅生命周期管理的前沿指南

来源仓库内路径:skills/graphql

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill gra…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

graphql 怎么安装?

在终端执行 npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill graphql。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

graphql 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

graphql 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

graphql 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

graphql 用的人多吗?

公开数据是累计安装 11,525 次,近一周安装 490 次,下载 4,038 次,GitHub 35,662 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

graphql 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
graphql

GraphQL 接口开发 · 本页

11,52535,662需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

GraphQL

GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server.

This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.

2025 lesson: GraphQL isn't always the answer. For simple CRUD, REST is simpler. For high-performance public APIs, REST with caching wins. Use GraphQL when you have complex data relationships and diverse client needs.

Principles

  • Schema-first design - the schema is the contract
  • Prevent N+1 queries with DataLoader
  • Limit query depth and complexity
  • Use fragments for reusable selections
  • Mutations should be specific, not generic update operations
  • Errors are data - use union types for expected failures
  • Nullability is meaningful - design it intentionally

Capabilities

  • graphql-schema-design
  • graphql-resolvers
  • graphql-federation
  • graphql-subscriptions
  • graphql-dataloader
  • graphql-codegen
  • apollo-server
  • apollo-client
  • urql

Scope

  • database-queries -> postgres-wizard
  • authentication -> authentication-oauth
  • rest-api-design -> backend
  • websocket-infrastructure -> backend

Tooling

Server

  • @apollo/server - When: Apollo Server v4 Note: Most popular GraphQL server
  • graphql-yoga - When: Lightweight alternative Note: Good for serverless
  • mercurius - When: Fastify integration Note: Fast, uses JIT

Client

  • @apollo/client - When: Full-featured client Note: Caching, state management
  • urql - When: Lightweight alternative Note: Smaller, simpler
  • graphql-request - When: Simple requests Note: Minimal, no caching

Tools

  • graphql-codegen - When: Type generation Note: Essential for TypeScript
  • dataloader - When: N+1 prevention Note: Batches and caches

Patterns

Schema Design

Type-safe schema with proper nullability

When to use: Designing any GraphQL API

SCHEMA DESIGN:

""" The schema is your API contract. Design nullability intentionally - non-null fields must always resolve. """

type Query {

Non-null - will always return user or throw

user(id: ID!): User!

Nullable - returns null if not found

userByEmail(email: String!): User

Non-null list with non-null items

users(limit: Int = 10, offset: Int = 0): [User!]!

Search with pagination

searchUsers(query: String! first: Int after: String): UserConnection!}

type Mutation {

Input types for complex mutations

createUser(input: CreateUserInput!): CreateUserPayload! updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload! deleteUser(id: ID!): DeleteUserPayload!}

type Subscription {userCreated: User! messageReceived(roomId: ID!): Message!}

Input types

input CreateUserInput {email: String! name: String! role: Role = USER}

input UpdateUserInput {email: String name: String role: Role}

Payload types (for errors as data)

type CreateUserPayload {user: User errors: [Error!]!}

union UpdateUserPayload = UpdateUserSuccess | NotFoundError | ValidationError

type UpdateUserSuccess {user: User!}

Enums

enum Role {USER ADMIN MODERATOR}

Types with relationships

type User {id: ID! email: String! name: String! role: Role! posts(limit: Int = 10): [Post!]! createdAt: DateTime!}

type Post {id: ID! title: String! content: String! author: User! comments: [Comment!]! published: Boolean!}

Pagination (Relay-style)

type UserConnection {edges: [UserEdge!]! pageInfo: PageInfo! totalCount: Int!}

type UserEdge {node: User! cursor: String!}

type PageInfo {hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String}

DataLoader for N+1 Prevention

Batch and cache database queries

When to use: Resolving relationships

DATALOADER:

""" Without DataLoader, fetching 10 posts with authors makes 11 queries (1 for posts + 10 for each author). DataLoader batches into 2 queries. """

import DataLoader from 'dataloader';

// Create loaders per request function createLoaders(db) {return {userLoader: new DataLoader(async (ids) => {// Single query for all users const users = await db.user.findMany({where: {id: {in: ids}}});

  // Return in same order as ids
  const userMap = new Map(users.map(u => [u.id, u]));
  return ids.map(id => userMap.get(id) || null);
}),

postsByAuthorLoader: new DataLoader(async (authorIds) => {
  const posts = await db.post.findMany({
    where: { authorId: { in: authorIds } }
  });

  // Group by author
  const postsByAuthor = new Map();
  posts.forEach(post => {
    const existing = postsByAuthor.get(post.authorId) || [];
    postsByAuthor.set(post.authorId, [...existing, post]);
  });

  return authorIds.map(id => postsByAuthor.get(id) || []);
})

};}

// Attach to context const server = new ApolloServer({typeDefs, resolvers,});

app.use('/graphql', expressMiddleware(server, {context: async ({req}) => ({db, loaders: createLoaders(db), user: req.user})}));

// Use in resolvers const resolvers = {Post: {author: (post, _, {loaders}) => {return loaders.userLoader.load(post.authorId);}}, User: {posts: (user, _, {loaders}) => {return loaders.postsByAuthorLoader.load(user.id);}}};

Apollo Client Caching

Normalized cache with type policies

When to use: Client-side data management

APOLLO CLIENT CACHING:

""" Apollo Client normalizes responses into a flat cache. Configure type policies for custom cache behavior. """

import {ApolloClient, InMemoryCache} from '@apollo/client';

const cache = new InMemoryCache({typePolicies: {Query: {fields: {// Paginated field users: {keyArgs: ['query'], // Cache separately per query merge(existing = {edges: []}, incoming, {args}) {// Append for infinite scroll if (args?.after) {return {...incoming, edges: [...existing.edges,...incoming.edges]};} return incoming;}}}}, User: {keyFields: ['id'], // How to identify users fields: {fullName: {read(_, {readField}) {// Computed field return ${readField('firstName')} ${readField('lastName')};}}}}}});

const client = new ApolloClient({uri: '/graphql', cache, defaultOptions: {watchQuery: {fetchPolicy: 'cache-and-network'}}});

// Queries with hooks import {useQuery, useMutation} from '@apollo/client';

const GET_USER = gqlquery GetUser($id: ID!) {user(id: $id) {id name email}};

function UserProfile({userId}) {const {data, loading, error} = useQuery(GET_USER, {variables: {id: userId}});

if (loading) return; if (error) return;

return {data.user.name};}

// Mutations with cache updates const CREATE_USER = gqlmutation CreateUser($input: CreateUserInput!) {createUser(input: $input) {user {id name email} errors {field message}}};

function CreateUserForm() {const [createUser, {loading}] = useMutation(CREATE_USER, {update(cache, {data: {createUser}}) {// Update cache after mutation if (createUser.user) {cache.modify({fields: {users(existing = []) {const newRef = cache.writeFragment({data: createUser.user, fragment: gqlfragment NewUser on User {id name email}}); return [...existing, newRef];}}});}}});}

Code Generation

Type-safe operations from schema

When to use: TypeScript projects

GRAPHQL CODEGEN:

""" Generate TypeScript types from your schema and operations. No more manually typing query responses. """

Install

npm install -D @graphql-codegen/cli npm install -D @graphql-codegen/typescript npm install -D @graphql-codegen/typescript-operations npm install -D @graphql-codegen/typescript-react-apollo

codegen.ts

import type {CodegenConfig} from '@graphql-codegen/cli';

const config: CodegenConfig = {schema: 'http://localhost:4000/graphql', documents: ['src/**/*.graphql', 'src/**/*.tsx'], generates: {'./src/generated/graphql.ts': {plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'], config: {withHooks: true, withComponent: false}}}};

export default config;

Run generation

npx graphql-codegen

Usage - fully typed!

import {useGetUserQuery, useCreateUserMutation} from './generated/graphql';

function UserProfile({userId}: {userId: string}) {const {data, loading} = useGetUserQuery({variables: {id: userId} // Type-checked!});

// data.user is fully typed return {data?.user?.name};}

Error Handling with Unions

Expected errors as data, not exceptions

When to use: Operations that can fail in expected ways

ERRORS AS DATA:

""" Use union types for expected failure cases. GraphQL errors are for unexpected failures. """

Schema

type Mutation {login(email: String!, password: String!): LoginResult!}

union LoginResult = LoginSuccess | InvalidCredentials | AccountLocked

type LoginSuccess {user: User! token: String!}

type InvalidCredentials {message: String!}

type AccountLocked {message: String! unlockAt: DateTime}

Resolver

const resolvers = {Mutation: {login: async (_, {email, password}, {db}) => {const user = await db.user.findByEmail(email);

  if (!user || !await verifyPassword(password, user.hash)) {
    return {
      __typename: 'InvalidCredentials',
      message: 'Invalid email or password'
    };
  }

  if (user.lockedUntil && user.lockedUntil > new Date()) {
    return {
      __typename: 'AccountLocked',
      message: 'Account temporarily locked',
      unlockAt: user.lockedUntil
    };
  }

  return {
    __typename: 'LoginSuccess',
    user,
    token: generateToken(user)
  };
}

},

LoginResult: {__resolveType(obj) {return obj.__typename;}}};

Client query

const LOGIN = gqlmutation Login($email: String!, $password: String!) {login(email: $email, password: $password) {... on LoginSuccess {user {id name} token}... on InvalidCredentials {message}... on AccountLocked {message unlockAt}}};

// Handle all cases const result = data.login; switch (result.__typename) {case 'LoginSuccess': setToken(result.token); redirect('/dashboard'); break; case 'InvalidCredentials': setError(result.message); break; case 'AccountLocked': setError(${result.message}. Try again at ${result.unlockAt}); break;}

Sharp Edges

Each resolver makes separate database queries

Severity: CRITICAL

Situation: You write resolvers that fetch data individually. A query for 10 posts with authors makes 11 database queries. For 100 posts, that's 101 queries. Response time becomes seconds.

Symptoms:

  • Slow API responses
  • Many similar database queries in logs
  • Performance degrades with list size

Why this breaks: GraphQL resolvers run independently. Without batching, the author resolver runs separately for each post. The database gets hammered with repeated similar queries.

Recommended fix:

USE DATALOADER

import DataLoader from 'dataloader';

// Create loader per request const userLoader = new DataLoader(async (ids) => {const users = await db.user.findMany({where: {id: {in: ids}}}); // IMPORTANT: Return in same order as input ids const userMap = new Map(users.map(u => [u.id, u])); return ids.map(id => userMap.get(id));});

// Use in resolver const resolvers = {Post: {author: (post, _, {loaders}) => loaders.userLoader.load(post.authorId)}};

Key points:

1. Create new loaders per request (for caching scope)

2. Return results in same order as input IDs

3. Handle missing items (return null, not skip)

Deeply nested queries can DoS your server

Severity: CRITICAL

Situation: Your schema has circular relationships (user.posts.author.posts...). A client sends a query 20 levels deep. Your server tries to resolve it and either times out or crashes.

Symptoms:

  • Server timeouts on certain queries
  • Memory exhaustion
  • Slow response for nested queries

Why this breaks: GraphQL allows clients to request any valid query shape. Without limits, a malicious or buggy client can craft queries that require exponential work. Even legitimate queries can accidentally be too deep.

Recommended fix:

LIMIT QUERY DEPTH AND COMPLEXITY

import depthLimit from 'graphql-depth-limit'; import {createComplexityLimitRule} from 'graphql-validation-complexity';

const server = new ApolloServer({typeDefs, resolvers, validationRules: [// Limit nesting depth depthLimit(10),

// Limit query complexity
createComplexityLimitRule(1000, {
  scalarCost: 1,
  objectCost: 2,
  listFactor: 10
})

]});

Also consider:

- Query timeout limits

- Rate limiting per client

- Persisted queries (only allow pre-registered queries)

Introspection enabled in production exposes your schema

Severity: HIGH

Situation: You deploy to production with introspection enabled. Anyone can query your schema, discover all types, mutations, and field names. Attackers know exactly what to target.

Symptoms:

  • Schema visible via introspection query
  • GraphQL Playground accessible in production
  • Full type information exposed

Why this breaks: Introspection is essential for development and tooling, but in production it's a roadmap for attackers. They can find admin mutations, internal fields, and deprecated but still working APIs.

Recommended fix:

DISABLE INTROSPECTION IN PRODUCTION

const server = new ApolloServer({typeDefs, resolvers, introspection: process.env.NODE_ENV!== 'production', plugins: [process.env.NODE_ENV === 'production'? ApolloServerPluginLandingPageDisabled(): ApolloServerPluginLandingPageLocalDefault()]});

Better: Use persisted queries

Only allow pre-registered queries in production

const server = new ApolloServer({typeDefs, resolvers, persistedQueries: {cache: new InMemoryLRUCache()}});

Authorization only in schema directives, not resolvers

Severity: HIGH

Situation: You rely entirely on @auth directives for authorization. Someone finds a way around the directive, or complex business rules don't fit in a simple directive. Authorization fails.

Symptoms:

  • Unauthorized access to data
  • Business rules not enforced
  • Directive-only security bypassed

Why this breaks: Directives are good for simple checks but can't handle complex business logic. "User can edit their own posts, or any post in groups they moderate" doesn't fit in a directive.

Recommended fix:

AUTHORIZE IN RESOLVERS

// Simple check in resolver Mutation: {deletePost: async (_, {id}, {user, db}) => {if (!user) {throw new AuthenticationError('Must be logged in');}

const post = await db.post.findUnique({ where: { id } });

if (!post) {
  throw new NotFoundError('Post not found');
}

// Business logic authorization
const canDelete =
  post.authorId === user.id ||
  user.role === 'ADMIN' ||
  await userModeratesGroup(user.id, post.groupId);

if (!canDelete) {
  throw new ForbiddenError('Cannot delete this post');
}

return db.post.delete({ where: { id } });

}}

// Helper for field-level authorization User: {email: (user, _, {currentUser}) => {// Only show email to self or admin if (currentUser?.id === user.id || currentUser?.role === 'ADMIN') {return user.email;} return null;}}

Authorization on queries but not on fields

Severity: HIGH

Situation: You check if a user can access a resource, but not individual fields. User A can see User B's public profile, and accidentally also sees their private email and phone number.

Symptoms:

  • Sensitive data exposed
  • Privacy violations
  • Field data visible to wrong users

Why this breaks: Field resolvers run after the parent is returned. If the parent query returns a user, all fields are resolved - including sensitive ones. Each sensitive field needs its own auth check.

Recommended fix:

FIELD-LEVEL AUTHORIZATION

const resolvers = {User: {// Public fields - no check needed id: (user) => user.id, name: (user) => user.name,

// Private fields - check access
email: (user, _, { currentUser }) => {
  if (!currentUser) return null;
  if (currentUser.id === user.id) return user.email;
  if (currentUser.role === 'ADMIN') return user.email;
  return null;
},

phoneNumber: (user, _, { currentUser }) => {
  if (currentUser?.id !== user.id) return null;
  return user.phoneNumber;
},

// Or throw instead of returning null
privateData: (user, _, { currentUser }) => {
  if (currentUser?.id !== user.id) {
    throw new ForbiddenError('Not authorized');
  }
  return user.privateData;
}

}};

Non-null field failure nullifies entire parent

Severity: MEDIUM

Situation: You make fields non-null for convenience. A resolver throws or returns null. The error propagates up, nullifying parent objects, until the whole query response is null or errors out.

Symptoms:

  • Queries return null unexpectedly
  • One error affects unrelated fields
  • Partial data can't be returned

Why this breaks: GraphQL's null propagation means if a non-null field can't resolve, its parent becomes null. If that parent is also non-null, it propagates further. One failing field can break an entire response.

Recommended fix:

DESIGN NULLABILITY INTENTIONALLY

WRONG: Everything non-null

type User {id: ID! name: String! email: String! avatar: String! # What if no avatar? lastLogin: DateTime! # What if never logged in?}

RIGHT: Nullable where appropriate

type User {id: ID! # Always exists name: String! # Required field email: String! # Required field avatar: String # Optional - may not exist lastLogin: DateTime # Nullable - may be null}

For lists:

[User!]! - Non-null list of non-null users (recommended)

[User!] - Nullable list of non-null users

[User]! - Non-null list of nullable users (rarely useful)

[User] - Nullable list of nullable users (avoid)

Rule of thumb:

- Non-null if always present and failure should fail query

- Nullable if optional or failure shouldn't break response

Expensive queries treated same as cheap ones

Severity: MEDIUM

Situation: Every query is processed the same. A simple user(id) query uses the same resources as users(first: 1000) {posts {comments}}. Expensive queries starve out cheap ones.

Symptoms:

  • Expensive queries slow everything
  • No way to prioritize queries
  • Rate limiting is ineffective

Why this breaks: Not all GraphQL operations are equal. Fetching 1000 users with nested data is orders of magnitude more expensive than fetching one user. Without cost analysis, you can't rate limit properly.

Recommended fix:

QUERY COST ANALYSIS

import {createComplexityLimitRule} from 'graphql-validation-complexity';

// Define complexity per field const complexityRules = createComplexityLimitRule(1000, {scalarCost: 1, objectCost: 10, listFactor: 10, // Custom field costs fieldCost: {'Query.searchUsers': 100, 'Query.analytics': 500, 'User.posts': ({args}) => args.limit || 10}});

// For rate limiting by cost const costPlugin = {requestDidStart() {return {didResolveOperation({request, document}) {const cost = calculateQueryCost(document); if (cost > 1000) {throw new Error(Query too expensive: ${cost});} // Track cost for rate limiting rateLimiter.consume(request.userId, cost);}};}};

Subscriptions not properly cleaned up

Severity: MEDIUM

Situation: Clients subscribe but don't unsubscribe cleanly. Network issues leave orphaned subscriptions. Server memory grows as dead subscriptions accumulate.

Symptoms:

  • Memory usage grows over time
  • Dead connections accumulate
  • Server slows down

Why this breaks: Each subscription holds server resources. Without proper cleanup on disconnect, resources accumulate. Long-running servers eventually run out of memory.

Recommended fix:

PROPER SUBSCRIPTION CLEANUP

import {PubSub, withFilter} from 'graphql-subscriptions'; import {WebSocketServer} from 'ws'; import {useServer} from 'graphql-ws/lib/use/ws';

const pubsub = new PubSub();

// Track active subscriptions const activeSubscriptions = new Map();

const wsServer = new WebSocketServer({server: httpServer, path: '/graphql'});

useServer({schema, context: (ctx) => ({pubsub, userId: ctx.connectionParams?.userId}), onConnect: (ctx) => {console.log('Client connected');}, onDisconnect: (ctx) => {// Clean up resources for this connection const userId = ctx.connectionParams?.userId; activeSubscriptions.delete(userId);}}, wsServer);

// Subscription resolver with cleanup Subscription: {messageReceived: {subscribe: withFilter((_, {roomId}, {pubsub, userId}) => {// Track subscription activeSubscriptions.set(userId, roomId); return pubsub.asyncIterator(ROOM_${roomId});}, (payload, {roomId}) => {return payload.roomId === roomId;})}}

Validation Checks

Introspection enabled in production

Severity: WARNING

Message: Introspection should be disabled in production

Fix action: Set introspection: process.env.NODE_ENV!== 'production'

Direct database query in resolver

Severity: WARNING

Message: Consider using DataLoader to batch and cache queries

Fix action: Create DataLoader and use.load() instead of direct query

No query depth limiting

Severity: WARNING

Message: Consider adding depth limiting to prevent DoS

Fix action: Add validationRules: [depthLimit(10)]

Resolver without try-catch

Severity: INFO

Message: Consider wrapping resolver logic in try-catch

Fix action: Add error handling to provide better error messages

JSON or Any type in schema

Severity: INFO

Message: Avoid JSON/Any types - they bypass GraphQL's type safety

Fix action: Define proper input/output types

Mutation returns bare type instead of payload

Severity: INFO

Message: Consider using payload types for mutations (includes errors)

Fix action: Create CreateUserPayload type with user and errors fields

List field without pagination arguments

Severity: INFO

Message: List fields should have pagination (limit, first, after)

Fix action: Add arguments: field(limit: Int, offset: Int): [Type!]!

Query hook without error handling

Severity: INFO

Message: Handle query errors in UI

Fix action: Destructure and handle error: const {error} = useQuery(...)

Using refetch instead of cache update

Severity: INFO

Message: Consider cache update instead of refetch for better UX

Fix action: Use update function to modify cache directly

Collaboration

Delegation Triggers

  • user needs database optimization -> postgres-wizard (Optimize queries for GraphQL resolvers)
  • user needs authentication system -> authentication-oauth (Auth for GraphQL context)
  • user needs caching layer -> caching-strategies (Response caching, DataLoader caching)
  • user needs real-time infrastructure -> backend (WebSocket setup for subscriptions)

Related Skills

Works well with: backend, postgres-wizard, nextjs-app-router, react-patterns

When to Use

  • User mentions or implies: graphql
  • User mentions or implies: graphql schema
  • User mentions or implies: graphql resolver
  • User mentions or implies: apollo server
  • User mentions or implies: apollo client
  • User mentions or implies: graphql federation
  • User mentions or implies: dataloader
  • User mentions or implies: graphql codegen
  • User mentions or implies: graphql query
  • User mentions or implies: graphql mutation

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

平台分布

Claude Code

30.57%
按下载量换算1,234

OpenCode

22.48%
按下载量换算908

Gemini CLI

15.18%
按下载量换算613

Antigravity

13.48%
按下载量换算544

Cursor

7.15%
按下载量换算289

Codex

3.61%
按下载量换算146

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills