bolt-primer
Build a Bolt workspace with no other skill - source roles, contract queries, authoring order, pitfalls.
- License 许可
- AGPL-3.0
- 所属仓库
- norbital-ai/oss
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- bolt-primer
- description
- Build a Bolt workspace with no other skill - source roles, contract queries, authoring order, pitfalls.
03 SKILL.md 正文
This page, its starters at the end and workspace_lang are enough for a normal build: read no other skill first. Read a reference only for a diagnostic this page does not resolve. Ask for several types in one workspace_lang call.
Roles
A + file is a compiler role, default-exporting its declaration; its path is its name (^[a-z][a-z0-9_]*$, folders singular). Other files are plain modules. Under src/:
+workspace.tsworkspace(spec): zone, locale, currency, apps, capabilities+secrets.tssecrets(spec): secret namesdata/model/<name>/+model.tsmodel(spec): fields, reads, writes, state, search,effect(work after a committed write). Folders nest; the leaf names it.+representation.sveltebeside it: record view;+<sync>.sync.tssync('<model>', '<sync>', spec): a file or remote syncdata/custom_field/<name>/+custom_field.tscustom_field(spec),+renderer.svelte: value typeaccess_control/policy/+<name>.policy.tspolicy(spec): what holders may doaccess_control/team/+team.tsteam(spec): team handles to policiesautomation/+<name>.automation.tsautomation(spec): job or call with its own policies;agentcontrols its use as a toolintegration/<name>/+integration.tsintegration(spec),+integration.svelte: connection, setupapp/<app>/+app.tsapp(spec): label andpages;+group.tsgroup(spec)app/<app>/+<page>.page.svelte: page with actxpropapp/<k>/+app.tswithshell: 'kiosk': shared-device surface with fixed policiesagent/+agent.md,agent/skill/<s>/+skill.md: brief, skillagent/mcp/+<n>.mcp.tsmcp(spec); envoys are runtimesys_envoyrowsi18n/+messages.tsmessages(spec),+<locale>.messages.ts
Beside src/: seed/+seeder.ts seeder(spec); rows seed/public/**/<model>.json, seed/test/**/<model>.json; tests/*.test.ts; assets/.
Contracts
Write each role from its starter below. A role's card in bolt-contract lists its symbols' fields and types, generated from them: read it once, only for a field the starter does not show. A role without a card is answered by workspace_lang on the exported type; never guess a filename.
A body that takes ctx is a generator, function* (…): a policy verdict, a transform, an effect or a run. It goes through yield*.
workspace_lang answers only what a card leaves out:
- A type:
{ op:'type', type:["import('@norbital-ai/ui').TableProps"] }, several at once.import('pkg').Xworks only for exported types; a value istypeof import('pkg').x. Packages: bolt, ui, std, bolt-cli. - A declaration's spec:
Parameters<typeof import('pkg').fn>[0]; its file supplies the name. Narrow withX['field']. Models and integrations use their generated per-file binding, not a root declaration imported back from their source. typeanswers any shape with no file.completions,hover,signatureneed path, line, column of a file you are writing: a file written only to ask is a wasted edit.- Live names:
describe_workspace,workspace_list_dir.
Protocol
- Author in order: model, access, automation or sync, page, tests. Add a page only for a task the model's table and record sheet do not cover.
- Edit with
workspace_write,workspace_editandworkspace_move, one file a call, orworkspace_patch, any number of files in one call. Edits stay in your working tree and check nothing: finish the source, then diagnose. After a schema changeworkspace_generatewrites the generated migrations into the working tree; a diagnosis fails until they exist.workspace_migrateruns them on your own workspace's database, with SQL reads before and after, so you see what they do to real rows. Only a merge migrates live. workspace_diagnoseruns the diagnosis on the working tree.workspace_testruns the tests; a long run goes on in the background and reports by itself. Both run by hand. Fix what they name. Testsemptyproves nothing: every automation and refused state carries a test.workspace_commitwith a message, in any state; new commits join your line on top of live.workspace_rebasereplays them on top of live, migrations too, when you want to test against live as it is now; a merge never needs it. Reverting to redo work never helps.workspace_previewbuilds the last commit, serves it and opens every page.workspace_tryruns each automation once on the preview and reads what it changed. A preview binds no integration links: a sync's decoding is proved in a test. After the merge, create its connection on live withsys_integration.create { integration, name }, start it, and read the rows.workspace_mergewith the last commit, a summary and a ledger saying for each capability what implements it, orskip: reason. It needs no uncommitted edits and a preview of that commit, and is refused over a known failed diagnosis or failed tests. Merges land one at a time: the queue replays your commits on live as it stands, runs any diagnosis or tests that head lacks, and checks again if the replay changed anything.
Rules
- A model exposes guarded verbs only. A business operation is an automation.
- A policy can only grant a verb the model declares; it filters rows, never shape.
- An automation runs with its declared
policies, never its starter's;actor.*there matches nothing. - Effectful bodies are
function*andyield*theirctxEffects. - Decimals in policy and model code use
decvalues from the decimal module, never plain numbers. - Named constraints take arrays for
uniqueandper. Mark one unique constraintimport_key: truefor matching imports. Computed expressions live on fields; physical and search indexes live underindexes. - Each create/update transform and per-verb effect receives
{ before, set, after, changed }changes. Return sets or{ sets, with, on_approved }from create/update transforms; a delete transform returns nothing or{ with, on_approved }. Effects receive approval lifecycle details inctx.event. - Commit related writes through one
ctx.act({ '<model>.<verb>': inputs })map. Update/delete targets carry selected rows and their revisions. There are nomany,checked, upsert or transaction alternatives. seed/test/assets.jsonandseed/public/assets.jsonare the reserved asset list: never name seed rows that, even for a model called assets.- Migrations are generated. Edit one only to move data: the schema must arrive at what the models declare. Never edit
.norbital/. - Credentials never enter source, seeds or model fields.
- Never rebuild search, filters, paging, import/export, approvals, history or label maps: the views render them.
Detail: the authoring-tenant-workspace skill indexes every reference.
- A test sets no
timeoutoption and never waits on the wall clock: the test lint refuses the run even when every case passes. - Porting a system:
referenceits repository first, then read its schema, routes, jobs and permissions withread_file(a script overtool('read_file', …)reads many at once). Inventory every capability, map each to a Bolt mechanism, build from that, never from memory of the product. Import and export carry over as a file sync per model that had them.
Messaging and envoys
Envoys are runtime sys_envoy rows, deployed through sys_integration.envoy. Do not look for an envoy source declaration or assume a contract filename. describe_workspace { names: ['system'] } returns available setup capabilities and account IDs. Create the envoy and its workspace account through native records, then open integration.manage with page { path, configure } for the person to pair it. Never collect credentials in chat.
A daily message is a cron automation using ctx.send through the intended active, paired account. Resolve it from runtime records, narrow its definition with instance_id, and fail clearly if missing or ambiguous. Recipient replies continue through the deployed envoy in the same conversation. Confirm queue admission separately from provider delivery; a timeout may be uncertain and a retried automation may repeat a committed send.
Asking to apply a change
Write the approval summary in one or two short sentences: what changes for the person and any material data risk. Keep evaluation scores, schema inventories, commit messages and test logs in the work evidence. The native card already presents the version, measured data changes and decision buttons; do not paste the same proposal again in an assistant reply. Let the person use the card.
04 同仓库更多 Skills
norbital-platform
How Norbital behaves at runtime - approvals, policies, history, audit, agent limits. Read before answering.
data-modelling
Route data modelling decisions - models, fields, layers, state, invariants, search, migrations.
bolt-requirements
Turn a vague business requirement into a concrete Norbital build plan a stakeholder can confirm.
bolt-feasibility
Decide per sub-function whether a business function is native, mediated, or not appropriate on Norbital.
authoring-test-suites
Choose, write and review Bolt tests that fail for a named production defect.
authoring-tenant-workspace
Index of Bolt authoring references - models, access, apps, automations, integrations, UI, build.