Skip to main content

Generate Architectural Decision Records from simple criteria data.

Project description

ADR Builder

CI PyPI

Create clear, consistent Architectural Decision Records (ADRs) from simple forms or YAML/JSON data — no coding required.

  • Generates Markdown ADRs using the MADR standard
  • Enforces structure and quality with built-in validation
  • Works locally via an easy CLI, or in CI via GitHub Actions
  • Stores ADRs in docs/adr/ with automatic numbering, slugs, and an index

Who is this for?

  • Engineers, product managers, and stakeholders who need to record decisions
  • Teams standardizing how ADRs are written and stored
  • Anyone who wants a guided, non-technical way to produce ADRs

Quick Start (No Coding)

Option A — Guided interactive flow (recommended):

  1. Install (one-time)
    • macOS: brew install pipx && pipx ensurepath
    • All platforms (Python 3.9+): pipx install adr-builder
  2. In your project folder, run:
    • adr init — sets up docs/adr/ and defaults
    • adr new — guided prompts to create an ADR without editing files
  3. Find your ADRs in docs/adr/

Option B — From a simple YAML file:

  1. Create criteria.yaml like this:
title: Database Selection
status: Proposed
authors: ["Jane Doe"]
tags: ["data", "persistence"]
context:
  background: "We need a primary OLTP database."
  constraints:
    - "Managed service"
    - "RTO <= 15m"
  drivers:
    - "Global availability"
    - "Operational simplicity"
options:
  - name: "PostgreSQL (AWS RDS)"
    pros: ["Mature ecosystem", "Managed backups"]
    cons: ["Vertical scaling limits"]
    risks: ["Cost at high scale"]
    score: 8
  - name: "CockroachDB Serverless"
    pros: ["Horizontal scale", "Strong consistency"]
    cons: ["Learning curve"]
    risks: ["Pricing predictability"]
    score: 7
decision:
  chosen: "PostgreSQL (AWS RDS)"
  rationale: "Best balance of maturity and ops simplicity."
consequences:
  positive: ["Familiar tooling", "Reduced ops overhead"]
  negative: ["Limited horizontal scale"]
references:
  links:
    - "https://adr.github.io/madr/"
  1. Generate your ADR:
    • adr generate --input criteria.yaml
  2. Your ADRs are created (e.g., docs/adr/001-database-selection.md and .docx).

Option C — In Pull Requests (GitHub Action):

  • Add our CI workflow, commit criteria.yaml, and the action will generate/update ADRs automatically on PRs. See “CI Integration” below.

Sample criteria.yml

Save this as criteria.yml (or criteria.yaml) and run adr generate --input criteria.yml:

title: Database Selection
status: Proposed
authors: ["Jane Doe"]
tags: ["data", "persistence"]
context:
  background: "We need a primary OLTP database."
  constraints:
    - "Managed service"
    - "RTO <= 15m"
  drivers:
    - "Global availability"
    - "Operational simplicity"
options:
  - name: "PostgreSQL (AWS RDS)"
    pros: ["Mature ecosystem", "Managed backups"]
    cons: ["Vertical scaling limits"]
    risks: ["Cost at high scale"]
    score: 8
  - name: "CockroachDB Serverless"
    pros: ["Horizontal scale", "Strong consistency"]
    cons: ["Learning curve"]
    risks: ["Pricing predictability"]
    score: 7
decision:
  chosen: "PostgreSQL (AWS RDS)"
  rationale: "Best balance of maturity and ops simplicity."
consequences:
  positive: ["Familiar tooling", "Reduced ops overhead"]
  negative: ["Limited horizontal scale"]
references:
  links:
    - "https://adr.github.io/madr/"

Installation

  • Requirements: Python 3.9+ (or use Docker)
  • Easiest: pipx install adr-builder
  • Verify: adr --version
  • Word output requires the docx extra: pipx install 'adr-builder[docx]'

Docker (no Python needed):

docker run --rm -v "$PWD":/work -w /work ghcr.io/OWNER/adr-builder:latest adr --help

Commands

  • adr init
    • Scaffolds docs/adr/, default config, and template
  • adr new
    • Interactive, step-by-step ADR creation (no editing files needed)
    • Generates both Markdown and Word outputs by default
    • Use --format md or --format docx for single format
  • adr generate --input criteria.yaml
    • Creates or updates an ADR from YAML/JSON (Markdown and Word by default)
  • adr generate --input criteria.yaml --format md
    • Generate only a Markdown output
  • adr generate --input criteria.yaml --format docx
    • Generate only a Word document output for non-developers
  • adr validate --input criteria.yaml
    • Checks structure, required fields, and statuses
    • Validates date format, option scores, URL formats, and decision consistency
    • Use --directory to specify project root for config loading
  • adr list
    • Shows existing ADRs, numbers, and slugs
  • adr --version
    • Shows the installed version

Output Format

  • Default template: MADR
  • Default output: Markdown and Word (both)
  • File naming: NNN-slug.{md,docx} (e.g., 001-database-selection.md)
  • Location: docs/adr/
  • Index file: docs/adr/index.md
  • Statuses: Proposed, Accepted, Superseded, Rejected (configurable)

Example generated ADR snippet:

# Database Selection

- Status: Proposed
- Date: 2025-11-06
- Deciders: Jane Doe
- Tags: data, persistence

## Context and Problem Statement
We need a primary OLTP database.
Constraints:
- Managed service
- RTO <= 15m

Decision Drivers:
- Global availability
- Operational simplicity

Templates

  • Ships with MADR by default
  • Support for custom templates via Jinja2
  • Configure defaults in .adr/adr.config.yaml

Use a custom template:

adr generate --input criteria.yaml --template path/to/template.md.j2

CI Integration (GitHub Action)

Add .github/workflows/adr.yml:

name: ADR
on:
  pull_request:
    paths:
      - 'criteria/*.yaml'
jobs:
  build-adr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.9'
      - run: pipx install adr-builder
      - run: adr init
      - run: adr generate --input criteria/main.yaml
      - uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: "chore(adr): generate ADR from criteria"

Troubleshooting

  • “Command not found: adr”
    • Ensure pipx ensurepath was run, then open a new terminal
  • "Python not found"
    • Install Python 3.9+ or use Docker
  • Validation errors
    • Run adr validate --input criteria.yaml to see what to fix

Contributing

  • Issues and PRs welcome
  • Install dev dependencies: pip install -e ".[dev]"
  • Run tests: pytest
  • Lint: ruff check adr_builder/
  • Type check: mypy adr_builder/

Release process

We publish to PyPI via GitHub Actions using version tags.

  1. Bump the version in pyproject.toml and adr_builder/__init__.py
  2. Commit the change to main
  3. Tag and push, e.g.:
    git tag v0.1.3
    git push origin v0.1.3
    

Notes:

  • The Publish to PyPI workflow runs on tags matching v*.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adr_builder-0.1.5.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adr_builder-0.1.5-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file adr_builder-0.1.5.tar.gz.

File metadata

  • Download URL: adr_builder-0.1.5.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adr_builder-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b4826e9b9c4e2c46886c3911f3335fdc7702e67478cdfdabaa82318191462394
MD5 4df878ab4c2403348a3b57397a56aeaf
BLAKE2b-256 ecb72c4ec9b4ca9f6a37a0d0e95700d06e8bb566251ab402f877100e59e3fcfc

See more details on using hashes here.

File details

Details for the file adr_builder-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: adr_builder-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adr_builder-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5af8fb44574f30ec71bd05fdcab558e8a8af859735ec8b8fb5e6a1b22ed44e36
MD5 9a9c1e2058b714a7b89f63952a187e6b
BLAKE2b-256 a6d840ad9cdd1f567cfb4333e015b5cca9b24ffac97e4681bf6ed3b52ce05f5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page