Actionable rules for planning, writing, versioning, and deploying high-quality technical documentation with Markdown, GitOps, and modern DocOps tooling.
Your team's documentation doesn't have to be a bottleneck. While developers are shipping code at lightning speed, documentation often becomes the forgotten stepchild—outdated, scattered, and painful to maintain. These DocOps Cursor Rules transform documentation from a necessary evil into a streamlined, automated extension of your development workflow.
Every development team knows the pain:
The result? Teams spend 30-40% of their time hunting for information that should be instantly accessible, and new developers take weeks longer to become productive.
These Cursor Rules implement a DocOps methodology that treats documentation with the same rigor as your codebase. Instead of fighting separate systems and manual processes, you get:
Automated Quality Gates: Every documentation change goes through the same CI/CD pipeline as your code—markdown linting, spell checking, broken link detection, and style guide enforcement happen automatically.
Living Documentation: Documentation lives alongside your code in the same repository, versioned together, and updated through the same pull request workflow developers already know.
AI-Assisted Writing: Generate first drafts with AI tools, then refine through peer review—combining speed with accuracy.
Before: Developer finishes feature implementation, then separately opens Confluence, writes documentation, waits for review, manually updates after feedback.
With DocOps Rules: Documentation written in Markdown alongside feature code. Pull request includes both code and docs. CI validates documentation quality. Documentation deploys automatically with feature release.
Time Saved: 2-3 hours per feature from streamlined workflow.
Before: API changes require manually updating separate documentation site, often forgotten until customer complaints surface.
With DocOps Rules: API documentation auto-generates from code annotations. Version changes trigger automatic documentation updates. Broken examples caught in CI before deployment.
Impact: Zero-lag documentation updates and 90% reduction in documentation-related support tickets.
Before: New developers hunt through multiple wikis, outdated README files, and Slack conversations to understand setup procedures.
With DocOps Rules: Interactive onboarding guides with embedded code editors, automatic screenshot updates, and troubleshooting sections based on common failure patterns.
Result: Developer onboarding time reduced from 2 weeks to 3 days.
# Add documentation structure to existing repository
mkdir -p docs/{getting-started,api,deployment}
mkdir -p docs/assets/{getting-started,api,deployment}
Add to your .github/workflows/docs.yml:
name: Documentation CI
on: [pull_request]
jobs:
docs-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint Markdown
run: markdownlint docs/
- name: Check Links
run: markdown-link-check docs/**/*.md
- name: Spell Check
run: cspell "docs/**/*.md"
Create docs/style-guide.md with team-specific rules:
# Writing Style Guide
## Voice and Tone
- Write in second person ("you" not "we")
- Use active voice
- Keep sentences under 25 words
## Code Examples
- Always include working examples
- Test all code snippets in CI
- Provide context for each example
Add documentation review to your pull request template:
## Documentation Checklist
- [ ] New features include documentation updates
- [ ] Code examples tested and working
- [ ] Screenshots updated if UI changed
- [ ] Accessibility guidelines followed
Configure automated updates:
# Auto-generate API docs
- name: Generate API Documentation
run: sphinx-apidoc -o docs/api src/
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Your documentation workflow should accelerate development, not slow it down. These DocOps rules eliminate the friction between writing code and writing docs, creating a seamless experience that keeps your team's knowledge current and accessible.
Ready to transform your documentation from a maintenance burden into a productivity multiplier? Implement these rules and watch your team's efficiency soar.
You are an expert in Markdown, MDX, reStructuredText, AsciiDoc, Sphinx, Docusaurus, Git, CI/CD, DocOps automation, and AI-assisted documentation.
Key Principles
- Documentation is code: keep it in the same repo, gated by the same review & CI rules.
- Prioritise clarity, brevity, and plain language. Write for the least experienced reader who will use it.
- Prefer task-oriented docs ("How do I …?") over narrative or reference when introducing concepts.
- Treat docs as a living product: iterate often, automate updates, version them alongside code.
- Optimise discoverability: search must surface the right doc within 3 clicks/keywords.
- Visual first: diagrams, screenshots, GIFs, or Loom clips when they explain faster than text.
- Accessibility is non-negotiable: comply with WCAG 2.1 AA for colour contrast, alt text, and keyboard navigation.
- Review docs in pull requests like code; require at least one peer review before merge.
Markdown (and Friends)
- Headings: use ATX style (#) only; never skip levels (`##` must follow `#`).
- One H1 (`# Title`) per page; file name mirrors H1 in kebab-case (e.g., `deploying-on-aws.md`).
- Sentences end with a period, even in list items.
- Lists: use `-` for unordered, `1.` for ordered; indent 2 spaces for nesting.
- Code blocks: fenced (```lang). Always specify language for syntax highlighting.
- Links: always relative inside repo (`../getting-started.md`), absolute for external; nothing ending with trailing slash.
- Images: store in `/assets/<topic>/`; filename lowercase, dashed, no spaces. Provide descriptive `alt`.
- Tables: avoid if list or paragraph conveys info. If needed, pipe format and header row.
- Front-matter (for SSGs):
```yaml
---
title: Deploying on AWS
description: Step-by-step guide for deploying our app on Amazon Web Services.
sidebar_position: 3
---
```
- Inline HTML is forbidden unless Markdown cannot express the same (call-outs, interactive widgets).
Error Handling and Validation
- Each doc must include a "Troubleshooting" or "FAQ" section if failure paths exist.
- Use call-out blocks for warnings & tips:
```md
> **Warning**
> Deleting the cluster is irreversible.
```
- Add version banners when steps differ by release (`:::info Version ≥ 2.0` style in Docusaurus).
- CI pipeline runs the following on every PR:
1. Markdown lint (`markdownlint`, `remark-lint`).
2. Spell check with allow-list (`cspell`).
3. Broken link & image checker.
4. Style guide enforcement via Vale.
- Fail fast: if any lint/test fails, block merge.
Framework-Specific Rules (Sphinx & Docusaurus)
Sphinx
- Use `sphinx-contrib.mermaid` for diagrams; source `.mmd` lives with the document.
- `conf.py` must enable:
```python
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx.ext.githubpages",
"sphinx_copybutton",
]
```
- Autogenerate API docs by running `sphinx-apidoc` in CI when Python modules change.
Docusaurus
- Place docs in `docs/`, sidebars in `sidebars.js`. Use autogenerated sidebars by default.
- Doc versioning tags: `docusaurus docs:version 2.3` executed on release cut.
- MDX for interactive snippets; prefer `Sandpack` for live code.
- Global reusable admonitions live in `src/components/common/Admonitions.jsx`.
Additional Sections
Testing
- Embed runnable code blocks via live editors (CodeSandbox, Repl.it, Sandpack) where sample code < 100 lines.
- Provide unit tests as examples when doc describes APIs.
- Post-merge, run `doctest` (Python) or `mdx-jest` (JS) to ensure snippets compile.
Performance
- Enable incremental static builds (Sphinx `sphinx-build -j auto`; Docusaurus `--no-watch`) in CI.
- Cache dependency layers (`node_modules`, `.cache`, `_build`) between CI runs.
- Use image optimisation (`svg` preferred, else WebP, <150 KB) and lazy loading.
Security
- Secrets scanning (GitGuardian) on all docs commits.
- Review embedded commands for `rm -rf`, `curl | sh`, or dangerous defaults; require explicit call-outs.
- Sanitise user-generated content before publishing (if docs site has comments/examples).
Version Control & Workflow
- Branch naming: `docs/<area>/<short-description>` (e.g., `docs/auth/signup-flow`).
- Pull request template includes sections: Purpose, Preview URL, Screenshots/GIFs, Reviewer checklist.
- Use GitHub Actions to deploy previews per PR with `docusaurus-deploy-action` or `Netlify Preview`.
Automation & AI
- Enable auto-labeling of PRs based on changed paths (`docs-labeler.yml`).
- Use AI (Document360, GitHub Copilot) for first draft generation, but require human review before merge.
- Scheduled job (`cron`) every Monday runs `linkinator` against prod site and opens an issue if failures >0.
Accessibility Checklist (WCAG 2.1 AA)
- Heading order logical (no skipped levels).
- Colour contrast ratio ≥ 4.5:1.
- All images have meaningful alt text or `role="presentation"`.
- Interactive elements reachable via keyboard; no `tabindex="-1"`.
- Captions for videos; transcripts for Loom clips.
Glossary & Style Guide
- Maintain `/style/style-guide.md`; enforce via Vale rules (e.g., prefer “sign in” over “login”).
- Abbreviations spelled out on first use (`Continuous Integration (CI)`).
- Use sentence case for headings (except proper nouns).
Directory Structure Example
```
📚 docs/
├── getting-started/
│ ├── index.md
│ └── troubleshooting.md
├── deployment/
│ ├── aws.md
│ └── gcp.md
├── api/
│ ├── index.md
│ └── reference.md
└── assets/
└── deployment/
└── aws-architecture-diagram.svg
```
Commit Message Convention (docs-specific)
- Prefix with `docs:` (e.g., `docs: add GPU troubleshooting section`).
- If autogenerated by CI, prefix with `chore(docs):`.
By adhering to these rules, teams will deliver consistent, accurate, and maintainable documentation integrated seamlessly with their software delivery lifecycle.