Create a reusable template
Turn the app starter into a catalog entry that another author can copy, build, and publish.
A template is a source folder someone can copy to start an artifact. Here you’ll make a field-notes template in the Bricole monorepo. Start with a checkout, the pinned tools and installed dependencies. The app starter already has a page, server, SQLite database, and MCP tools. Use the brief template when a static page is enough.
Copy the starter
From the repository root, use the creator CLI to copy the committed starter into a new or empty directory.
bun packages/create/src/cli.ts starter templates/field-notes --from . --ref HEAD The command records the source commit in template.json. Give the copy a unique package name such as @bricole/template-field-notes, register templates/field-notes under workspaces in the root package.json, then run bun install from the root. Now the copy can resolve the SDK and publisher through the workspace.
Replace the example
Start with one user action, such as recording a field note. Follow it from the page through the server to the database.
| File in the copy | Change |
|---|---|
src/schema.ts | Define the fields a note stores. |
src/todos.ts and src/todos-page.tsx | Replace the example with note queries, write rules, and a page. Point src/router.tsx at the new view. |
src/server/index.ts | Expose the routes the page calls. Apply the same write rules to each entry point. |
src/server/tools.ts and src/server/mcp.ts | Give each agent tool a name, input schema, required action, and handler. Rename the MCP server. |
bricole.json | Declare the built entry, server, bindings, migration files in order, preview, and tools the artifact needs. |
On a fresh, unpublished copy, replace the sample migration history with an initial migration for your own schema. In the template folder, bun run generate --name init generates the SQL. Read it and list the file in bricole.json. For a published artifact, append a migration and preserve every applied file and its order. Earlier code may still need the old schema after a rollback.
Replace sample seed records with fictional examples. Update the preview image and the copy’s SKILL.md so an agent can build, publish, and verify this specific template.
Register and prove the template
In template.json, set name to the directory name, and update its title, description, version, license, tags, and provenance. Set default to false for an optional template. Match the tool declarations, seed, and vocabulary to your app. Set proof.tool to a read tool, proof.seed to the tool that accepts the seed file, and proof.visit to the app route that returns the seeded record when those features apply.
From the repository root, regenerate the catalog and run the real publish proof.
bun run catalog
bun run catalog:check
bun run proof --complete The proof builds the templates and publishes them to a disposable local Worker. It reads back the entry and cover, calls declared tools, and checks visitor access. Commit the template, workspace registration, lockfile, and generated catalog together. Run the list command against the resulting commit and check that field-notes appears. Another author can now copy it with the same creator CLI and publish their own artifact.