generate-schemas-and-gentype

Regenerates GraphQL schema artifacts and portal TypeScript types after source changes.

2.0k|126|Updated Jun 16, 2020
One-click install
npx skills add https://github.com/authgear/authgear-server --skill generate-schemas-and-gentype
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-schemas-and-gentype
Source: https://github.com/authgear/authgear-server/tree/main/.claude/skills/generate-schemas-and-gentype
Command: npx skills add https://github.com/authgear/authgear-server --skill generate-schemas-and-gentype

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GraphQL schema files and generated frontend types in authgear-server are checked into the repository, so editing them by hand leads to drift, inconsistency, and broken builds. This Skill enforces the correct regeneration workflow so generated artifacts always match their sources.

Core Features & Use Cases

  • Ordered regeneration workflow: Runs make export-schemas first, then cd portal && npm run gentype, ensuring portal types are generated from up-to-date schema files.
  • Generated-file discipline: Prevents hand-editing of generated outputs such as portal/src/graphql/adminapi/schema.graphql and *.generated.ts files.
  • Commit hygiene and verification: Keeps generated outputs in the same commit as the source change and verifies affected packages with the narrowest relevant tests or typecheck.
  • Use Case: After adding a new field to the Admin API GraphQL schema in Go, use this Skill to regenerate the schema file and portal TypeScript types, then run the relevant typecheck before committing everything together.

Quick Start

Regenerate the GraphQL schemas and portal generated types for my recent Admin API schema change and verify the affected packages.

Frequently Asked Questions about generate-schemas-and-gentype

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

FAQPage Schema
How do I regenerate GraphQL types in authgear-server?

Run make export-schemas at the repository root first to update the schema files, then run npm run gentype inside the portal directory to regenerate the TypeScript types. Always run the schema export before the portal type generation.

How do I update the Admin API GraphQL schema in authgear-server?

Make the source change in the Go code or GraphQL documents first, then regenerate artifacts with make export-schemas followed by cd portal && npm run gentype. Commit the generated outputs in the same commit as the source change.

Can I edit generated GraphQL schema or type files by hand?

No. Generated files such as schema.graphql and *.generated.ts must never be hand-edited when a generator exists. Manual edits are overwritten on the next regeneration and cause drift between sources and outputs.

Why must make export-schemas run before npm run gentype?

The portal type generator reads the exported schema files as its input. Running gentype before exporting schemas would generate TypeScript types from stale schema definitions, producing inconsistent artifacts.

What should I do if the generator rewrites unexpected files?

Inspect the diff before proceeding. Unexpected rewrites usually indicate the source change had broader effects than intended or the working tree was not clean, so review the changes before committing.