Skip to content

Lesson 4 of 9 · 22m

The Docs Repository Is a Product Surface

Organize content, metadata, ownership, navigation, and assets so documentation can evolve safely with the software it describes.

Documentation teams often say "docs as code" and mean "we store Markdown in git." That is the easy part. The real change is treating the repository as a product surface: navigation is an API, metadata is a schema, ownership is operational responsibility, and breaking a link is a user-facing regression.

Choose structure that reflects reader jobs

A directory tree should help authors enforce intent. One workable shape is:

docs/
  getting-started/
    first-audit.md
  how-to/
    rotate-api-token.md
    restore-backup.md
  reference/
    cli/audit.md
  explanation/
    architecture.md
  troubleshooting/
    agent-offline.md

This is not the only valid layout. The important property is that authors know where a page belongs and readers can predict where to look. If tutorials, procedures, and reference are mixed randomly, quality depends on individual memory rather than the system.

Metadata is a contract

Frontmatter looks trivial until search, navigation, versioning, ownership, and review automation all depend on it. Keep the schema small and enforced:

---
title: Rotate an expired API token
description: Replace a legacy integration token after authentication fails with token_expired.
kind: how-to
owner: platform-security
review_after: 2027-01-15
---

kind prevents accidental mixing of document types. owner is a team, not a person who might leave. review_after makes freshness an explicit operational property rather than a hope.

URLs are commitments

Cool URLs survive redesigns. When a page moves, redirect it. A redirect map can be boring and still be one of the highest-value files in the repository:

/docs/cli-reference        /docs/reference/cli/audit
/docs/token-expired        /docs/how-to/rotate-api-token
/docs/backup-recovery      /docs/how-to/restore-backup

Search engines, customer bookmarks, support macros, release notes, and old error messages all point at documentation. Deleting or renaming pages without redirects creates dead ends that no amount of prose quality can repair.

Assets need discipline too

Keep diagrams, screenshots, sample files, and generated artifacts close to the pages that use them. Name them after purpose rather than dates or editors:

restore-backup/
  index.md
  staging-restore-dialog.png
  backup-policy-flow.svg

For diagrams, prefer source formats that can be edited later. A PNG exported from someone's private diagram tool is write-only documentation. Commit Mermaid, Excalidraw, draw.io XML, or another maintainable source when possible.

Ownership must be operational

Every page should have a team that can answer three questions: is this still true, who can update it, and what happens when it is wrong? CODEOWNERS can route reviews:

docs/reference/api/        @sudosecurity/api-maintainers
docs/how-to/billing/       @sudosecurity/billing-team
docs/explanation/          @sudosecurity/architecture

Ownership does not mean only that team may write. It means someone is accountable for accuracy and review latency.

Field notes

  • Do not let the navigation file become a junk drawer; if every page is top-level, none of them are.
  • Generated API reference still needs human-written authentication, errors, examples, and versioning context.
  • File names are part of search and support workflows; use stable slugs rather than clever titles.
  • A docs repository without a local preview command will accumulate formatting mistakes because authors cannot see what they ship.

Was this lesson helpful?

Sign in to rate