2428424081cn/skill-mcp/graphql-schema-design

Claude Code and agent skill by 2428424081cn/skill-mcp

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。

Install

npx vskill@latest install 2428424081cn/skill-mcp/graphql-schema-design

SKILL.md

The same SKILL.md was published earlier as 2428424081cn/skill-mcp/graphql-schema-design.

GraphQL Schema 设计与 DataLoader 性能优化

1. Relay 规范游标分页 (Cursor Pagination)

大数据量分页必须采用 Connection / Edge 规范,禁止使用脆弱的 Offset 分页:

graphql
type Query {
users(first: Int, after: String): UserConnection!
}
type UserConnection {
edges: [UserEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}
type UserEdge {
cursor: String!
node: User!
}
type PageInfo {
hasNextPage: Boolean!
endCursor: String
}

2. 强制使用 DataLoader 解决 N+1 问题

在 GraphQL 解析器遍历列表子字段时,严禁在 Resolver 中发起单条 SQL 查询,必须使用 DataLoader 批处理缓存:

ts
import DataLoader from 'dataloader';
export function createUserLoader(db: Database) {
return new DataLoader<string, User>(async (userIds) => {
const users = await db.users.findMany({ where: { id: { in: [...userIds] } } });
const map = new Map(users.map(u => [u.id, u]));
return userIds.map(id => map.get(id) || null);
});
}

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/2428424081cn/skill-mcp/graphql-schema-design/badge)](https://verified-skill.com/skills/2428424081cn/skill-mcp/graphql-schema-design)

Something wrong with this skill or its page? Tell us.