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
- Validates
typeagainstUNIT_TYPES,domainagainstDOMAINS,slugagainst/^[a-z0-9-]+$/ - Checks slug uniqueness (file existence at target path)
- Generates a type-specific skeleton via
generateSkeleton() - Writes YAML to
packages/units/{domain}/{type}/{slug}.yaml
Skeleton Structure
All types share a base:| Type | Extra Fields |
|---|---|
| role | persona: { lens, tone, behaviour } |
| rule | rule: { polarity: "always", statement, scope: "global", protected: false } |
| task | contract: { inputs, outputs, failure_modes } + council + prompt_body |
| chain | contract + council + composition: { steps: [{...}] } |
| fragment | fragment_body |
Identity Immutability
These fields are set at scaffold time and must never change:id(strat:// URI derived from domain/type/slug/version)slugdomaintypemeta.created
Key Implementation Detail
Skeletons are code-generated objects, not template files. ThegenerateSkeleton() 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/schemabreak the skeleton generator (fail-fast) - No template file I/O needed
strat://{domain}/task/todo@0.1.0 (lowercase), not TODO (uppercase, fails domain enum validation).