Okay, the user wants a documentation-as-code workflow covering lint rules, ownership, preview deployments, and SLOs. Let me break down each component.
First, lint rules: Need to ensure consistency and catch errors early. I should suggest tools like markdownlint for Markdown,awesome-lint for code snippets, and maybe a custom script for link checks. Also, structure with frontmatter for metadata.
Ownership: Clear responsibility is key. Maybe use CODEOWNERS files for auto-assignment, plus a Docs Team for oversight. A central registry for owners and rotation policies to avoid burnout.
Preview deployments: Automated previews for every change. Static site generators like MkDocs or Docusaurus with CI/CD pipelines. Pull request comments with links to previews, plus security scans.
SLOs: Define measurable targets. Availability, uptime, correctness, performance. Use synthetic monitoring and real user metrics. Error budgets and quarterly reviews.
Need to tie it all together in a CI/CD pipeline example, maybe with GitHub Actions. Emphasize automation and clear ownership. Keep it practical but comprehensive.
Documentation-as-Code Workflow
A complete end-to-end workflow for managing technical documentation with engineering rigor.
🎯 Core Principles
Documentation is code: Stored in Git, reviewed via PRs, versioned
# .github/CODEOWNERS
# Global docs team owns everything
* @docs-team @tech-writers
# API references owned by backend team
/docs/api/** @backend-core @api-team
# Deployment guides owned by platform team
/docs/deploy/** @platform-eng @sre-team
# User guides owned by product
/docs/user/** @product-management @design-team
# Security docs have special access
/docs/security/** @security-team (approved reviewers only)
Ownership Registry (docs/OWNERSHIP.md)
markdown
# Documentation Ownership Registry
## Active Owners
| Path | Primary Owner | Secondary Owner | Last Review |
|--------------------------|-------------------|-------------------|-------------|
| `/docs/api/` | api-team@ company | backend-core@ | 2024-01-15 |
| `/docs/deploy/` | platform-eng@ | sre-team@ | 2024-02-01 |
| `/docs/user/` | product@ | design-team@ | 2024-02-10 |
## Orphaned Docs Detection
- Run monthly: `find docs/ -type f -exec grep -L "CODEOWNERS" {} \;`
- Auto-assign to docs-team if no owner found
## Ownership Transfer Protocol
1. Current owner approves transfer
2. New owner acknowledges in PR
3. Update CODEOWNERS and registry
4. 30-day overlap period required
Review Assignment Strategy
yaml
# .github/PULL_REQUEST_TEMPLATE.md
## Ownership Verification
- [ ] This PR affects docs owned by @team-name
- [ ] Primary owner has been requested as reviewer
- [ ] If no owner exists, @docs-team has been tagged
<!-- Add to base layout -->
<script>
// Using SpeedCurve or similar
window.addEventListener('load', () => {
const perfData = {
dns: performance.getEntriesByType('navigation')[0].domainLookupEnd,
ttfb: performance.getEntriesByType('navigation')[0].responseStart,
load: performance.timing.loadEventEnd - performance.timing.navigationStart
};
navigator.sendBeacon('/api/rum', JSON.stringify(perfData));
});
</script>
Error Budget Policy
yaml
# docs-slo-policy.yaml
error_budget:
monthly_budget: 43.8 minutes (0.05% of 30 days)
consumption_criteria:
- availability < 99.95%
- search failure rate > 15%
burn_rate_alerts:
- threshold: 2x (fast burn) → P0 incident
- threshold: 1x (slow burn) → P1 weekly review
burnout_protocol:
- When budget < 50%: Freeze non-critical changes
- When budget < 25%: All changes require VP approval
- When budget = 0: Only security/critical fixes
quarterly_review:
- Re-evaluate targets based on:
- User feedback
- Traffic patterns
- Business impact analysis
SLO Dashboard (Grafana example)
sql
-- Query for availability SLO
SELECT
time,
count_if(status = 'up') * 100.0 / count(*) as availability
FROM uptime_checks
WHERE
time >= now() - INTERVAL '30 days'
AND url = 'https://docs.company.com'
GROUP BY time
⭐ Key Takeaway: Treat documentation with the same rigor as production code—automate quality, measure everything, and make ownership explicit. The goal is trustworthy documentation that developers rely on.