About codegen
codegen is a skill for regenerating GraphQL types from the API schema used by @cartridge/keychain. It specifies the project command and follow-up checks for generated files, TypeScript errors, and tests.
Key features
- 01Regenerate GraphQL types from schema
- 02Run code generation with pnpm
- 03Verify generated TypeScript files
- 04Check API-related TypeScript errors
- 05Run tests after generation
Use cases
- 01Updating types after an API schema change
- 02Refreshing types after GraphQL query edits
- 03Investigating type errors in API calls
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ cartridge-gg/ controller --skill codegenAfter installing, type/codegenin Claude Code to confirm it loaded.
Details
From the project READMEGraphQL Codegen Skill
Regenerate GraphQL types from API schema.
Usage
Run when:
- API schema has changed
- GraphQL queries/mutations added or modified
- Type errors in API calls
Steps
- Run
pnpm --filter @cartridge/keychain codegen - Verify generated types in
packages/keychain/src/utils/api/graphql.ts - Check for any TypeScript errors in files using the API
- Run
pnpm testto ensure tests still pass
Configuration
- Schema source: https://api.cartridge.gg/query
- Config:
packages/keychain/src/utils/api/codegen.yaml - Auto-runs during build process
Notes
- Codegen is also triggered automatically during
pnpm build - Generated files should not be manually edited
- Commit generated changes with schema updates
Comments
Markdown supported