skills/graphql/SKILL.md
GraphQL schema design, queries, mutations, and tooling. Use when user asks to "write a GraphQL schema", "create a query", "add a mutation", "set up Apollo", "GraphQL resolver", "type definitions", or any GraphQL tasks.
npx skillsauth add 1mangesh1/dev-skills-collection graphqlInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Schema design, queries, mutations, and tooling.
# Type definitions
type User {
id: ID!
email: String!
name: String
posts: [Post!]!
createdAt: DateTime!
}
type Post {
id: ID!
title: String!
content: String
published: Boolean!
author: User!
tags: [Tag!]!
}
type Tag {
id: ID!
name: String!
posts: [Post!]!
}
# Input types
input CreateUserInput {
email: String!
name: String
}
input UpdateUserInput {
email: String
name: String
}
input PostFilter {
published: Boolean
authorId: ID
search: String
}
# Enums
enum Role {
ADMIN
USER
MODERATOR
}
enum SortOrder {
ASC
DESC
}
# Custom scalars
scalar DateTime
scalar JSON
# Interfaces
interface Node {
id: ID!
}
type User implements Node {
id: ID!
email: String!
}
# Unions
union SearchResult = User | Post | Tag
type Query {
# Single item
user(id: ID!): User
post(id: ID!): Post
# Lists with filtering and pagination
users(
filter: UserFilter
limit: Int = 20
offset: Int = 0
orderBy: SortOrder = DESC
): UserConnection!
posts(
filter: PostFilter
first: Int
after: String
): PostConnection!
# Search
search(query: String!): [SearchResult!]!
# Current user
me: User
}
# Cursor-based pagination
type UserConnection {
edges: [UserEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}
type UserEdge {
node: User!
cursor: String!
}
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}
# Basic query
query {
user(id: "1") {
name
email
}
}
# With variables
query GetUser($id: ID!) {
user(id: $id) {
name
email
posts {
title
published
}
}
}
# Fragment
fragment UserFields on User {
id
name
email
}
query {
user(id: "1") {
...UserFields
posts {
title
}
}
}
# Pagination
query GetPosts($first: Int!, $after: String) {
posts(first: $first, after: $after) {
edges {
node {
id
title
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(id: ID!, input: UpdateUserInput!): User!
deleteUser(id: ID!): Boolean!
createPost(input: CreatePostInput!): Post!
publishPost(id: ID!): Post!
login(email: String!, password: String!): AuthPayload!
}
type AuthPayload {
token: String!
user: User!
}
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) {
id
email
name
}
}
# Variables:
# { "input": { "email": "[email protected]", "name": "Alice" } }
mutation Login($email: String!, $password: String!) {
login(email: $email, password: $password) {
token
user {
id
name
}
}
}
type Subscription {
postCreated: Post!
messageReceived(channelId: ID!): Message!
}
# Client usage
subscription OnPostCreated {
postCreated {
id
title
author {
name
}
}
}
const resolvers = {
Query: {
user: (_, { id }, context) => context.db.user.findUnique({ where: { id } }),
users: (_, { filter, limit, offset }, context) =>
context.db.user.findMany({ where: filter, take: limit, skip: offset }),
me: (_, __, context) => context.currentUser,
},
Mutation: {
createUser: (_, { input }, context) =>
context.db.user.create({ data: input }),
updateUser: (_, { id, input }, context) =>
context.db.user.update({ where: { id }, data: input }),
},
User: {
posts: (user, _, context) =>
context.db.post.findMany({ where: { authorId: user.id } }),
},
};
# Union-based errors
type CreateUserResult = CreateUserSuccess | ValidationError | EmailTakenError
type CreateUserSuccess {
user: User!
}
type ValidationError {
message: String!
field: String!
}
type EmailTakenError {
message: String!
suggestedEmail: String
}
type Mutation {
createUser(input: CreateUserInput!): CreateUserResult!
}
For Apollo, Relay, and testing patterns: references/tooling.md
tools
Parallel execution with xargs, GNU parallel, and batch processing patterns. Use when user mentions "xargs", "parallel", "batch processing", "run in parallel", "parallel execution", "process list of files", "bulk operations", "concurrent commands", "map over files", or running commands on multiple inputs.
development
WebSocket implementation for real-time bidirectional communication. Use when user mentions "websocket", "ws://", "wss://", "real-time", "live updates", "chat application", "socket.io", "Server-Sent Events", "SSE", "push notifications", "live data", "streaming data", "bidirectional communication", "websocket server", "reconnection", or building real-time features.
tools
Frontend bundler configuration for Webpack and Vite. Use when user mentions "webpack", "vite", "bundler", "vite config", "webpack config", "code splitting", "tree shaking", "hot module replacement", "HMR", "build optimization", "bundle size", "chunk splitting", "loader", "plugin", "esbuild", "rollup", "dev server", or configuring JavaScript build tools.
tools
VS Code configuration, extensions, keybindings, and workspace optimization. Use when user mentions "vscode", "vs code", "vscode settings", "vscode extensions", "keybindings", "code editor", "workspace settings", "settings.json", "launch.json", "tasks.json", "vscode snippets", "devcontainer", "remote development", or customizing their VS Code setup.