Write a First Capability

Start with one system responsibility. Avoid beginning with service names, database tables, or HTTP routes.

1. Name The Capability

Choose a verb phrase that describes the responsibility. In this guide, the responsibility is RegisterCustomer.

2. Define Intent

Intent says what initiates the capability. Here, a Customer provides RegistrationInput.

3. Name Outcomes

Outcomes should make meaningful paths explicit: RegistrationAccepted, TermsRejected, and VerificationDeferred.

4. Add Rules And Effects

The TermsAccepted rule guards acceptance. The effects describe registration persistence and a verification message, including the order between them.

5. Select Outcomes

The when block connects semantic conditions to outcomes. Rule violations and unresolved effects lead to different explicit outcomes.

register-customer.dcl
language dcl 0.9

actor Customer is human

effect PersistRegistration is persistence
effect SendVerificationMessage is notification

shape RegistrationInput {
  email: Email required
  acceptedTerms: Boolean required
}

event VerificationMessageSent is {
  email: Email required
}

capability RegisterCustomer {
  intent RegistrationInput from Customer

  outcomes {
    RegistrationAccepted
    TermsRejected
    VerificationDeferred
  }

  rule TermsAccepted: input.acceptedTerms is true

  effects {
    PersistRegistration
    SendVerificationMessage after PersistRegistration
  }

  events {
    emits VerificationMessageSent
  }

  when {
    TermsAccepted violated then TermsRejected
    SendVerificationMessage unresolved then VerificationDeferred
    otherwise then RegistrationAccepted
  }
}

Open in Playground

Next Step

Read the register customer example for expected outcomes and concept notes.