graphql-schema

Standardize GraphQL operations in .gql files with automatic codegen and generated hooks.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/RemseyMailjard/superpowers --skill graphql-schema-remseymailjard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: graphql-schema
Source: https://github.com/RemseyMailjard/superpowers/tree/main/.github/skills/graphql-schema
Command: npx skills add https://github.com/RemseyMailjard/superpowers --skill graphql-schema-remseymailjard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GraphQL development often suffers from inconsistent schemas, ad hoc queries, and manual code generation efforts. This Skill provides a structured pattern for creating GraphQL operation files, enforcing best practices, and automating type-safe hooks.

Core Features & Use Cases

  • No inline gql literals: Always store GraphQL queries in .gql files.
  • Automatic codegen: Run code generation after creating or updating .gql files to keep types in sync.
  • Robust mutations: Ensure onError handlers are in place and use generated hooks for consistency.
  • Fragments and reuse: Promote fragment-based field selection with shared ItemFields-like fragments.

Quick Start

Create a new .gql file for your GraphQL operation and run the code generator to produce typed hooks.

Frequently Asked Questions about graphql-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize GraphQL queries and mutations across a React Apollo project?

Standardize GraphQL operations by storing queries and mutations in .gql files, running codegen to generate typed hooks, enforcing onError handlers on mutations, and reusing shared fragments to eliminate ad hoc queries across React Apollo projects.

Why should I avoid inline gql literals when using GraphQL codegen?

Avoiding inline gql literals centralizes GraphQL operations in .gql files, enabling consistent codegen workflows, typed hook generation, and fragment reuse while eliminating scattered ad hoc queries that bypass schema type synchronization.

What is the best way to keep generated GraphQL types in sync after schema changes?

Keep generated GraphQL types in sync by running the code generation process immediately after creating or updating any .gql files, which automatically produces the corresponding typed Apollo hooks for your queries and mutations.

Does this GraphQL codegen workflow support React and Apollo Client?

Yes, this workflow is designed for frontend teams building React Apollo apps, generating typed hooks for queries and mutations, enforcing error handlers, and standardizing fragment-based field selection for consistent schema operations.

How do I add onError handlers to GraphQL mutations with generated hooks?

Add onError handlers by using the generated mutation hooks from codegen, which enforces robust error handling practices and ensures all GraphQL mutations include error management before executing schema operations.

When do I need to use shared fragments in GraphQL operations?

Use shared fragments in GraphQL operations to promote fragment-based field selection with reusable ItemFields-like patterns, ensuring consistent data fetching and eliminating duplicated field selections across multiple queries and mutations.