Build Your First Artifact Definition
Follow the two-agent Cuddler handoff: use the Artifact Specification to author a synchronized definition contract, then use that contract to prepare validatable Artifact Documents.
Building a first Artifact Definition
The shortest useful path is to follow the standards in the order they constrain the artifact family.
Start from the Document Role so the artifact family has the right governing context.
Read the Artifact Specification before drafting the family.
Use existing Artifact Definitions to see how the public surface is structured.
Keep the data contract and render contract in the same family from the start.
Finish by proving the contracts work before the final output step.
The tutorial is about applying the standards correctly, not replacing them.
This tutorial shows the shortest useful path from document intent to a synchronized local Artifact Definition set, then from that set to validatable Artifact Documents. The goal is not to reinvent the standards; it is to preserve one explicit contract across both agent workflows.
The two-agent workflow
Agent 1: author the contract
- Start with the relevant Document Role so you know which domain you are working in.
- Load the shared Artifact Specification as the flagship authoring contract.
- Prepare the orchestration payload with
outputPathandsourceDefinitionPath; pointsourceDefinitionPathat the source-side JSON context file you want embedded, and the Process side now resolves automatically to the single*.process.jsoncontract. - Inspect the matching Artifact Definitions and any existing source definition file to see how published examples and current context are structured.
- Draft the Process document, Data definition, and Template document together so the controller, model, and markdown-template view contracts stay aligned. Only the Data member is locally authored as a schema; the Template and Process members consume the published schemas from
www.cuddler.dev. - Validate the synchronized bundle plus the definition file, then update the current files in place.
The expected current files inside outputPath are:
<artifactId>.data.schema.json
<artifactId>.data-example.json
<artifactId>.template.json
<artifactId>.process.json
<artifactId>.definition.json
Agent 2: use the contract
- Read
<artifactId>.definition.jsonto resolve the active synchronized files. - Bind the Data Instance to the exact
"$id"of<artifactId>.data.schema.json. - Parse applicable schema-node and Process-question
for-aiguidance instead of relying on a separate undocumented prompt. - Prepare the Data, Template, and Process values required by the selected definitions.
- Validate the Data Instance against the Data Schema.
- Validate the Template document against the published Template schema and deterministic markdown rules.
- Render only after both validation gates pass; retain diagnostics when a value does not conform.
What to keep in view
- The Document Role tells you what the domain means.
- The Artifact Specification tells you how a public Artifact Definition must be authored.
- The latest standards registry at
/standards/latest/index.jsonexposes the current public versions and direct JSON URLs when a local cache needs to refresh. <artifactId>.definition.jsoninsideoutputPathtells downstream tooling which synchronized bundle is current, including<artifactId>.data-example.json, and embeds the parsed JSON copied fromsourceDefinitionPath.- The example Artifact Documents tell you what a successful implementation looks like without overriding the standards.
Practical checkpoints
- Keep the synchronized bundle aligned on one artifact identity and business purpose.
- Keep the
selectedDefinitionsblock in<artifactId>.definition.jsoninsideoutputPathpointed at the current bundle. - Bind the instance
"$schema"to the exact canonical schema identity. - Keep the Process output as one
*.process.jsondocument that consumes the published questionnaire schema; if the target questions are sequential, route question to question until completion, and if they branch, keep that branching inside deterministic question-level routing in the same document. - Treat validation failures as blockers, not warnings to work around.
- Keep the final rendered output readable without weakening sanitization defaults.
Next step
Once the definition-building side is clear, move to Create a Data Schema to refine the one family-specific schema that local orchestration authors. Then browse the Artifact Definition Library to experience the downstream document-building side of the contract.
