x-review-graphql
Validates GraphQL schema design, resolver implementation, security patterns, and observability for compliance with best practices.
- License 许可
- MIT
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- x-review-graphql
- description
- Validates GraphQL schema design, resolver implementation, security patterns, and observability for compliance with best practices.
- allowed-tools
- Read, Grep, Glob, Bash
- argument-hint
- [schema-file or resolver-name]
- user-invocable
- true
- requires-capabilities
- []
02 资源文件 1
- 参考文档README.md1.2 KB
03 SKILL.md 正文
Global Output Policy
- Language: English ONLY.
- Tone: Technical, Direct, and Concise.
- Efficiency: Remove all conversational fillers and greetings to save tokens.
Skill: GraphQL Schema & Resolver Review
Purpose
Review GraphQL schema design, resolver implementation, security patterns, and observability for compliance with best practices including Relay Connection spec, query complexity limiting, and N+1 prevention.
Activation Condition
Include this skill when the project uses GraphQL protocol (interfaces contains type: graphql).
Triggers
/x-review-graphql schema.graphqls-- review a specific schema file/x-review-graphql TransactionResolver-- review a specific resolver/x-review-graphql-- review all GraphQL schemas and resolvers
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
target |
String | No | (all) | Schema file path or resolver class name |
Prerequisites
- GraphQL schema files (
*.graphqls,*.gql) or code-first schema definitions exist - GraphQL framework dependency is configured
- Resolver classes/functions are implemented
Workflow
Step 1 — Discover Schema Files
Scan for *.graphqls, *.gql, or code-first schema definitions:
- List all types, queries, mutations, and subscriptions
- Identify input types and custom scalars
Step 2 — Discover Resolvers
Scan for resolver classes/functions:
- Map resolvers to schema types
- Identify DataLoader usage
Step 3 — Validate Schema Design
Check each type/operation:
- Naming conventions (PascalCase types, camelCase fields, UPPER_SNAKE_CASE enums)
- Pagination patterns (Relay Connection spec)
- Mutation input/payload design
- Subscription lifecycle
Step 4 — Validate Resolver Patterns
Check implementation:
- DataLoader for N+1 prevention
- Complexity and depth limiting
- Field-level authorization
- Error handling
Step 5 — Validate Security
Check security patterns:
- Authentication on entry points
- Introspection disabled in production
- No sensitive data in errors
Step 6 — Generate Report
Summarize findings as checklist:
- List compliant items
- List violations with file paths and line numbers
- Suggest fixes for each violation
Schema Design Checklist (14 points)
Naming & Types (1-5)
- Types use PascalCase (
Transaction,PaymentMethod) - Fields use camelCase (
transactionId,createdAt) - Enums use UPPER_SNAKE_CASE (
PAYMENT_APPROVED,PAYMENT_DENIED) - Input types suffixed with
Input(CreateTransactionInput) - Mutation payloads suffixed with
Payload(CreateTransactionPayload)
Query Design (6-9)
- Cursor-based pagination for lists (Relay Connection spec:
edges,node,pageInfo,cursor) - No nested queries deeper than 4 levels without justification
- Nullable vs non-null strategy consistent (non-null by default, nullable where absence is valid)
- Custom scalars for domain types (
DateTime,Money,Email)
Mutation Design (10-12)
- Mutations accept single
inputargument (not multiple args) - Mutation payloads include both
resultanderrorsfields (union type for errors) - Idempotency key pattern for critical mutations (
clientMutationId)
Subscription Design (13-14)
- Subscriptions have clear lifecycle (start, data, complete, error)
- Subscription filters prevent over-broadcasting (topic-based filtering)
Resolver Checklist (10 points)
Performance (15-19)
- DataLoader used for batch loading (N+1 prevention)
- Complexity analysis configured (max query complexity limit)
- Depth limiting configured (max depth 10-15)
- Field-level resolvers are lazy (not pre-loading unused fields)
- Database queries scoped to requested fields only (projection)
Security (20-22)
- Authentication on schema entry points (Query, Mutation, Subscription)
- Field-level authorization for sensitive data
- Introspection disabled in production
Error Handling (23-24)
- Errors follow GraphQL spec (
errorsarray withmessage,locations,path,extensions) - Domain errors use union types or
extensions.code(not just string messages)
Observability Checklist (4 points)
- Trace spans per resolver execution
- Metrics: query complexity, execution time, error rate per operation
- Structured logging: operation name, variables (masked), duration
- No sensitive data in error messages, traces, or logs
Output Format
## GraphQL Review — [Schema/Change Description]
### Schema Quality: HIGH / MEDIUM / LOW
### Resolver Quality: HIGH / MEDIUM / LOW
### Schema Findings
1. [Finding with file, line, issue, fix]
### Resolver Findings
1. [Finding with file, line, issue, fix]
### Security Findings
1. [Finding with severity, issue, fix]
### Checklist Results
[Items that passed / failed / not applicable]
### Verdict: APPROVE / REQUEST CHANGES
Error Handling
| Scenario | Action |
|---|---|
| No GraphQL schema files found | Report INFO: no GraphQL schemas discovered |
| N+1 detected without DataLoader | REQUEST CHANGES with DataLoader example |
| Introspection enabled in production | REQUEST CHANGES with configuration fix |
Rules
- REQUEST CHANGES if N+1 detected without DataLoader
- REQUEST CHANGES if no query depth/complexity limiting
- REQUEST CHANGES if introspection enabled in production config
- REQUEST CHANGES if sensitive data exposed without field-level auth
- Verify pagination follows Relay Connection spec
04 同仓库更多 Skills
x-parallel-eval
Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.
parallelism-heuristics
Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.
x-watch-pr-ci
Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.
x-validate-docs
Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.
x-update-system-architecture
Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.
x-update-architecture
Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.