Skip to content
Domain creation
AutoXXS (320px)XS (375px)SM (640px)MD (768px)LG (1024px)XL (1280px)XXL (1536px)
SketchMaterialiOSTamagui
DataInjectionKeyPatternsServiceTransactionProcessResearchProductQualityPerformanceSpecDomainFunctionTechnologyArchitectureConfigMiddlewareDataDatabaseDrizzleMigrationModelop-sqliteSchemaSQLState ManagementDraftKeystoneMergePatchPatchesPersistenceReactiveRedoStoreUndoTestingDeviceFactoryIsolationTypeScriptZodTopicsCommunicationBidsNVCDesignDesign ImplicationsEducationPedagogyFoundationsPsychologyAttachmentFloodingRelatingAuthentic RelatingUIEditorReact Native

Domain creation

Workflow Domain creation
agent starscribe
tags
workflowdomain

Use action/event discovery to model a domain. Actions and events are the primary engine β€” models, requirements, and flow outlines are all derived from them, not designed independently.

Derivation Chain

Actions + Events β†’ Aggregates β†’ DBML Models
β†’ Requirements (passed to feature loops)
β†’ Flow outlines (standalone *.flow.mdoc files)

Phase 1 β€” Action/Event Discovery

Ask the user to describe what happens in this domain without structure or order. Capture both past-tense events and imperative commands:

  • Events: past tense, PascalCase β€” one thing that occurred (UserRegistered, SessionExpired)
  • Commands: imperative, PascalCase β€” one thing requested (RegisterUser, ExpireSession)
  • Operations: request/response interactions (GetProfile, SearchUsers) β€” capture what they return and how they fail
  • No filtering β€” capture everything
  • Do not ask about models or structure yet

Phase 2 β€” Sequence Ordering

Arrange pairs into a chronological narrative:

[start] β†’ RegisterUser β†’ UserRegistered β†’ ValidateCredentials β†’ CredentialsValidated β†’ SessionCreated
β†˜ CredentialsRejected (Error) β†’ AccountLocked

Ask: what is the happy path? Where do branches occur? What are the named failure modes?

Phase 3 β€” Interaction Pairing

Pair every command with the event it produces, and every operation with its result and errors.

InteractionResult / EventFailure Modes (Errors)
RegisterUser (Action)UserRegisteredn/a (async)
GetProfile (Op)Profile DataProfileNotFound
CreateOrder (Op)Order IDInsufficientFunds

Derivation checkpoint: From these pairs you can sketch:

  • Requirements for the feature loop: β€œThe system must support RegisterUser…”
  • Flow outlines: sequences of pairs that become *.flow.mdoc files

Phase 4 β€” Aggregate Discovery

Group command-event pairs by the entity that handles them. Each group becomes a DBML table.

User aggregate:
RegisterUser β†’ UserRegistered
LockAccount β†’ AccountLocked
Session aggregate:
ValidateCredentials β†’ CredentialsValidated
CreateSession β†’ SessionCreated

Phase 5 β€” Policy Discovery

Identify automatic reactions: β€œWhen [event], then automatically [command].”

When CredentialsRejected (3rd time) β†’ LockAccount

Phase 6 β€” Glossary

Formalize domain vocabulary discovered in phases 1–5. Ask: β€œIs there any term that needs a precise definition to avoid ambiguity?”

Phase 7 β€” DBML Model

Translate aggregates to DBML. Fields are derived from what commands need and events must record.

Phase 8 β€” Draft & Confirm

Present the complete .domain.mdoc draft for user confirmation before writing. Output: content/domains/{id}.domain.mdoc


Do’s and Don’ts

Do:

  • Let actions and events drive all other artifacts β€” models, requirements, and flows are derived, not invented independently
  • Capture every action and event the user mentions without filtering during discovery
  • Pair every command with its resulting event before moving to aggregates
  • Use the derivation chain (actions/events first, then aggregates, then DBML) strictly in order
  • Present the full draft for confirmation before writing anything to disk

Don’t:

  • Don’t start with models or data structures β€” always start with actions and events
  • Don’t skip the glossary phase; ambiguous terms cause downstream confusion
  • Don’t merge separate aggregates just because they share a field
  • Don’t invent actions or events the user did not mention without flagging them as suggestions
  • Don’t write the file before the user explicitly confirms the draft

Definition of Done

  • Draft presented to user for confirmation
  • Document written as content/domains/{id}.domain.mdoc with correct frontmatter and root tag
  • All action/event pairs are complete and consistent
  • DBML models are derived from aggregates, not invented independently
  • All cross-references resolve to existing documents
  • pnpm compile succeeds