api-client-gen

Generate a typed TypeScript API client from Strapi content-type schemas and route contracts.

2|1|Updated May 1, 2026
One-click install
npx skills add https://github.com/LeonardoTan19/metaforge --skill api-client-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-client-gen
Source: https://github.com/LeonardoTan19/metaforge/tree/main/skills/api-client-gen
Command: npx skills add https://github.com/LeonardoTan19/metaforge --skill api-client-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generate a fully-typed TypeScript API client from Strapi content-type schemas and route contracts to keep frontend code in sync with backend definitions.

Core Features & Use Cases

  • Typed client generation from Strapi content-types and optional route contracts to ensure faithful typing.
  • Project scaffolding integration: outputs under frontend/src/api including client.ts, index.ts, types/, and namespaces/.
  • Workflow automation: prerequisite connect and generate_api_client steps, enabling seamless updates when backend changes.
  • Use Case: Keep frontend in sync after content-type changes or new routes are added, or when validating API contracts before deployment.

Quick Start

Run the generator after updating content types to refresh the frontend API client.

Frequently Asked Questions about api-client-gen

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

FAQPage Schema
How do I generate a typed TypeScript API client from Strapi schemas?

To generate a typed TypeScript API client from Strapi, you need schema.json files in your content-types directory and optional route contracts. The generator connects via the api-types-mcp toolkit and outputs client files under frontend/src/api to sync your frontend with backend definitions.

What is the best way to keep my frontend TypeScript types in sync with Strapi backend changes?

Keeping frontend TypeScript types in sync with Strapi backend changes requires generating a typed API client from content-type schemas. By running the generator after updating content types or adding new routes, you refresh the frontend API layer to faithfully match backend definitions.

Do I need route contracts to generate a TypeScript API client for Strapi?

Route contracts are optional for generating a TypeScript API client for Strapi. The generator requires schema.json files under backend/src/api/*/content-types/*/schema.json, while optional route contracts at backend/src/api/*/routes/*.contract.ts provide additional faithful typing for the client output.

How does typed client generation from Strapi content-types work?

Typed client generation from Strapi content-types works by reading schema.json files and optional route contracts to automatically produce TypeScript types. It scaffolds the frontend API layer by outputting client.ts, index.ts, types/, and namespaces/ directories directly under frontend/src/api.

Can I validate API contracts before deployment using Strapi schema generation?

You can validate API contracts before deployment by generating a typed TypeScript API client from Strapi schemas and route contracts. This ensures the frontend API layer faithfully matches the backend content-type definitions, catching contract mismatches before they reach production.

What file structure does a generated Strapi TypeScript API client output?

A generated Strapi TypeScript API client outputs a structured project scaffolding under frontend/src/api. This includes client.ts for the core client, index.ts for exports, a types/ directory for TypeScript definitions, and a namespaces/ directory for organized schema namespaces.