Skip to content
Agentmart
Submit a tool

graphql-schema-design

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

Skill by 2428424081cn

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/2428424081cn-graphql-schema-design

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

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

Use cases: design, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/graphql-schema-design

What's inside

Skill name
graphql-schema-design
Description
GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。
License
MIT
Instructions
43 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • skill.json

SKILL.md (first lines)

# 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);
  });
}
```

From 2428424081cn/Skill-mcp, MIT.

More from 2428424081cn/Skill-mcp

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Aug 24, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from 2428424081cn

Cite this page

graphql-schema-design skill. Agent Mart. https://agentmart.dev/skills/2428424081cn-graphql-schema-design (last updated 2026-10-24)