gate-type-generation
Automates and validates TypeScript code generation from API specifications.
Install
mkdir -p .claude/skills/gate-type-generation && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14533" && unzip -o skill.zip -d .claude/skills/gate-type-generation && rm skill.zipInstalls to .claude/skills/gate-type-generation
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Gate 2 — `zbb generate` succeeds and writes consumable TypeScript into generated/ and hub-sdk/generated/. Use after Gate 1, before Gate 3 implementation.Key capabilities
- →Regenerate code from a specification
- →Verify generated API and model types
- →Check for inline response type leakage
- →Ensure connector interfaces are present
- →Validate manifest agreement with package.json
- →Identify stale generated files
How it works
The skill runs `zbb generate` to produce TypeScript code from a bundled spec and then performs a series of checks to ensure the output conforms to expected structures and does not contain specific anti-patterns.
Inputs & outputs
When to use gate-type-generation
- →Generating API clients from specs
- →Validating generated TypeScript types
- →Hoisting inline schemas
About this skill
Gate 2: Type generation
After Gate 1, bundleSpec produced a self-contained spec. Gate 2 runs the codegen and checks the output is shaped how the implementation and tests will need it.
What to check
# 1. Regenerate from the spec
zbb generate
# Exit code must be 0.
# 2. Module-side generated/ exists and is populated
test -d generated/api && ls generated/api/*.ts >/dev/null || echo "✗ generated/api/ empty"
test -d generated/model && ls generated/model/*.ts >/dev/null || echo "✗ generated/model/ empty"
test -f generated/api/manifest.json || echo "✗ generated/api/manifest.json missing"
# 3. hub-sdk-side generated/ exists (used by test/e2e via describeModule<T>)
test -f hub-sdk/generated/api/index.ts || echo "✗ hub-sdk/generated/api/index.ts missing"
# 4. No inline-response leakage
grep -rln "InlineResponse\|InlineRequestBody" generated/ hub-sdk/generated/ 2>/dev/null && \
echo "✗ Inline*Response types present — hoist inline schemas in api.yml"
# 5. Connector interface is present (for connector modules)
grep -E "export interface [A-Z][a-zA-Z]+Connector" generated/api/index.ts || \
echo "✗ <Class>Connector interface not generated"
# 6. ConnectionProfile / ConnectionState model types present (connectors only)
test -f connectionProfile.yml && grep -q "export interface ConnectionProfile" generated/model/index.ts \
|| echo " (skip: not a connector or model export shape changed)"
# 7. Module manifest agrees with package.json
jq -r .name package.json
jq -r '.operations | keys[]' generated/api/manifest.json | head
# Should map every operationId from api.yml to <Api>.<method>; missing entries mean spec/operations drifted.
# 8. No leftover stale files (after a forced clean)
git status --short generated/ hub-sdk/generated/ 2>/dev/null
# These directories are gitignored; output should be empty.
Pass criteria
zbb generateexits 0generated/api/,generated/model/,hub-sdk/generated/api/all populatedgenerated/api/manifest.jsonexists and reflects every operationId- No
InlineResponse*/InlineRequestBody*types anywhere - For connectors: a
<Class>Connectorinterface exists andConnectionProfileis exported fromgenerated/model/index.ts
On failure
The failing task tells you the cause:
bundleSpecfailed insidezbb generate— go back to Gate 1generateApifailed — codegen rejects a schema or operation. Read the error verbatim; the fix is inapi.yml, never ingenerated/buildHubSdkfailed — same root cause as above; the hub-sdk generator runs on the same bundled specInlineResponse*appears — a response body has an inline schema. Hoist it:# BEFORE '200': content: application/json: schema: type: object properties: { id: { type: string }, name: { type: string } } # AFTER '200': content: application/json: schema: { $ref: '#/components/schemas/Foo' }- Stale state —
zbb clean && zbb generateto force from cold
Related
- @.claude/skills/api-regeneration/SKILL.md — what
zbb generateruns and how to read its output - @.claude/skills/gate-api-spec/SKILL.md — Gate 1
- @.claude/skills/gate-implementation/SKILL.md — Gate 3 (next)
- @.claude/skills/build-quality/SKILL.md — full lifecycle context
When not to use it
- →When Gate 1 (bundleSpec) has not produced a self-contained spec
- →When `generateApi` or `buildHubSdk` fail due to schema or operation issues
- →When `InlineResponse*` types appear due to inline schemas in api.yml
Limitations
- →Requires a spec produced by Gate 1
- →Does not fix issues in `api.yml` directly
- →Does not handle `bundleSpec` failures
How it compares
This skill automates the verification of generated code against predefined structural and content requirements, unlike manual inspection which is prone to oversight.
Compared to similar skills
gate-type-generation side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| gate-type-generation (this skill) | 0 | 2mo | Review | Intermediate |
| copilot-sdk | 7 | 4mo | Review | Intermediate |
| create-bubble | 2 | 6mo | Review | Intermediate |
| exa-sdk-patterns | 1 | 1mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
copilot-sdk
github
Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent.
create-bubble
bubblelabai
Create a new Bubble integration for Bubble Lab following all established patterns and best practices from CREATE_BUBBLE_README.md
exa-sdk-patterns
jeremylongshore
Apply production-ready Exa SDK patterns for TypeScript and Python. Use when implementing Exa integrations, refactoring SDK usage, or establishing team coding standards for Exa. Trigger with phrases like "exa SDK patterns", "exa best practices", "exa code patterns", "idiomatic exa".
generating-api-sdks
jeremylongshore
Generate client SDKs in multiple languages from OpenAPI specifications. Use when generating client libraries for API consumption. Trigger with phrases like "generate SDK", "create client library", or "build API SDK".
openapi-to-typescript
davila7
Converts OpenAPI 3.0 JSON/YAML to TypeScript interfaces and type guards. This skill should be used when the user asks to generate types from OpenAPI, convert schema to TS, create API interfaces, or generate TypeScript types from an API specification.
graphql-schema
ChrisWiles
GraphQL queries, mutations, and code generation patterns. Use when creating GraphQL operations, working with Apollo Client, or generating types.