From metaforge
Generate a fully-typed TypeScript API client from Strapi content-type schemas and route contracts. Use after backend-schema when you need to create or regenerate the frontend API layer.
How this skill is triggered — by the user, by Claude, or both
Slash command
/metaforge:api-client-genThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use api-types-mcp to generate a typed TypeScript API client from Strapi content-type schemas (`schema.json`) and optional route contracts (`*.contract.ts`) on disk. No running Strapi required.
Use api-types-mcp to generate a typed TypeScript API client from Strapi content-type schemas (schema.json) and optional route contracts (*.contract.ts) on disk. No running Strapi required.
create_custom_routebackend/src/api/*/content-types/*/schema.jsonbackend/src/api/*/routes/*.contract.tsSTRAPI_BASE_URL and STRAPI_API_TOKEN in backend/.env.local (connect syncs these to frontend/.env.local)connect once per session before generate_api_clientgenerate_api_client produces a layered client under frontend/src/api/:
frontend/src/api/
├── client.ts # StrapiClient class + createStrapiClient factory
├── index.ts # Barrel re-exports
├── types/
│ ├── articles.ts # Article interface, ArticleFindParams, ArticleFilters, ArticleSortable
│ ├── tags.ts
│ ├── filters.ts # Shared StringFilter, NumberFilter, etc.
│ └── index.ts
└── namespaces/
├── articles.ts # ArticlesNamespace class with find/findOne/create/update/delete + custom methods
├── tags.ts
└── index.ts
import { createStrapiClient } from "@/api";
const api = createStrapiClient({
baseUrl: import.meta.env.VITE_API_URL,
token: import.meta.env.VITE_STRAPI_TOKEN,
});
const articles = await api.articles.find({
filters: { status: { $eq: "published" } },
sort: ["publishedAt:desc"],
populate: ["author", "tags"],
pagination: { page: 1, pageSize: 10 },
});
const featured = await api.articles.featured({ limit: 5 }); // custom route
Confirm content types are committed on disk:
ls backend/src/api/*/content-types/*/schema.json
Call api-types-mcp connect to validate directory structure and sync the Strapi token from backend/.env.local to frontend/.env.local:
connect({ projectDir: "/absolute/path/to/project" })
connect no longer requires Strapi to be running and does not use admin credentials — it only reads files.
Call api-types-mcp generate_api_client:
generate_api_client({ projectDir: "/absolute/path/to/project" })
The tool reads every schema.json and every *.contract.ts under backend/src/api/, merges them by namespace (pluralName), and writes the full client to frontend/src/api/.
cd frontend && npx tsc --noEmit
Fix any type errors before proceeding.
Use query_api_types to search the generated namespace classes and types:
query_api_types({ query: "how to create article" })
query_api_types({ query: "find with pagination" })
query_api_types({ query: "featured articles" })
git add frontend/src/api/
git commit -m "checkpoint:feature/types"
All files under frontend/src/api/ are managed by api-types-mcp. Never edit them directly. To change the API:
schema.json via strapi-mcp, orcreate_custom_route, or*.contract.ts files by handgenerate_api_clientgenerate_api_client overwrites every file under frontend/src/api/. It is safe to run repeatedly — output is fully derived from the backend sources.
create_custom_route — add custom endpoints that feed into the generated clientlist_routes — inspect default CRUD + custom routes for a given APInpx claudepluginhub leonardotan19/metaforge --plugin metaforgeGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.