用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-graphql --skill graphql-fundamentals命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | graphql-fundamentals |
| description | Master GraphQL core concepts - types, queries, mutations, and subscriptions |
| sasmp_version | 1.3.0 |
| bonded_agent | 01-graphql-fundamentals |
| bond_type | PRIMARY_BOND |
| version | 2.0.0 |
| complexity | beginner |
| estimated_time | 2-4 hours |
| prerequisites | [] |
Master the building blocks of GraphQL APIs
This skill covers the essential GraphQL concepts every developer needs. From type definitions to query operations, you'll learn the foundation for building GraphQL APIs.
| Concept | Syntax | Example |
|---|---|---|
| Scalar | String, Int, Float, Boolean, ID | name: String! |
| Object | type Name { fields } | type User { id: ID! } |
| Input | input Name { fields } | input CreateUserInput { name: String! } |
| Enum | enum Name { VALUES } | enum Status { ACTIVE INACTIVE } |
| List | [Type] or [Type!]! | tags: [String!]! |
| Non-null | Type! | id: ID! |
# Scalar types (built-in)
type Example {
id: ID! # Unique identifier
name: String! # Text
age: Int # Integer (nullable)
score: Float! # Decimal
active: Boolean
DateTime
JSON
Upload
User
ID
String
Profile
Post
Profile
String
String
UserRole
ADMIN
EDITOR
VIEWER
CreateUserInput
String
String
UserRole VIEWER
Node
ID
User implements Node
ID
String
SearchResult User Post Comment
# Schema definition
type Query {
# Single item
user(id: ID!): User
# List with optional filter
users(filter: UserFilter, limit: Int = 10): [User!]!
# Search
search(query: String!): [SearchResult!]!
}
# Client query examples
query GetUser {
user(id: "123") {
id
name
email
}
}
query GetUsersWithFilter {
users(filter: { role: ADMIN }, limit: 5) {
id
name
}
}
# With variables
query GetUser($userId: ID!) {
user(id: $userId) {
id
name
}
}
# Variables: { "userId": "123" }
# With aliases
query GetTwoUsers {
admin: user(id: "1") { name }
editor: user(id: "2") { name }
}
# With fragments
fragment UserFields on User {
id
name
email
}
query GetUsers {
users {
...UserFields
}
}
# Schema definition
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
updateUser(id: ID!, input: UpdateUserInput!): User!
deleteUser(id: ID!): DeletePayload!
}
type CreateUserPayload {
user: User
errors: [Error!]!
}
# Client mutation
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) {
user {
id
name
}
errors {
field
message
}
}
}
# Variables: { "input": { "email": "test@example.com", "name": "Test" } }
# Schema definition
type Subscription {
userCreated: User!
messageReceived(channelId: ID!): Message!
}
# Client subscription
subscription OnUserCreated {
userCreated {
id
name
createdAt
}
}
subscription OnMessage($channelId: ID!) {
messageReceived(channelId: $channelId) {
id
content
sender { name }
}
}
type Example {
# Required field - never null
id: ID!
# Optional field - can be null
nickname: String
# Required list, optional items
tags: [String]! # [], ["a", null, "b"]
# Required list, required items (most common)
categories: [Category!]! # [], [cat1, cat2]
# Optional list (avoid - ambiguous)
# items: [Item] # null vs [] unclear
}
input CreateUserInput {
email: String! # Required
name: String! # Required
age: Int # Optional
role: UserRole = VIEWER # Optional with default
}
| Error | Cause | Solution |
|---|---|---|
Cannot query field "x" | Field not in schema | Check spelling, verify schema |
Variable "$x" not defined | Missing variable declaration | Add to query signature |
Expected non-null, got null | Resolver returned null for ! field | Fix resolver or make nullable |
Unknown type "X" | Type not defined | Add type definition |
# Validate schema
npx graphql-inspector validate schema.graphql
# Introspect remote schema
npx graphql-inspector introspect http://localhost:4000/graphql
# Check for breaking changes
npx graphql-inspector diff old.graphql new.graphql
Skill("graphql-fundamentals")
graphql-schema-design - Advanced schema patternsgraphql-resolvers - Implementing resolversgraphql-codegen - TypeScript type generation01-graphql-fundamentals - For detailed guidance基于 SOC 职业分类