This document explains how to adopt this template for new and existing services,
and how to tune which checks are enforced on your main branch.
The template is opinionated, but you can adopt it in phases.
We recommend thinking about adoption in terms of profiles.
For experimental or very small services.
- Required checks on
main:LintsNix Flake CheckMSRV
- Optional (run but not required):
Coverage- Contract breakers for domains actually used (
OpenAPI,Proto,DB,EventSchemas,Privacy) Security
For most production services.
-
Required checks on
main:- Quality / tests:
LintsCoverageMSRVNix Flake Check
- Contracts:
OpenAPI(ifspecs/openapiexists)Proto(ifspecs/protoexists)DB(ifspecs/dbexists)EventSchemas(ifspecs/eventsexists)Privacy(ifspecs/privacy.yamlexists)
- Requirements & policy:
ACsGherkinFeaturesFlagsPolicyVerify
- Security:
- At least the dependency and secrets jobs from
Security
- At least the dependency and secrets jobs from
- Quality / tests:
-
Optional but recommended:
Docs
For systems with tight compliance / risk requirements.
-
Everything in Standard, plus:
- All contract gates required (
OpenAPI,Proto,DB,EventSchemas,Privacy) Securityin full (CodeQL + deps + secrets)ScopeGuard(if configured)Docs(if you depend on generated docs for customers)
- All contract gates required (
Suggested sequence for a brand new service:
-
Create a repo from this template.
- Keep the initial specs, ledger, features, and flags even if they are “toy” examples.
- Confirm
nix develop,xtask check, andxtask bddwork locally.
-
Turn on Minimal profile.
- Mark
Lints,MSRV, andNix Flake Checkas required onmain. - Keep coverage and contract gates non‑required initially.
- Mark
-
Define your first real feature and ACs.
- Add user stories, requirements, and ACs in
specs/spec_ledger.yaml. - Add Gherkin scenarios under
specs/featureswith@AC-####tags. - Add a
features/FT-####.yamlmanifest referencing those ACs and a flag.
- Add user stories, requirements, and ACs in
-
Wire the behavior.
- Implement the behavior in
crates/coreand supporting crates. - Add or update acceptance step definitions in
crates/acceptance. - Run
xtask bddlocally and fix failures.
- Implement the behavior in
-
Promote to Standard profile.
- Mark contract breakers,
ACs,Gherkin,Features,Flags, andPolicyVerifyas required onmain. - Set a reasonable coverage floor in
ci-coverage.yml(e.g. 60%) and makeCoveragerequired once the service has a base of tests.
- Mark contract breakers,
-
Iterate.
- As you add more stories, repeat the cycle: ledger → specs → features → flags → tests.
Suggested staged approach for migrating an existing service.
-
Start with hygiene gates.
- Introduce
Lints,MSRV, andNix Flake Checkfirst. - Enable
Security(at least deps + secrets) if your service is internet-facing. - Make these required on
main.
- Introduce
-
Stabilise contracts.
- Add OpenAPI/Proto/DB specs that reflect the current service behavior.
- Wire
OpenAPI,Proto,DB,EventSchemas, andPrivacyworkflows to run, but keep them non‑required initially. - Fix the most critical contract drift until these jobs are usually green.
- Once they’re stable, mark them as required checks.
-
Introduce the ledger and ACs gradually.
- Start by modeling only one or two critical flows in
specs/spec_ledger.yaml. - Add or tag Gherkin scenarios for those flows with
@AC-####inspecs/features. - Implement or connect acceptance tests in
crates/acceptanceso thatci-acexercises those ACs.
- Start by modeling only one or two critical flows in
-
Turn on AC and feature/flag policy.
- Enable
ACs,Gherkin,Features,Flags, andPrivacyworkflows on PRs. - Make them required once you have coverage for the most important flows.
- Fix policy violations as you touch areas of the system instead of trying to retrofit the entire system in one go.
- Enable
-
Phase in coverage.
- Set a conservative coverage floor (e.g. 30–40%) in
ci-coverage.yml. - Mark
Coverageas required only when you are confident most new work meets it. - Consider higher floors for specific crates (e.g.
crates/core/critical-*).
- Set a conservative coverage floor (e.g. 30–40%) in
-
Move to Standard or Strict profile.
- Once contracts, ACs, and policies are reliable, switch branch protection from Minimal to Standard or Strict, depending on the risk profile of the service.
Use this when you need the template’s full power from day one (e.g. new systems in regulated environments).
- Start as in Greenfield, but set branch protection to Strict immediately.
- Require all relevant contract gates and security jobs.
- Ensure every story/feature that goes live has ACs traced and enforced via
ACs,Gherkin,Features, andFlags. - Keep
ADOPTION.mdin your service updated with any local deviations from this template’s defaults.