一键导入
trellis-setup-database
Create, bind, migrate, inspect, seed, or clean the Trellis D1 database for a generated Trellis app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create, bind, migrate, inspect, seed, or clean the Trellis D1 database for a generated Trellis app.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build or modify a Trellis agent by editing the agent blueprint, skills, knowledge, state map, MCP surfaces, and verification commands.
Connect Claude Code, Codex, Cursor, or OpenCode to a local or deployed Trellis Cloudflare app over MCP.
Connect Trellis providers as Cloudflare Worker secrets one provider at a time.
Scaffold a new Cloudflare-first Trellis app and hand the user to readiness or deploy.
Take a first-time Trellis user from local proof to the simplest credible Cloudflare production deployment.
Route a new Trellis user through the Cloudflare-first path without making them understand the whole stack first.
| name | trellis-setup-database |
| description | Create, bind, migrate, inspect, seed, or clean the Trellis D1 database for a generated Trellis app. |
Use this skill when the user asks about D1, database creation, schema, migrations, seeded demo data, trace cleanup, approval cleanup, or why a generated Trellis app cannot read/write state.
Trellis owns the internal database schema. Do not ask novices to design migrations for Trellis runtime tables.
The app builder owns business state shape through trellis.state(...) in src/state/*.map.ts.
D1 is the canonical store for:
trellis.state(...)R2 stores markdown knowledge packs and skill packs. Do not put large knowledge documents directly into D1.
From a generated app root:
nvm use 22
npm install
npm run cf:login
npm run doctor -- --json
npm run deploy -- --json
npm run verify -- --json
The deploy step should resolve or create the TRELLIS_DB D1 database, apply the Trellis runtime schema, and preserve the binding in wrangler.jsonc.
After deploy, verify live:
npm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY"
Inspect wrangler.jsonc and confirm there is exactly one Trellis D1 binding:
{
"d1_databases": [
{
"binding": "TRELLIS_DB",
"database_name": "<app-name>-trellis",
"database_id": "<cloudflare-d1-database-id>"
}
]
}
If TRELLIS_DB is missing, route the user through trellis-create-app or the app's generated setup command. Do not hand-edit a new database binding unless the Trellis CLI is unavailable and the user accepts manual setup.
Trellis-owned tables include:
trellis_signalstrellis_prospectstrellis_state_recordstrellis_draftstrellis_approvalstrellis_provider_runstrellis_provider_actionstrellis_workflow_runstrellis_audit_eventstrellis_trace_eventstrellis_operator_controlstrellis_smoke_runstrellis_agent_sessionstrellis_slack_threadsDo not write custom migrations for those tables.
Use src/state/*.map.ts for business state:
const stateMap = trellis.state({
tables: {
leads: {
primaryKey: "id",
fields: {
id: "signal.id",
company: "signal.payload.company",
domain: "signal.payload.companyDomain",
status: "qualification.decision",
summary: "qualification.summary",
},
indexes: [
{ name: "leads_by_status", fields: ["status"] },
],
},
},
});
Prefer app verification first:
npm run doctor -- --json
npm run verify -- --json
npm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY"
Use Wrangler only when the user explicitly needs table-level proof:
npx wrangler d1 list
npx wrangler d1 execute <database-name> --remote --command "SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE 'trellis_%' ORDER BY name"
npx wrangler d1 execute <database-name> --remote --command "SELECT type, COUNT(*) AS count FROM trellis_trace_events GROUP BY type ORDER BY count DESC"
Do not paste secrets into commands. Use Worker secrets for route/API keys and provider credentials.
Use app-provided demo or smoke commands when available:
npm run smoke -- --json
npm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY" --exercise-agent
For a curated SDR demo, seed only a small number of readable rows:
Do not seed fake sends as completed sends unless an actual provider executed them.
Be conservative. Never wipe a user's production database by default.
For demo cleanup:
trace_id, signal_id, workspace_id, or source prefixnpm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY" after cleanupUse exact IDs. Avoid broad deletes such as DELETE FROM trellis_trace_events unless the user explicitly asks to reset the whole demo database.
TRELLIS_DB binding is missing
trellis-create-app or restore the generated wrangler.jsonc binding.database_id is missing
npm run deploy -- --json so the generated deploy flow can resolve or create the D1 database.schema table missing
npm run deploy -- --json, then npm run verify -- --json.trace events are empty
npm run smoke -- --json locally or a safe live verification with --exercise-agent.state is missing for a lead
src/state/*.map.ts and the trace for the related signal.When finished, report:
trellis.state(...)