Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

graphql-architectGraphQL 架构师

Agent Skill

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

总安装

2,208

周安装

92

GitHub Stars

76

下载量

736
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill graphql-architect

简介

graphql-architect 协助设计 GraphQL API 架构,提升接口类型安全与查询效率。

  • 适用于 schema 设计、联邦服务集成、N+1 查询优化及实时订阅功能开发。
  • 可辅助梳理 endpoint、生成 OpenAPI 草稿或检查字段命名规范。
  • 使用时需确认真实业务语义与鉴权规则,避免凭空补字段或假设错误处理逻辑。
  • 建议从现有代码或 schema 中提取事实,确保接口文档准确反映实际结构。

SKILL.md

GraphQL Architect Skill

Purpose

Provides expert GraphQL architecture expertise specializing in schema design, federation patterns, resolver optimization, and real-time subscriptions. Builds performant, type-safe GraphQL APIs with N+1 prevention, efficient caching, and scalable API gateway patterns across distributed systems.

When to Use

  • Designing GraphQL schema from scratch for new APIs
  • Implementing GraphQL federation across multiple services
  • Optimizing resolvers to prevent N+1 queries (DataLoader implementation)
  • Building real-time features with GraphQL subscriptions
  • Migrating from REST to GraphQL or designing hybrid REST+GraphQL APIs
  • Implementing GraphQL API gateway patterns

Quick Start

Invoke this skill when:

  • Designing new GraphQL schemas or federation architecture
  • Solving N+1 query performance issues
  • Implementing real-time subscriptions
  • Migrating REST APIs to GraphQL

Do NOT invoke when:

  • Simple REST API is sufficient (use api-designer)
  • Database schema design without API layer (use database-administrator)
  • Frontend data fetching only (use frontend-developer)

Core Capabilities

Schema Design

  • Creating type-safe GraphQL schemas with best practices
  • Implementing pagination patterns (Relay, offset-based)
  • Designing mutations with input validation and error handling
  • Managing schema evolution and backward compatibility

Federation Architecture

  • Implementing Apollo Federation for microservices
  • Configuring schema stitching for service composition
  • Managing cross-service queries and mutations
  • Setting up API gateways for schema composition

Resolver Optimization

  • Implementing DataLoader for N+1 prevention
  • Caching strategies at resolver and field levels
  • Query complexity analysis and depth limiting
  • Persisted queries for production optimization

Real-Time Subscriptions

  • Implementing WebSocket-based subscriptions
  • Managing subscription lifecycle and cleanup
  • Integrating with event-driven backends
  • Handling subscription authentication and authorization

Decision Framework

GraphQL vs REST Decision Matrix

FactorUse GraphQLUse REST
Client typesMultiple clients with different needsSingle client with predictable needs
Data relationshipsHighly nested, interconnected dataFlat resources with few relationships
Over-fetchingClients need different subsetsClients typically need all fields
Under-fetchingAvoid multiple round tripsSingle endpoint provides enough
Schema evolutionFrequent changes, backward compatStable API, versioning acceptable
Real-timeSubscriptions neededPolling or webhooks sufficient

Schema Design Decision Tree

Schema Design Requirements
│
├─ Single service (monolith)?
│  └─ Schema-first design with single schema
│
├─ Multiple microservices?
│  ├─ Services owned by different teams?
│  │  └─ Apollo Federation
│  └─ Services owned by same team?
│     └─ Schema stitching (simpler)
│
├─ Existing REST APIs to wrap?
│  └─ GraphQL wrapper layer
│
└─ Need backward compatibility?
   └─ Hybrid REST + GraphQL

N+1 Prevention Strategy

Resolver Implementation
│
├─ Field resolves to single related entity?
│  └─ DataLoader with batching
│
├─ Field resolves to list of related entities?
│  ├─ List size always small (<10)?
│  │  └─ Direct query acceptable
│  └─ List size unbounded?
│     └─ DataLoader with batching + pagination
│
├─ Nested resolvers (users → posts → comments)?
│  └─ Multi-level DataLoaders
│
└─ Aggregations or counts?
   └─ Separate DataLoader for counts

Core Workflow: DataLoader Implementation

Problem: N+1 queries killing performance

// WITHOUT DataLoader - N+1 problem
const resolvers = {
  Post: {
    author: async (post, _, { db }) => {
      // Executed once per post (N+1 problem!)
      return db.User.findByPk(post.userId);
    }
  }
};
// Query for 100 posts triggers 101 DB queries

Solution: Batch with DataLoader

import DataLoader from 'dataloader';

// Create loader per request (important!)
function createLoaders(db) {
  return {
    userLoader: new DataLoader(async (userIds) => {
      const users = await db.User.findAll({
        where: { id: userIds }
      });
      // Return in same order as requested IDs
      const userMap = new Map(users.map(u => [u.id, u]));
      return userIds.map(id => userMap.get(id));
    })
  };
}

// Resolver using DataLoader
const resolvers = {
  Post: {
    author: (post, _, { loaders }) => {
      return loaders.userLoader.load(post.userId);
    }
  }
};
// Same query now triggers 2 queries total!

Quick Reference: Schema Best Practices

Pagination Pattern (Relay-style)

type Query {
  users(first: Int, after: String, last: Int, before: String): UserConnection!
}

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

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

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

Error Handling Pattern

type Mutation {
  createUser(input: CreateUserInput!): CreateUserPayload!
}

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

type UserError {
  field: String
  message: String!
  code: ErrorCode!
}

enum ErrorCode {
  VALIDATION_ERROR
  NOT_FOUND
  UNAUTHORIZED
  CONFLICT
}

Red Flags - When to Escalate

ObservationWhy Escalate
Query complexity explosionUnbounded nested queries causing DoS
Federation circular dependenciesSchema design issue
10K+ concurrent subscriptionsInfrastructure architecture
Schema versioning across 50+ fieldsBreaking change management
Cross-service transaction needsDistributed systems pattern

Additional Resources

- Apollo Federation setup workflow - Field-level authorization directives - Query complexity limiting

- Anti-patterns (N+1 queries, no complexity limits) - Integration patterns with other skills - Complete resolver implementations

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.23%
按下载量换算215

OpenCode

25.05%
按下载量换算184

Codex

16.82%
按下载量换算124

Cursor

12.83%
按下载量换算94

Gemini CLI

8.03%
按下载量换算59

windsurf

3.34%
按下载量换算25

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills