Skip to main content

When to Use

When creating new prompt units. stratt new generates a complete YAML skeleton with all required fields pre-filled for the given type.

How It Works

stratt new <type> <domain> <slug>
The command:
  1. Validates type against UNIT_TYPES, domain against DOMAINS, slug against /^[a-z0-9-]+$/
  2. Checks slug uniqueness (file existence at target path)
  3. Generates a type-specific skeleton via generateSkeleton()
  4. Writes YAML to packages/units/{domain}/{type}/{slug}.yaml

Skeleton Structure

All types share a base:
id: strat://{domain}/{type}/{slug}@0.1.0
type: {type}
domain: {domain}
slug: {slug}
version: 0.1.0
status: draft
meta:
  title: {Slug To Title}
  description: "TODO: describe this unit"
  tags: []
  author: null0
  created: {today}
Type-specific extensions:
TypeExtra Fields
rolepersona: { lens, tone, behaviour }
rulerule: { polarity: "always", statement, scope: "global", protected: false }
taskcontract: { inputs, outputs, failure_modes } + council + prompt_body
chaincontract + council + composition: { steps: [{...}] }
fragmentfragment_body

Identity Immutability

These fields are set at scaffold time and must never change:
  • id (strat:// URI derived from domain/type/slug/version)
  • slug
  • domain
  • type
  • meta.created

Key Implementation Detail

Skeletons are code-generated objects, not template files. The generateSkeleton() function returns a plain JavaScript object that matches the Zod schema for the target type. This means:
  • Skeletons are type-checked at build time
  • Schema changes in @stratt/schema break the skeleton generator (fail-fast)
  • No template file I/O needed
Placeholders must be schema-valid — e.g., chain step URIs use strat://{domain}/task/todo@0.1.0 (lowercase), not TODO (uppercase, fails domain enum validation).