Skip to content
EN · PT

Product Doctrine

Every company has core business principles that apply everywhere. For example:

  • “All monetary amounts must be stored in cents as integers, never floats.”
  • “Personal identifying information (PII) must never appear in application logs.”
  • “Every user action that modifies account balance must generate an immutable audit record.”

When developers build new features, they often forget these cross-cutting rules. In Anchors, we govern these invariants through Product Doctrine.


Product Doctrine consists of non-negotiable, overarching policies stored in dedicated doctrine specifications:

docs/doctrine/
├── financial_integrity.doctrine.md
├── privacy_and_pii.doctrine.md
└── audit_logging.doctrine.md

Unlike regular unit specs that govern a single function or file, doctrine specs govern entire domains or the whole application.


When a feature specification operates within a governed domain, it must explicitly realize relevant doctrine rules:

# Checkout Service Spec
@realizes: FIN-DOC-01 (Store currency in cents)
@realizes: AUDIT-DOC-03 (Emit audit event on state transition)
### CHECKOUT-B01 — Calculate Final Total
Calculates cart subtotal, applies discount coupon, and emits AUDIT_CHECKOUT_COMPLETED.

If a spec modifies financial values but does not declare how it realizes FIN-DOC-01, the doctrine gates catch the omission.