GitScrum / Docs
All Best Practices

Documentation as Code | Version-Controlled Docs

Manage documentation alongside code with version control and automated deployment. GitScrum's NoteVault keeps docs accurate and up-to-date.

5 min read

Documentation as code means treating docs like source code: version controlled, reviewed, tested, and deployed automatically. Good docs-as-code keeps documentation accurate and up-to-date. Poor documentation becomes stale and ignored. This guide covers implementing docs-as-code.

Docs-as-Code Benefits

BenefitDescription
Version controlHistory, branches, diffs
Review processPRs for quality
AutomationBuild, test, deploy
ColocationDocs near code

Implementation

Setting Up

DOCS-AS-CODE SETUP
══════════════════

REPOSITORY STRUCTURE:
─────────────────────────────────────
project/
β”œβ”€β”€ src/
β”‚   └── (code)
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ getting-started.md
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ endpoints.md
β”‚   β”‚   └── authentication.md
β”‚   β”œβ”€β”€ guides/
β”‚   β”‚   β”œβ”€β”€ setup.md
β”‚   β”‚   └── deployment.md
β”‚   └── reference/
β”‚       └── configuration.md
β”œβ”€β”€ README.md
└── CONTRIBUTING.md

TOOLING:
─────────────────────────────────────
Writing:
β”œβ”€β”€ Markdown (most common)
β”œβ”€β”€ AsciiDoc (more features)
β”œβ”€β”€ reStructuredText
└── Plain text format

Building:
β”œβ”€β”€ MkDocs (Python)
β”œβ”€β”€ Docusaurus (React)
β”œβ”€β”€ Hugo (Go)
β”œβ”€β”€ Astro (modern)
β”œβ”€β”€ VuePress
└── Static site generator

CI/CD:
β”œβ”€β”€ Build on PR
β”œβ”€β”€ Preview deployments
β”œβ”€β”€ Deploy on merge
β”œβ”€β”€ Automated pipeline
└── Same as code

Workflow

Documentation Process

DOCS-AS-CODE WORKFLOW
═════════════════════

WRITING:
─────────────────────────────────────
1. Create branch
   git checkout -b docs/add-api-guide

2. Write docs
   Edit docs/api/new-feature.md

3. Local preview
   mkdocs serve

4. Commit
   git add docs/
   git commit -m "docs: add API guide"

5. Push and PR
   git push origin docs/add-api-guide

REVIEW:
─────────────────────────────────────
PR includes:
β”œβ”€β”€ Content accuracy check
β”œβ”€β”€ Technical review
β”œβ”€β”€ Link validation
β”œβ”€β”€ Style consistency
β”œβ”€β”€ Preview deployment
└── Same as code review

DEPLOY:
─────────────────────────────────────
On merge:
β”œβ”€β”€ CI builds docs
β”œβ”€β”€ Static site generated
β”œβ”€β”€ Deployed to hosting
β”œβ”€β”€ Live in minutes
β”œβ”€β”€ Automated
└── No manual steps

Keeping Docs Current

Documentation Maintenance

KEEPING DOCS CURRENT
════════════════════

DOCS IN SAME PR:
─────────────────────────────────────
When changing code:
β”œβ”€β”€ Update relevant docs
β”œβ”€β”€ Same PR, same review
β”œβ”€β”€ Can't forget
β”œβ”€β”€ Atomic change
└── Best practice

DEFINITION OF DONE:
─────────────────────────────────────
DoD includes:
β”œβ”€β”€ ☐ Code complete
β”œβ”€β”€ ☐ Tests pass
β”œβ”€β”€ ☐ Docs updated ← Required
β”œβ”€β”€ ☐ Reviewed
└── Docs not optional

AUTOMATED CHECKS:
─────────────────────────────────────
CI checks:
β”œβ”€β”€ Broken link detection
β”œβ”€β”€ Markdown linting
β”œβ”€β”€ Spell checking
β”œβ”€β”€ Build success
β”œβ”€β”€ Fail if docs broken
└── Quality gates

OWNERSHIP:
─────────────────────────────────────
β”œβ”€β”€ Each doc has owner
β”œβ”€β”€ Regular review cycle
β”œβ”€β”€ Stale docs flagged
β”œβ”€β”€ Responsibility clear
└── Maintained docs

REVIEW CYCLE:
─────────────────────────────────────
β”œβ”€β”€ Monthly: Quick scan
β”œβ”€β”€ Quarterly: Deep review
β”œβ”€β”€ Remove outdated content
β”œβ”€β”€ Update screenshots
β”œβ”€β”€ Refresh examples
└── Regular maintenance

Documentation Types

What to Document

DOCUMENTATION TYPES
═══════════════════

README:
─────────────────────────────────────
β”œβ”€β”€ Project overview
β”œβ”€β”€ Quick start
β”œβ”€β”€ Installation
β”œβ”€β”€ Basic usage
β”œβ”€β”€ Links to more docs
└── First impression

API REFERENCE:
─────────────────────────────────────
β”œβ”€β”€ Endpoint documentation
β”œβ”€β”€ Parameters
β”œβ”€β”€ Request/response examples
β”œβ”€β”€ Error codes
β”œβ”€β”€ Generated from code when possible
└── Technical accuracy

GUIDES/TUTORIALS:
─────────────────────────────────────
β”œβ”€β”€ Step-by-step instructions
β”œβ”€β”€ Common use cases
β”œβ”€β”€ Getting started
β”œβ”€β”€ How to achieve goal
└── Task-oriented

ARCHITECTURE:
─────────────────────────────────────
β”œβ”€β”€ System overview
β”œβ”€β”€ Component diagrams
β”œβ”€β”€ Design decisions (ADRs)
β”œβ”€β”€ High-level structure
└── Understanding system

RUNBOOKS:
─────────────────────────────────────
β”œβ”€β”€ Operational procedures
β”œβ”€β”€ Incident response
β”œβ”€β”€ Deployment steps
β”œβ”€β”€ Troubleshooting
└── Operations docs

GitScrum Integration

Docs in GitScrum

GITSCRUM FOR DOCUMENTATION
══════════════════════════

DOC TASKS:
─────────────────────────────────────
β”œβ”€β”€ Create tasks for doc work
β”œβ”€β”€ Label: documentation
β”œβ”€β”€ Include in sprints
β”œβ”€β”€ Track like other work
└── First-class work

NOTEVAULT:
─────────────────────────────────────
β”œβ”€β”€ Internal team docs
β”œβ”€β”€ Decision records
β”œβ”€β”€ Meeting notes
β”œβ”€β”€ Project context
└── Team knowledge

DEFINITION OF DONE:
─────────────────────────────────────
Template includes:
β”œβ”€β”€ ☐ Docs updated
β”œβ”€β”€ ☐ README current
β”œβ”€β”€ ☐ API docs if applicable
└── Built-in requirement

REVIEW TASKS:
─────────────────────────────────────
β”œβ”€β”€ Quarterly doc review tasks
β”œβ”€β”€ Assign to team members
β”œβ”€β”€ Rotate responsibility
β”œβ”€β”€ Track completion
└── Regular maintenance

Best Practices

For Docs-as-Code

  • Same repo β€” Docs live with code
  • Same workflow β€” PRs for docs too
  • Automated build β€” CI/CD for docs
  • Update together β€” Code + docs = one PR
  • Review regularly β€” Prevent staleness
  • Anti-Patterns

    DOCUMENTATION MISTAKES:
    βœ— Docs in separate system
    βœ— No version control
    βœ— Manual deployment
    βœ— No review process
    βœ— Update docs later (never)
    βœ— No ownership
    βœ— Stale documentation
    βœ— Wiki nobody maintains
    

    Related Solutions