x-gqlgen

Standardize gqlgen GraphQL development with separated contract code and thin resolvers.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/pure-golang/level85 --skill x-gqlgen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: x-gqlgen
Source: https://github.com/pure-golang/level85/tree/main/.agents/skills/x-gqlgen
Command: npx skills add https://github.com/pure-golang/level85 --skill x-gqlgen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Снижает хаос в GraphQL-коде на gqlgen за счёт единой, предсказуемой раскладки контракта и резолверов, чтобы резолверы оставались тонкой границей и не превращались в место для бизнес-логики.

Core Features & Use Cases

  • Каноническая раскладка gqlgen: контракт и generated-код отделены от резолверов, чтобы автогенерация и ручные изменения не смешивались.
  • Тонкие резолверы как граница: резолверы принимают аргументы, вызывают сервис через частично применяемые интерфейсы и возвращают domain-ориентированный результат.
  • Правила интеграции в HTTP: схема монтируется через handler.NewDefaultServer и playground, без ручного JSON-парсинга и самописного роутинга по полям.
  • Регламент re-generation: workflow для gqlgen generate, сохранение ручных реализаций стабов и запрет на коммит panic-стабов.

Quick Start

Настрой и используй x-gqlgen, чтобы привести существующий GraphQL на gqlgen к правилам раскладки, затем сгенерируй stubs и заполни резолверы через интерфейсы сервисного слоя.

Frequently Asked Questions about x-gqlgen

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

FAQPage Schema
How do I structure a gqlgen project to keep resolvers thin?

To keep resolvers thin in gqlgen, enforce a canonical package layout that separates generated contract code from hand-written logic. Resolvers should act as a thin boundary, calling interface-driven services and returning domain-oriented results without containing business logic.

What is the correct workflow for regenerating gqlgen schemas without losing stubs?

The correct gqlgen regeneration workflow involves running gqlgen generate while preserving manual resolver implementations. You must follow a strict reglement that saves hand-written stubs and prohibits committing unresolved panic stubs into the codebase.

How do I wire a GraphQL handler into an HTTP router using gqlgen?

To wire a GraphQL handler into an HTTP router with gqlgen, mount the schema using handler.NewDefaultServer and the provided playground. This approach avoids manual JSON parsing and custom field-based routing to maintain standard HTTP integration.

Why do my gqlgen resolvers keep filling up with business logic?

Gqlgen resolvers fill up with business logic when the boundary between contract and implementation is unclear. Enforcing thin resolver rules ensures resolvers only accept arguments, call services through partially applied interfaces, and return domain-oriented results.

Can I use domain-driven design with gqlgen code generation?

Yes, you can use domain-driven design with gqlgen code generation by configuring gqlgen.yml to map schema types to domain types. This setup ensures resolvers return domain-oriented results while relying on interface-driven services for business logic execution.

What are the limitations of using thin resolvers in GraphQL schema evolution?

A limitation of thin resolvers during GraphQL schema evolution is the strict reglement required for re-generation. You must avoid committing panic stubs and carefully preserve hand-written implementations across the prescribed package layout when modifying the schema.