一键导入
trellis-build-agent
Build or modify a Trellis agent by editing the agent blueprint, skills, knowledge, state map, MCP surfaces, and verification commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build or modify a Trellis agent by editing the agent blueprint, skills, knowledge, state map, MCP surfaces, and verification commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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.
Diagnose what is missing before a Trellis Cloudflare app can boot, deploy, or verify live.
| name | trellis-build-agent |
| description | Build or modify a Trellis agent by editing the agent blueprint, skills, knowledge, state map, MCP surfaces, and verification commands. |
Use this skill when the user wants to build, modify, or explain a Trellis agent, not just deploy an existing scaffold.
Always fetch/read references/trellis-agent-build-guide.md before making agent-shape changes. That guide is the source of truth for the novice workflow, file map, state model, MCP surfaces, and safe verification order.
Trellis agents are built from five files/folders:
src/agent.ts = agent blueprint and workflow.src/state/*.map.ts = business state projection into Trellis D1 state records.knowledge/**/*.md = company, ICP, product, messaging, policy, and examples.skills/**/SKILL.md = repeatable methodology for each bounded skill.wrangler.jsonc = Cloudflare binding map generated by Trellis.Do not start by editing Cloudflare internals. Start with the agent behavior, then state, then skills, then knowledge, then verification.
For a new or changed agent:
src/agent.ts, src/state/*.map.ts, knowledge/, skills/, wrangler.jsonc, and package.json.src/agent.ts using Trellis primitives only.trellis.state(...) projections for business objects.SKILL.md per bounded step.mcp.tools.trellis.safeOutbound() unless the user explicitly asks to change safety.Prefer this shape:
export default trellis.agent("agent-name", {
crm: attio({ map: attioMap }),
research: firecrawl(),
model: "cloudflare/openai/gpt-5.5",
state: stateMap,
mcp: {
name: "trellis-sdr",
surface: "sdr",
operator: { name: "trellis-operator" },
tools: {
include: ["list_leads", "get_lead", "approve_draft", "qualify_lead"],
skillTools: [
{
name: "qualify_lead",
skill: "icp-qualification",
schema: schema.qualification(),
},
],
},
},
knowledge: "knowledge/**/*.md",
skills: "skills/**/SKILL.md",
safety: trellis.safeOutbound(),
}, async (app) => {
const signal = await app.signal();
const context = await app.context(signal);
const qualification = await app.skill("icp-qualification", {
context,
schema: schema.qualification(),
});
return app.workflow("prospect").start({ signal, qualification });
});
Trellis owns the internal D1 schema. Do not hand-write migrations for these tables:
trellis_signalstrellis_state_recordstrellis_draftstrellis_approvalstrellis_provider_runstrellis_provider_actionstrellis_workflow_runstrellis_audit_eventstrellis_trace_eventstrellis_operator_controlstrellis_smoke_runstrellis_agent_sessionstrellis_slack_threadsDefine business state through trellis.state(...); Trellis persists those projections into trellis_state_records.
When the task is about creating D1, checking schema, seeding demo rows, cleaning traces, or proving database contents, switch to trellis-setup-database.
Use fields like:
const stateMap = trellis.state({
tables: {
prospects: {
primaryKey: "id",
fields: {
id: "prospect.id",
signalId: "signal.id",
company: "signal.payload.company",
domain: "signal.payload.companyDomain",
status: "qualification.decision",
summary: "qualification.summary",
},
indexes: [
{ name: "prospects_by_status", fields: ["status"] },
],
},
},
});
Each skills/<name>/SKILL.md should be useful to a model and readable by a novice:
# Skill Name
## Purpose
One sentence.
## Inputs
- `signal`
- relevant `knowledge/` files
- prior skill outputs
## Method
1. Check required evidence.
2. Apply the business rules.
3. Return only the expected structured output.
## Output Contract
Return fields that match the schema passed in `src/agent.ts`.
## Safety
Do not send email, mutate CRM, or call side-effect tools. Trellis approvals handle that.
Keep one skill per bounded capability. Do not write a single giant skill that qualifies, researches, drafts, and approves.
Use role-shaped MCPs:
trellis-sdr at /mcp/trellis for business tools.trellis-operator at /mcp/operator for runtime controls.The SDR surface should expose business vocabulary like:
list_leadsget_leadpipeline_statsestimate_costlist_pending_approvalsapprove_draftreject_draftqualify_lead or draft_emailThe operator surface should expose runtime vocabulary like:
trellis.healthtrellis.signal.submittrellis.trace.inspecttrellis.trace.costtrellis.operator.controlsAfter edits:
npm run typecheck
npm run doctor -- --json
npm run smoke -- --json
npm run deploy -- --json
npm run verify -- --json
npm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY"
Use live exercise only when the user accepts model/runtime cost:
npm run verify -- --live --url "$APP_URL" --api-key "$TRELLIS_API_KEY" --exercise-agent
When finished, report: