Gate 2: Type Generation

VerifiedSafe

Runs codegen after spec bundling and verifies generated TypeScript output structure for implementation and tests.

Sby Skills Guide Bot
TestingAdvanced
7/23/2026
Claude Code
#codegen#typescript#openapi#sdk#quality-gate

Recommended for

Automated summary

Verifies that `zbb generate` succeeds and emits consumable TypeScript into generated/ and hub-sdk/generated/ before implementation starts.

Strengths

  • Ships a runnable set of bash checks, each paired with an explicit pass criterion.
  • The failure section maps every error back to its root cause and says where to fix it (api.yml, never generated/).
  • Includes a concrete before/after example of hoisting an inline response schema into a `$ref`.
  • Handles connector-specific expectations: a `<Class>Connector` interface and an exported `ConnectionProfile`.

Limitations

  • Assumes the internal `zbb` CLI and a specific repo layout (generated/, hub-sdk/, connectionProfile.yml).
  • No automated script — every check must be run and interpreted by hand.
  • Only validates the shape of generated output, not type correctness or runtime behavior.
When to use it

Use it after the API spec gate passes and before writing the module implementation (Gate 3).

When not to use it

Not useful on projects that don't use the `zbb` generator, or when debugging runtime test failures rather than generation problems.

Security analysis

Safe
Quality score80/100

No concerns found

How this analysis is made

Examples

Run Gate 2 on a module
Run the Gate 2 type-generation checks for the orders module: confirm `zbb generate` exits 0, that generated/api, generated/model and hub-sdk/generated/api are populated, and that manifest.json covers every operationId. Report pass/fail per check.
Fix an InlineResponse failure
`zbb generate` failed Gate 2 with InlineResponse types in generated/. Show me how to hoist the inline 200 response schema in api.yml into components/schemas and re-run generation.
Verify connector output
This is a connector module. After `zbb generate`, check that a `<Class>Connector` interface exists in generated/api/index.ts and that ConnectionProfile is exported from generated/model/index.ts, then tell me if Gate 3 can start.

name: gate-type-generation description: Gate 2 — zbb generate succeeds and writes consumable TypeScript into generated/ and hub-sdk/generated/. Use after Gate 1, before Gate 3 implementation.

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 generate exits 0
  • generated/api/, generated/model/, hub-sdk/generated/api/ all populated
  • generated/api/manifest.json exists and reflects every operationId
  • No InlineResponse* / InlineRequestBody* types anywhere
  • For connectors: a <Class>Connector interface exists and ConnectionProfile is exported from generated/model/index.ts

On failure

The failing task tells you the cause:

  • bundleSpec failed inside zbb generate — go back to Gate 1
  • generateApi failed — codegen rejects a schema or operation. Read the error verbatim; the fix is in api.yml, never in generated/
  • buildHubSdk failed — same root cause as above; the hub-sdk generator runs on the same bundled spec
  • InlineResponse* 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 generate to force from cold

Related

  • @.claude/skills/api-regeneration/SKILL.md — what zbb generate runs 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

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/gate-2-type-generation-mrx3xwmk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gate-2-type-generation-mrx3xwmk/download' --output '.skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md.part' && mv '.skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md.part' '.skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md' && test -s '.skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gate-type-generation' && cp -R '.skill-downloads/gate-2-type-generation-mrx3xwmk' '.claude/skills/gate-type-generation'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/gate-2-type-generation-mrx3xwmk'

openskills read 'gate-2-type-generation-mrx3xwmk'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/gate-2-type-generation-mrx3xwmk/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills