Skip to content

Documentation as Infrastructure: Scaling Knowledge Across Engineering Teams

Treat docs as infrastructure: ADRs for decisions, generated reference, CI checks for frontmatter and links, review-by dates for freshness and one map of where docs live.

Ayhan Sipahi Ayhan Sipahi

Documentation debt slows engineering teams in ways that look fine until the wrong person leaves. The cost surfaces during a payment incident, a migration, or an audit: the written procedure exists but the deep system understanding doesn’t. The documentation that survives that moment has three layers: decisions captured as RFCs and ADRs, system reference generated from the systems themselves, and process docs written from real examples. Everything else is tooling and the review habits that keep those three layers current.

Wiki Graveyards and README Roulette#

The same shapes keep showing up, whatever the tool. A Confluence space grows to thousands of pages and most of them go stale, so a search for “authentication” returns hundreds of hits with no way to tell which one is current. README quality runs from excellent to absent because every repository sets its own standard, and new engineers end up guessing which file to trust. The architectural decision that would settle the guess usually lives in a #general thread nobody can find, or in a DM nobody else can read.

Then there is the billing system that exactly one person understands. They answer questions about it all day, and the knowledge walks out with them. What does get written down often lands in hundreds of Google Docs with no shared format, which turns “why was this designed this way” into an archaeology problem. Measuring that kind of concentration and moving the knowledge out of one head is the subject of Bus Factor in Engineering Teams. The sections below take the next step: the information architecture, tools and checks that keep written knowledge findable and current.

The tool in use matters far less than how a team thinks about information architecture. Adding more pages to Confluence or Notion won’t fix it; without ownership and a review habit, even a well-structured wiki goes stale.

Documentation Debt vs Technical Debt#

We spend a lot of time discussing technical debt, but documentation debt can be even trickier to spot. Technical debt usually shows up in slower deployments or harder maintenance. Documentation debt shows up when teams start second-guessing decisions they made six months ago because no one remembers the reasoning.

The cost lands in three places. Day to day, it lands on onboarding time, on the interruptions senior engineers absorb, and on two teams solving the same problem without knowing it. Underneath that sit the quieter costs: repeating mistakes the organization already made, and hesitating to change systems nobody can explain. In a crisis it becomes an incident that runs long because the person who understands the system is unreachable, or an audit where nobody can reconstruct why a control was designed that way.

Published research points the same way. The documentation chapter of Software Engineering at Google reports that documentation quality became the number one developer complaint on Google’s annual developer surveys. DORA’s 2022 research found documentation quality driving the implementation of every technical practice it studied, and the payoff of those practices grew with it. Continuous integration lifted organizational performance by 34% in teams with below-average documentation quality and by 750% in teams with above-average documentation quality. Documentation works as a multiplier on the practices a team already invests in.

A Three-Layer Documentation Approach#

Each layer has its own update rhythm, which is the reason to keep them apart:

The Decision Record#

This is where the reasoning behind choices lives. Not what you built, but why you built it that way.

/docs
  /decisions  # ADRs - architecture decisions made
  /proposals  # RFCs - future changes being considered  
  /discussions  # RFDs - open problems being explored

Size the document to the blast radius. A reversible, single-team call fits in a one to two page mini-RFC turned around in a week. A multi-team change with real investment behind it justifies five to ten pages and a two to four week review. Company-wide architecture shifts run longer on both counts.

System Reference That Regenerates Itself#

This describes your current reality. What exists, how it connects, who owns it.

/docs/systems
  /service-catalog  # What services exist, who owns them
  /architecture  # How systems connect and communicate
  /runbooks  # How to operate and troubleshoot
  /dependencies  # What depends on what

This layer works best when it is mostly automated. Hand-written system docs go stale the moment they are finished. Documentation derived from OpenAPI schemas, Terraform state, or CI pipelines updates alongside the change that made it stale.

Process Docs Built From Examples#

How you work, how you make decisions, how you handle incidents.

/docs/processes
  /engineering  # How we design, build, and review
  /oncall  # How we respond to incidents
  /releases  # How we deploy and rollback
  /hiring  # How we evaluate and onboard

Concrete examples work better here than abstract guidelines. A walkthrough of how one incident was actually handled gives a new engineer more to copy from than a list of principles does.

The Design Doc Format#

Google’s design doc culture is the version of this with published guidance behind it: a collaborative technical document that goes through peer review, with the argument in the text and the discussion in the comments. The elements that carry the weight:

  • Context and Scope - What are we solving?
  • Goals and Non-Goals - What success looks like
  • Design - How we’ll solve it
  • Alternatives - What we considered and rejected
  • Cross-cutting Concerns - Security, performance, monitoring

Alternatives is the section teams skip. Without it, the next reader cannot tell whether the obvious option was considered and rejected, or never considered at all.

Validating Docs in CI#

The checks that keep a docs tree honest belong in the same pipeline as the code. The setup below assumes the three layers live in one MkDocs site under docs/ and that every page opens with a small frontmatter block:

---
status: accepted        # decision records only, using MADR's status values
owner: payments-team
review_by: 2026-06-30
---

owner names who answers for the page. review_by is the date by which that owner confirms the page still holds. Google’s documentation chapter describes the same idea as freshness dates, and reports that adding the owner through a “Last reviewed by” byline increased adoption.

A short script enforces the block. It runs on Node.js 22.18 or later, which executes TypeScript files directly by stripping the types, and it needs the yaml package:

// scripts/check-doc-frontmatter.ts
// Usage: node scripts/check-doc-frontmatter.ts docs
import { readFileSync, readdirSync } from "node:fs";
import { join } from "node:path";
import { parse } from "yaml";

const STATUSES = ["proposed", "accepted", "rejected", "deprecated", "superseded"];
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
const today = new Date().toISOString().slice(0, 10);

function frontmatter(text: string): Record<string, unknown> | null {
  const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n/.exec(text);
  if (!match) return null;
  const data: unknown = parse(match[1]);
  return data !== null && typeof data === "object" ? (data as Record<string, unknown>) : null;
}

const root = process.argv[2] ?? "docs";
const errors: string[] = [];

for (const entry of readdirSync(root, { recursive: true, encoding: "utf8" })) {
  if (!entry.endsWith(".md")) continue;
  const path = join(root, entry);
  const meta = frontmatter(readFileSync(path, "utf8"));
  if (!meta) {
    errors.push(`${path}: no frontmatter`);
    continue;
  }

  if (!meta.owner) errors.push(`${path}: missing owner`);
  const reviewBy = String(meta.review_by ?? "");
  if (!ISO_DATE.test(reviewBy)) {
    errors.push(`${path}: review_by must be a YYYY-MM-DD date`);
  } else if (reviewBy < today) {
    // A warning, not a failure: an overdue page elsewhere should not block this PR.
    console.log(`::warning file=${path}::review_by ${reviewBy} has passed`);
  }

  if (entry.startsWith("decisions/")) {
    // MADR allows "superseded by ADR-0123", so only the first word is checked.
    const status = String(meta.status ?? "").split(" ")[0];
    if (!STATUSES.includes(status)) {
      errors.push(`${path}: status must start with one of ${STATUSES.join(", ")}`);
    }
  }
}

for (const error of errors) console.log(`::error::${error}`);
process.exit(errors.length > 0 ? 1 : 0);

The workflow splits the checks by how reliable they are:

# .github/workflows/docs.yml
name: docs
on:
  pull_request:
    paths: ['docs/**', 'mkdocs.yml', 'scripts/check-doc-frontmatter.ts']
  schedule:
    - cron: '0 6 * * 1'   # weekly external link sweep
  workflow_dispatch:

jobs:
  validate:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - name: Check frontmatter
        run: |
          npm install --no-save yaml@2
          node scripts/check-doc-frontmatter.ts docs
      - uses: actions/setup-python@v5
        with:
          python-version: '3.13'
      - name: Build the site and fail on broken internal links
        run: |
          pip install mkdocs-material mkdocs-redirects
          mkdocs build --strict

  external-links:
    if: github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    permissions:
      contents: read
      issues: write
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - name: List pages past review_by
        run: |
          npm install --no-save yaml@2
          node scripts/check-doc-frontmatter.ts docs || true
      - name: Check links
        id: lychee
        uses: lycheeverse/lychee-action@v2
        with:
          args: --no-progress 'docs/**/*.md'
          fail: false
      - name: Open an issue with the report
        if: steps.lychee.outputs.exit_code != 0
        uses: peter-evans/create-issue-from-file@v5
        with:
          title: Broken links in docs
          content-filepath: ./lychee/out.md
          labels: docs

Pull requests run the two deterministic checks. MkDocs warns by default when a nav entry or a page link points to a document that does not exist, and --strict turns those warnings into a failed build. External links are a different problem: a third-party site that is down for an hour should not turn an unrelated pull request red. They run weekly with lychee instead, and a failure opens an issue for the docs champion to triage. The weekly run also repeats the frontmatter check without failing, so pages past review_by get flagged even in a week with no docs pull request.

Tool stack that works well in practice:

  • MkDocs Material - Searchable documentation site, with strict builds as the internal link check
  • MADR - ADR template whose YAML front matter carries the status and date
  • lychee - Link checker for the scheduled external link job
  • PlantUML/Mermaid - Version-controlled architecture diagrams
  • GitHub Actions - Validation and publishing

Naming Decision Roles With DACI#

For any significant technical decision, the DACI framework (Driver, Approver, Contributors, Informed) keeps the roles clear:

# RFC-042: Database Migration Strategy

## DACI Matrix
- **Driver:** Database Team Lead
  - Responsible for gathering input and driving to decision
  - Owns the timeline and process
  
- **Approver:** VP Engineering  
  - Makes the final call
  - Accountable for the outcome
  
- **Contributors:** Backend Teams, SRE, Security, Data Engineering
  - Provide input and expertise
  - Will be impacted by the decision
  
- **Informed:** All Engineering, Product, Finance
  - Need to know the outcome
  - May need to adjust their plans

## Decision Timeline
- **Week 1:** Stakeholder interviews and requirements gathering
- **Week 2:** Technical evaluation and proof of concepts
- **Week 3:** Cost analysis and migration planning
- **Week 4:** Final decision and communication

This framework helps avoid the “too many cooks” situation while still making sure people feel heard. Getting the balance right takes some trial and error.

Documentation Champions#

Documentation culture is hard to mandate from above; it grows or it doesn’t. What can be arranged are the conditions. One arrangement that works is naming a documentation champion per team: someone who runs the RFC reviews, checks that new systems ship with docs, flags gaps and stale pages, and coaches teammates on the templates. It is a few hours a week at most, and the role should rotate before it turns into a permanent second job.

Metrics That Predict Trouble#

A documentation metric is only useful when someone can collect it without running a survey. Each signal below names where its number comes from:

SignalWhat it showsWhere the number comes from
Pages past review_byFreshness, as confirmed by the page ownerThe CI frontmatter check, which prints a warning for each overdue page in the weekly run and on docs pull requests
Repeat questionsAnswers that should be in the docs and are notA Slack reaction or tag that whoever answers adds when the docs did not cover the question, counted per month
Zero-result searchesTopics readers look for and cannot findThe docs site’s search analytics, if the search tool records queries
Systems with more than one active maintainerHow widely operating knowledge is spreadCommit and review history per path, read as in Reading Ownership From Commits and Reviews
RFC review participationWhether decisions get more than one pair of eyesDistinct reviewers on pull requests under docs/proposals
Broken linksLink rotmkdocs build --strict on pull requests and the weekly lychee issue
Pages with no views in 90 daysArchive candidatesPage views from the docs site’s analytics

Two common metrics are left out on purpose. Average days since the last update rewards the wrong behavior, because a typo fix resets the counter without anyone checking the content; the review_by date measures a deliberate check by the owner. Days from hire to first commit mostly measures access requests and laptop setup. Questions that new hires tag in the onboarding channel say more about the onboarding docs.

In a monthly review, the questions worth asking are which knowledge gaps caused delays, which questions came up more than once, which documents are going stale, and where people are looking for answers outside the documentation system.

Where Documentation Changes the Outcome#

The on-call engineer is often someone who has never run the rollback procedure, and the person who built the system may be unreachable that night. A runbook earns its place when it has been rehearsed and updated often enough to still work under that pressure.

Integrations after an acquisition or a reorg put the same problem on a slower clock. Most of the schedule goes to reconstructing why the other side built things the way they did. Where that reasoning already exists as ADRs and design docs, the reconstruction step drops out of the plan and the migration work starts earlier.

Audits ask the question in writing. Auditors want to know why access controls and data handling were designed the way they are, and the current configuration alone does not carry that reasoning; a trail of ADRs is what carries it. Without one, the team rebuilds its own rationale from memory while the audit clock runs.

Picking a Documentation Tool#

The choice usually comes down to constraints. A hard Jira dependency or a compliance requirement pins you to Confluence. A security review that approves only the Microsoft 365 tenant the company already runs pins you to SharePoint. What is left comes down to who writes and who reads: product specs go where the PMs already work, API docs go where they can sync from OpenAPI specs, and engineering decisions go next to the code that implements them.

Making a Corporate Wiki Survivable#

When Confluence or SharePoint is mandatory, most of the pain comes from how the space is organized. Split spaces by audience so engineering RFCs and product PRDs never share a search index. Put the date in the page title ([2024-01-22] Database Migration RFC), because chronology survives a bad search result. Template every page type, archive old pages with labels so they stop competing with current ones, and keep OneNote out of the wiki role, since its notebooks sit outside the templates and labels that keep a space navigable. On SharePoint, checkout/checkin covers version control and Power Automate covers approvals.

Service Catalog Entries#

Backstage starts earning its keep when “which service is this and who owns it” no longer has an obvious answer. The catalog entry becomes the front door to a service’s documentation, and it lives in the service repository next to the docs themselves:

# catalog-info.yaml at the repository root
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: payment-service
  description: Handles payment processing
  annotations:
    backstage.io/techdocs-ref: dir:.
    pagerduty.com/service-id: PXXXXXX
spec:
  type: service
  owner: platform-team
  lifecycle: production

backstage.io/techdocs-ref: dir:. tells TechDocs that the documentation source sits in the same repository as the catalog file. TechDocs then builds the site from the mkdocs.yml next to it and the pages under docs/:

# mkdocs.yml, next to catalog-info.yaml
site_name: payment-service
nav:
  - Home: index.md
  - Runbooks: runbooks/index.md
plugins:
  - techdocs-core

pagerduty.com/service-id connects the entity to the PagerDuty plugin; the ID comes from the service’s URL in the PagerDuty console. The plugin also accepts pagerduty.com/integration-key, but its documentation recommends the service ID. In service repositories like this one, the CI build step installs mkdocs-techdocs-core in place of Material, since that is the plugin the mkdocs.yml names.

Where Each Kind of Doc Lives#

One map covers the whole split, with the reason for each home and for each place to avoid. When Confluence or SharePoint is mandated, it takes the product spec row and the wiki advice above applies.

ContentHomeWhyKeep it out of
Decisions (ADRs, RFCs)Markdown in Git, published with MkDocsReviewed in the same pull request as the code they explainA wiki edited outside code review, where approvals leave no trail
RunbooksMkDocs, or TechDocs in the service repositoryThey pass the same CI checks and sit next to the service’s catalog entryOneNote, whose notebooks sit outside review and link checks
API referenceGenerated from the OpenAPI file in the service repository, for example as a Backstage API entityThe spec and the code change in the same commitHand-written wiki pages, which drift as the spec changes
Product specsNotion, or the company’s ConfluencePMs already write and comment thereWord files on shared drives, where nobody can tell which copy is current
Service catalogBackstage catalog-info.yamlOwnership and links are versioned with the serviceA spreadsheet that nobody updates when ownership moves
Team how-tos and notesThe same MkDocs siteOne search and one access model for the whole teamPersonal Obsidian vaults as the shared source: a vault is a local folder, so others see nothing until a sync layer such as Obsidian Sync or Git is set up

A split stack only works when everyone knows which tool holds what. The question “Where’s the RFC?” should have a single answer that any team member can give without searching several systems first.

The redirect map is the step teams skip. Every bookmark and every link pasted into a Slack thread points at the Confluence host, so the redirects have to live on that host. The mkdocs-redirects plugin cannot do this job. It writes redirect pages into the new site for old Markdown paths, which helps when pages move inside the new site later, but a request for /display/ENG/... never reaches it.

Confluence Data Center addresses a page in several ways. The title form /display/ENG/Page+Title breaks when the page is renamed. The ID form /pages/viewpage.action?pageId=123456 survives renames and moves between spaces, and tiny links (/x/...) are generated from the page ID. On Data Center 7.18 and later, /rest/api/content/scan?spaceKey=ENG lists every page with its id, its title, and its webui and tinyui links, which is the raw material for the map.

Start with the HTML export of the space, converted with pandoc into a staging folder outside docs/:

# Confluence HTML space export, unzipped into export/
mkdir -p import
find export -name '*.html' | while read -r page; do
  pandoc -f html -t gfm --extract-media=import/media \
    "$page" -o "import/$(basename "$page" .html).md"
done

Pages then move into docs/ one at a time, each picking up an owner and a review_by on the way. The move is also the natural point to drop pages nobody needs. As each page lands, its ID, title link and tiny link go into a redirect map served on the old hostname:

# Old wiki hostname. Both maps belong in the http {} block.
map $arg_pageId $doc_by_id {
    default  "";
    123456   https://docs.internal/systems/runbooks/payments-rollback/;
    123789   https://docs.internal/decisions/0007-event-bus/;
}

map $uri $doc_by_path {
    default                          "";
    /display/ENG/Payments+Rollback   https://docs.internal/systems/runbooks/payments-rollback/;
    # Plain map strings ignore case; tiny links need a case-sensitive regex
    "~^/x/a4OcE$"                    https://docs.internal/systems/runbooks/payments-rollback/;
}

server {
    listen 80;                       # TLS settings omitted
    server_name wiki.internal;

    location = /pages/viewpage.action {
        if ($doc_by_id) { return 301 $doc_by_id; }
        proxy_pass http://confluence-app;
    }

    location / {
        if ($doc_by_path) { return 301 $doc_by_path; }
        proxy_pass http://confluence-app;
    }
}

Unmapped pages keep loading from Confluence, so the migration can run space by space. When Confluence is finally switched off, the proxy_pass lines give way to a redirect to the new site’s start page, and the hostname stays alive only for the map. Confluence Cloud runs on Atlassian’s domain, so there is no proxy to put in front of it; the fallback there is a short stub on each old page that links to its new home.

Consistency and Freshness#

Shared templates and a shared review path scale better than letting every team invent its own format. A reader who knows the shape of one RFC can find their way through any of them, including ones written by teams they have never worked with.

Freshness matters more than polish. A decent document that gets updated beats a perfect one that has gone stale, so the effort belongs in making updates cheap: a review slot inside a meeting that already exists, a link checker in the pipeline, an owner and a review_by date named on the page.

When This Approach Pays Off#

Documentation-as-infrastructure pays off when knowledge turnover is high, systems are complex enough that no single person holds the full picture, or onboarding friction regularly slows delivery. It is a poor fit for single-engineer projects or short-lived prototypes where the cost of maintenance outweighs the benefit. A reasonable first step is a single ADR covering the decision that caused the most confusion this quarter.

References#

Related posts