graphql-yoga
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "graphql-yoga" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a789974dcaabbebc9564c1082383808e841acaf6dde84fc6ff82322d45aedb9a. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Expert guidance for GraphQL Yoga, for building production-grade GraphQL APIs using schema-first or code-first approaches. Covers file uploads, subscriptions, the Envelop plugin system, response caching and error masking, and deployment to any JavaScript runtime (e.g., Node.js, Deno, Bun, Cloudflare Workers, AWS Lambda).
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: graphql-yoga
description: >-
You are an expert in GraphQL Yoga, the batteries-included GraphQL server by
The Guild. You help developers build production GraphQL APIs with
schema-first or code-first approaches, file uploads, subscriptions, Envelop
plugin system, response caching, error masking, and deployment to any JS
runtime (Node.js, Deno, Bun, Cloudflare Workers, AWS Lambda) — the modern
alternative to Apollo Server.
license: Apache-2.0
compatibility: ''
metadata:
author: terminal-skills
version: 1.0.0
category: Backend Development
tags:
- graphql
- server
- api
- typescript
- envelop
- schema
- nodeGraphQL Yoga — Modern GraphQL Server
You are an expert in GraphQL Yoga, the batteries-included GraphQL server by The Guild. You help developers build production GraphQL APIs with schema-first or code-first approaches, file uploads, subscriptions, Envelop plugin system, response caching, error masking, and deployment to any JS runtime (Node.js, Deno, Bun, Cloudflare Workers, AWS Lambda) — the modern alternative to Apollo Server.
Core Capabilities
Server Setup
import { createSchema, createYoga } from "graphql-yoga";
import { createServer } from "http";
const yoga = createYoga({
schema: createSchema({
typeDefs: `
type Query {
users(limit: Int, offset: Int): [User!]!
user(id: ID!): User
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(id: ID!, input: UpdateUserInput!): User!
}
type Subscription {
newUser: User!
}
type User {
id: ID!
name: String!
email: String!
posts: [Post!]!
createdAt: String!
}
type Post {
id: ID!
title: String!
author: User!
}
input CreateUserInput { name: String!, email: String! }
input UpdateUserInput { name: String, email: String }
`,
resolvers: {
Query: {
users: (_, { limit = 10, offset = 0 }, ctx) =>
ctx.db.users.findAll({ limit, offset }),
user: (_, { id }, ctx) => ctx.db.users.findById(id),
},
Mutation: {
createUser: async (_, { input }, ctx) => {
const user = await ctx.db.users.create(input);
ctx.pubsub.publish("newUser", { newUser: user });
return user;
},
},
Subscription: {
newUser: {
subscribe: (_, __, ctx) => ctx.pubsub.subscribe("newUser"),
},
},
User: {
posts: (user, _, ctx) => ctx.db.posts.findByAuthor(user.id),
},
},
}),
context: ({ request }) => ({
db: database,
pubsub: pubSub,
user: authenticateRequest(request),
}),
maskedErrors: process.env.NODE_ENV === "production",
cors: { origin: ["https://app.example.com"], credentials: true },
graphiql: process.env.NODE_ENV !== "production",
});
const server = createServer(yoga);
server.listen(4000, () => console.log("GraphQL on http://localhost:4000/graphql"));
Envelop Plugins
import { useResponseCache } from "@graphql-yoga/plugin-response-cache";
import { useRateLimiter } from "@graphql-yoga/plugin-rate-limiter";
import { useDepthLimit } from "envelop-depth-limit";
const yoga = createYoga({
schema,
plugins: [
useResponseCache({
session: (req) => req.headers.get("authorization"),
ttl: 60_000, // 60s cache
invalidateViaMutation: true,
}),
useRateLimiter({
identifyFn: (ctx) => ctx.user?.id || ctx.request.headers.get("x-forwarded-for"),
max: 100,
window: "1m",
}),
useDepthLimit({ maxDepth: 10 }),
],
});
Installation
npm install graphql-yoga graphql
Best Practices
- Envelop plugins — Use the plugin system for auth, caching, rate limiting, logging; composable and reusable
- Response caching — Enable response cache for public queries; cache by session for authenticated queries
- Depth limiting — Set max query depth (10-15) to prevent abuse from deeply nested queries
- Error masking — Enable in production; prevents leaking internal error details to clients
- Subscriptions — Built-in SSE and WebSocket support; use PubSub for real-time updates
- File uploads — Native multipart support; no extra libraries needed for file upload mutations
- Any runtime — Deploy to Node.js, Deno, Bun, CF Workers, Lambda with the same code; runtime-agnostic
- DataLoader for N+1 — Use DataLoader in resolvers to batch database queries; prevents N+1 query problem
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 GraphQL Yoga 的完整开发支持,涵盖服务器搭建、插件系统、缓存、限流、订阅等生产级能力
- 面向后端开发者,解决构建现代 GraphQL API 的实际痛点,实用价值高
Highlights
- description 明确描述 Skill 为 GraphQL Yoga 专家,涵盖 schema-first/code-first、插件、部署等核心能力
- 触发词完整且边界清晰,用户可准确识别适用场景
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档未明确说明何时使用此 Skill,建议补充使用场景说明
Recommendation: 在文档开头或独立章节添加 When to Use,说明适合构建 GraphQL API、需要插件扩展、多运行时部署等场景
-
缺少端到端完整示例 Reported severity: Minor
代码示例为片段,缺少从初始化到运行的完整端到端示例
Recommendation: 补充一个完整的端到端示例,包括数据库连接、认证、插件配置、启动服务器全流程
-
文档略长 Reported severity: Minor
文档约 450 行,接近 500 行限制,可能影响阅读体验
Recommendation: 考虑将部分内容拆分为独立文件,或精简部分描述性文字
Highlights
- 文档结构清晰,分 Core Capabilities、Installation、Best Practices,逻辑性强
- frontmatter 完整,包含 name、description、license、metadata 等信息
Highlights
- 代码示例参数正确,涵盖主要异常处理(如错误屏蔽、深度限制)
- 工具来源明确(graphql-yoga 及相关插件),无不可逆操作,执行可靠性高
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 132 -
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 96
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- app.example.com
- localhost
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.