How Do I Define a Capability?
Start with the responsibility the system exposes. A capability should read as a business or architectural responsibility, not as an endpoint, class, queue, or handler.
Model The Responsibility
Name the capability, then define the actor and input shape that express the intent. Add outcomes for every meaningful result path.
Add Semantics
Rules express constraints, effects express externally meaningful work, events
express signals, and the when block explains why each outcome
can happen.
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
}
}