odata-query-optimization
БесплатноБез исполняемых скриптовНе проверенOData performance patterns for @proofkit/fmodata. Covers defaultSelect schema vs all, select() for minimal field fetching, select("all") override, pagination…
от proofsh★ 21 звезда на GitHubОб этом скилле
Setup
This skill assumes a working fmodata client (see fmodata-client). Optimization starts at the schema level with defaultSelect and continues per-query with select().
defaultSelect on schema
import { fmTableOccurrence, textField, numberField } from "@proofkit/fmodata";
// "schema" (default) — only fetches fields defined in the schema via $select
const users = fmTableOccurrence("users", {
id: textField().primaryKey().entityId("FMFID:12039485"),
name: textField().notNull().entityId("FMFID:34323433"),
email: textField().entityId("FMFID:12232424"),
age: numberField().entityId("FMFID:43234355"),
}, {
defaultSelect: "schema", // default — adds $select with all schema fields
entityId: "FMTID:12432533",
});
// "all" — no $select applied, FileMaker returns every field on the layout
const usersAll = fmTableOccurrence("users", {
id: textField().primaryKey(),
name: textField().notNull(),
}, {
defaultSelect: "all", // slower: returns all layout fields, not just schema fields
});
Per-query select override
// Override defaultSelect for a single query — fetch only what you need
const result = await db.from(users).list()
.select({ name: users.name, email: users.email })
.execute();
// Override defaultSelect:"schema" to fetch all fields for this query
const result = await db.from(users).list()
.select("all")
.execute();
Core Patterns
1. Selective fetching with select()
Fewer fields = smaller response = faster queries. Always prefer explicit select() when you need a subset of fields.
// Fetch only 2 fields instead of all schema fields
const result = await db.from(users).list()
.select({ name: users.name, email: users.email })
.execute();
// Rename fields in the result object
const result = await db.from(users).list()
.select({ userName: users.name, userEmail: users.email })
.execute();
// result.data[0].userName, result.data[0].userEmail
// Exclude specific fields using destructuring + getTableColumns
import { getTableColumns } from "@proofkit/fmodata";
const { age, ...cols } = getTableColumns(users);
const result = await db.from(users).list().select(cols).execute();
2. Pagination with top/skip/count
list() applies .top(1000) by default. Override for smaller pages or to fetch more.
// Page 1: first 50 records
const page1 = await db.from(users).list().top(50).skip(0).execute();
// Page 2: next 50
const page2 = await db.from(users).list().top(50).skip(50).execute();
// Get total count (separate request, returns number)
const countResult = await db.from(users).list().count().execute();
// countResult.data === 1523
// Fetch more than 1000 (override default limit)
const allRecords = await db.from(users).list().top(5000).execute();
3. Batch operations for reducing round trips
Combine multiple queries into a single HTTP request. Write operations are transactional.
const contactsQuery = db.from(contacts).list().top(5);
const usersQuery = db.from(users).list().top(5);
// Single HTTP request for both queries
const result = await db.batch([contactsQuery, usersQuery]).execute();
const [contactsResult, usersResult] = result.results;
if (contactsResult.data) { /* ... */ }
if (usersResult.data) { /* ... */ }
// Mix reads and writes — writes are atomic
const result = await db.batch([
db.from(contacts).list().top(10),
db.from(contacts).insert({ name: "Alice", email: "[email protected]" }),
db.from(users).update({ active: true }).byId("user-123"),
]).execute();
4. Entity IDs for rename resilience
Entity IDs (FMTID/FMFID) prevent breakage when FileMaker fields or table occurrences are renamed.
IMPORTANT: Entity IDs must come from FileMaker metadata via
@proofkit/typegen. Do NOT invent FMFID/FMTID values — the IDs shown below are illustrative only. Guessed IDs cause silent query failures.
// Entity IDs are generated by @proofkit/typegen — do not manually add or change
const users = fmTableOccurrence("users", {
id: textField().primaryKey().entityId("FMFID:12039485"),
name: textField().notNull().entityId("FMFID:34323433"),
}, {
entityId: "FMTID:12432533",
});
// Enable at database level
const db = connection.database("MyDatabase", { useEntityIds: true });
// Or per-request
const result = await db.from(users).list().execute({ useEntityIds: true });
5. Debugging with getQueryString()
Inspect the generated OData URL without executing the request.
import { eq, asc } from "@proofkit/fmodata";
const queryString = db.from(users).list()
.select({ name: users.name, email: users.email })
.where(eq(users.active, true))
.orderBy(asc(users.name))
.top(10)
.getQueryString();
console.log(queryString);
// "/users?$select=name,email&$filter=active eq true&$orderby=name&$top=10"
// View with entity IDs resolved to see what's actually sent
const entityIdQuery = db.from(users).list()
.getQueryString({ useEntityIds: false });
Common Mistakes
Установить odata-query-optimization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл odata-query-optimization?
OData performance patterns for @proofkit/fmodata. Covers defaultSelect schema vs all, select() for minimal field fetching, select("all") override, pagination with top/skip, default 1000 record limit, batch operations for reducing round trips, entity IDs FMFID FMTID for rename resilience, null field query performance, getQueryString() debugging, relationship query performance testing, FileMaker OData optimization, avoiding OData service overload during testing.
Как установить скилл odata-query-optimization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл odata-query-optimization запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic