Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typegen-fmdapi

БесплатноБез исполняемых скриптовНе проверен

ENTRY POINT for @proofkit/fmdapi projects. Generate TypeScript types and Zod validators from FileMaker layouts using @proofkit/typegen. Covers…

proofshот proofsh★ 21 звезда на GitHub

Об этом скилле

ALWAYS use @proofkit/typegen to set up an @proofkit/fmdapi project. Typegen generates type-safe, schema-validated clients directly from your FileMaker layouts. It is the preferred and recommended path — manual client setup is only a fallback. Before writing any DataApi code, run typegen first.

Prerequisites

  • FileMaker Server 19.6+ accessible via port 443
  • OttoFMS 4.7+ installed on the FM server (for API key auth)
  • FileMaker account with the fmrest extended privilege enabled
  • Data API enabled on the FileMaker server

Setup

1. Install the runtime package

pnpm add @proofkit/fmdapi

2. Set environment variables

# .env
FM_SERVER=https://your-server.com     # must start with https://
FM_DATABASE=MyFile.fmp12              # must end with .fmp12

# OttoFMS Data API key (recommended)
OTTO_API_KEY=dk_123456...789
# OR username/password (requires token store in production)
FM_USERNAME=admin
FM_PASSWORD=password

3. Initialize and run typegen

npx @proofkit/typegen@beta init

This creates proofkit-typegen-config.jsonc at your project root. Configure your layouts:

{
  "$schema": "https://proofkit.proof.sh/typegen-config-schema.json",
  "config": {
    "type": "fmdapi",
    "path": "schema",
    "validator": "zod/v4",
    "clientSuffix": "Layout",
    "clearOldFiles": true,
    "generateClient": true,
    "layouts": [
      { "layoutName": "api_Customers", "schemaName": "Customers" },
      {
        "layoutName": "api_Invoices",
        "schemaName": "Invoices",
        "valueLists": "strict",
        "strictNumbers": true
      }
    ]
  }
}

Run typegen to generate clients:

npx @proofkit/typegen@beta

Add a convenience script to package.json:

{
  "scripts": {
    "typegen": "npx @proofkit/typegen@beta"
    "typegen:ui": "npm run typegen ui"
  }
}

4. First query

import { CustomersLayout } from "./schema/client";

const { data } = await CustomersLayout.findOne({
  query: { id: "==123" },
});

console.log(data.fieldData);

The generated client includes full type safety and runtime schema validation — no manual type definitions needed.

Core Patterns

Generated output structure

schema/
  generated/      # Auto-generated. NEVER edit.
    Customers.ts
    Invoices.ts
  client/         # Auto-generated. NEVER edit.
    Customers.ts
    Invoices.ts
    index.ts
  Customers.ts    # Override file. Safe to edit.
  Invoices.ts     # Override file. Safe to edit.

Override files for customization

Override files live at schema/<schemaName>.ts. They re-export from generated/ and are never overwritten by typegen. Customize by modifying the Zod schema:

// schema/Customers.ts (override file)
import { z } from "zod/v4";
import {
  ZCustomers as ZCustomers_generated,
} from "./generated/Customers";

export const ZCustomers = ZCustomers_generated
  .omit({ active: true })
  .extend({
    active: z.coerce.boolean(),
  });

export type TCustomers = z.infer<typeof ZCustomers>;

The generated client automatically imports from the override file, so transformations apply at runtime.

Type inference helpers

For portals, use InferZodPortals from @proofkit/fmdapi:

import type { InferZodPortals } from "@proofkit/fmdapi";

export const ZInvoicesPortals = {
  lineItems: ZLineItems,
};

export type TInvoicesPortals = InferZodPortals<typeof ZInvoicesPortals>;

Custom env variable names

{
  "config": {
    "type": "fmdapi",
    "envNames": {
      "server": "MY_FM_SERVER",
      "db": "MY_FM_DATABASE",
      "auth": {
        "apiKey": "MY_OTTO_KEY"
      }
    },
    "layouts": [
      { "layoutName": "api_Users", "schemaName": "Users" }
    ]
  }
}

Default env variable names when envNames is omitted: FM_SERVER, FM_DATABASE, OTTO_API_KEY (or FM_USERNAME/FM_PASSWORD for Fetch adapter).

Multiple configs

The config key can be an array mixing fmdapi and fmodata entries, each with its own path and envNames.

FM MCP mode (local Web Viewer development — no credentials)

FM MCP mode lets typegen fetch layout metadata from a locally running FileMaker file via the FM MCP proxy, without needing OttoFMS, a hosted server, or any credentials. Generated clients use WebViewerAdapter — FM MCP is only used during typegen.

{
  "$schema": "https://proofkit.proof.sh/typegen-config-schema.json",
  "config": {
    "type": "fmdapi",
    "fmMcp": { "enabled": true },
    "layouts": [
      { "layoutName": "api_Contacts", "schemaName": "Contacts" }
    ]
  }
}

fmMcp accepts an object with optional overrides:

  • enabled — true to enable (default when object is present)
  • scriptName — FM script the proxy calls for Data API operations. Resolution: fmMcp.scriptName > webviewerScriptName > "PK_execute_data_api"
  • baseUrl — FM MCP server URL (default: http://127.0.0.1:1365). Can also be set vi
Полный SKILL.md на GitHub

Установить typegen-fmdapi в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл typegen-fmdapi?

ENTRY POINT for @proofkit/fmdapi projects. Generate TypeScript types and Zod validators from FileMaker layouts using @proofkit/typegen. Covers proofkit-typegen-config.jsonc for Data API mode, npx @proofkit/typegen setup, OttoAdapter and FetchAdapter env vars, FM MCP mode for local Web Viewer development, generated vs override file structure, schema/generated/client directory layout, Standard Schema validation, InferZodPortals, fmMcp mode prerequisites, and choosing between OttoAdapter and FetchAdapter auth.

Как установить скилл typegen-fmdapi?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typegen-fmdapi запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typegen-fmdapi с