文件
← 首頁
給 LLM 用

LLM Skill

把整頁貼進你的 vibe-coding 工具(Cursor、Claude、Lovable、ChatGPT 等)當作 skill系統提示。它包含 LLM 一次生成正確客戶端所需的全部資訊。

也可以直接連結原始 markdown:/api/public/llms.txt


你正在串接 Data Platform,請遵守以下規則:

  1. 先探索再寫入。 先呼叫 GET /schema,欄位名稱完全比對。
  2. 不可自行虛構欄位。 缺欄位時,先 POST /tables/{table}/columns 新增,再寫入資料列。
  3. People 走 /people,不是 /tables/people/rowsmatchKey: "email""student_id" upsert。
  4. 批次寫入用 { "rows": [...] } 每次上限 500 筆,超過請分批。
  5. 驗證僅需一組 Authorization: Bearer <TOKEN> header。 放環境變數,別寫死在前端。
  6. 假設有 RLS。 每一列都綁在 Token 所屬專案,跨專案讀不到。
  7. 欄位型別: textnumberintegerbooleandate(ISO 字串)、urlmedia(URL 字串)。
  8. 錯誤回應為 JSON { error, detail? } 加上 HTTP 狀態。 400 時把 detail 顯示給使用者(Zod issues)。
  9. Webhook 有 HMAC 簽章。 信任 payload 前用 sha256(secret + "." + raw_body) 驗證 x-df-signature

Base URL

https://learnfun.metaprint.io/api/public/v1

驗證 header

Authorization: Bearer <PROJECT_API_TOKEN>

端點速查表

MethodPath用途
GET/schema取得資料表與欄位
POST/tables建立資料表
POST/tables/{table}/columns新增欄位
GET/tables/{table}/rows列出資料列
POST/tables/{table}/rows插入一筆或多筆
GET/rows/{id}取得單筆資料列
PATCH/rows/{id}更新資料列(預設合併)
DELETE/rows/{id}刪除資料列
GET/people列出 people
POST/peopleUpsert people
GET/people/me以 email 或 auth_user_id 查 person
POST/relationships建立跨資料表的欄位關聯

最精簡客戶端

const BASE = "https://learnfun.metaprint.io/api/public/v1";
const TOKEN = process.env.MY_APP_TOKEN;

async function api(path, init = {}) {
  const res = await fetch(BASE + path, {
    ...init,
    headers: {
      "content-type": "application/json",
      "authorization": `Bearer ${TOKEN}`,
      ...(init.headers ?? {}),
    },
  });
  if (!res.ok) throw new Error(`API ${res.status}: ${await res.text()}`);
  return res.json();
}