codegen

Regenerate GraphQL types from the API schema to sync client and server typings.

80|49|Updated Mar 27, 2022
One-click install
npx skills add https://github.com/cartridge-gg/controller --skill codegen-cartridge-gg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codegen
Source: https://github.com/cartridge-gg/controller/tree/main/.agents/skills/codegen
Command: npx skills add https://github.com/cartridge-gg/controller --skill codegen-cartridge-gg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Regenerate GraphQL types to keep client and server typings in sync when the API schema changes.

Core Features & Use Cases

  • Automatic type regeneration from updated GraphQL schema.
  • Verifies generated types in the codebase and ensures type safety across apps.
  • Use Case: After updating the API schema, run codegen to refresh all related TypeScript typings.

Quick Start

Run codegen to regenerate GraphQL types from the latest API schema and verify the generated typings.

Frequently Asked Questions about codegen

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

FAQPage Schema
How do I regenerate GraphQL types from an updated API schema?

To regenerate GraphQL types from your API schema, run the project's codegen tooling using pnpm. This updates the TypeScript typings in your codebase to ensure client and server definitions remain synchronized after schema evolution.

When do I need to run GraphQL codegen for TypeScript types?

You need to run GraphQL codegen during API schema evolution, when adding or modifying queries and mutations, or when type errors occur across the codebase. It regenerates typings to maintain type safety between client and server.

Does this codegen tool work with pnpm and TypeScript?

Yes, the codegen tool works with pnpm and TypeScript by running pnpm --filter to execute the codegen command. It regenerates GraphQL types and updates the TypeScript typings in the specified package's GraphQL utility files.

Why am I getting type errors across my codebase after a GraphQL schema update?

Type errors occur because your TypeScript typings are out of sync with the updated GraphQL schema. Running codegen regenerates the types from the latest API schema, resolving the mismatches and verifying type safety across your apps.

Can I integrate GraphQL type regeneration into my build and test workflow?

Yes, the codegen process integrates directly with the build and test workflow. Running it regenerates GraphQL types from the API schema and verifies the generated typings to ensure type safety is maintained throughout development.