plugins/documentation-testing/skills/doc-testing-patterns/SKILL.md
# Documentation Testing Patterns ## The Documentation Testing Pyramid Analogous to the software testing pyramid, documentation testing should be layered: ``` E2E (manual, periodic) / Can a real user follow the guide? \ / \ Integration (automated, weekly) / Cross-file links, external URLs \ / \ Unit (automated, every PR) Prose style, code execution, internal anchors, markdown formatting
npx skillsauth add hermeticormus/librecopy-claude-code plugins/documentation-testing/skills/doc-testing-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analogous to the software testing pyramid, documentation testing should be layered:
E2E (manual, periodic)
/ Can a real user follow the guide? \
/ \
Integration (automated, weekly)
/ Cross-file links, external URLs \
/ \
Unit (automated, every PR)
Prose style, code execution,
internal anchors, markdown formatting
Unit checks are fast and cheap - run on every PR. Integration checks (external links) are slower and network-dependent - run weekly or on release. E2E tests are human - conduct them quarterly or when major changes land.
Python's doctest module tests examples embedded in docstrings and Markdown:
def calculate_discount(price: float, percent: float) -> float:
"""Calculate discounted price.
>>> calculate_discount(100.0, 20)
80.0
>>> calculate_discount(50.0, 10)
45.0
>>> calculate_discount(0, 50)
0.0
"""
return price * (1 - percent / 100)
Run with pytest --doctest-modules or python -m doctest module.py -v.
For Markdown files: pytest --doctest-glob="docs/**/*.md"
Doctest limitations: tests are sensitive to whitespace and exact output. Use # doctest: +ELLIPSIS and # doctest: +NORMALIZE_WHITESPACE for flexible matching.
Vale is a linter for prose - it checks documentation text against style rules.
Google: Google Developer Style Guide rules (headings, passive voice, word list)Microsoft: Microsoft Writing Style Guideproselint: Literary quality rules (clichés, redundancies)write-good: Passive voice, weasel words, adverb overuse# Substitution rule: enforce product name spelling
extends: substitution
message: "Use '%s' instead of '%s'"
level: error
swap:
(?i)the sdk: the SDK # Case-insensitive match
(?i)javascript: JavaScript # Correct capitalization
# Existence rule: flag forbidden phrases
extends: existence
message: "Avoid '%s' - too vague. Use a specific action instead."
level: warning
tokens:
- 'simply'
- 'just'
- 'easily'
- 'obviously'
Use inline suppression for specific lines:
<!-- vale off -->
The term "whitelist" is used in this security protocol for historical reasons.
<!-- vale on -->
Some URLs should always be excluded from link checking:
localhost and 127.0.0.1 - development-onlyExternal links are unreliable. Configure:
timeout = 10 seconds per requestmax_retries = 3 with retry_wait_time = 2s429 Too Many Requests as "probably fine" (rate limited, not broken)A 301 redirect to a valid page is not broken. A 301 redirect to a 404 is broken. Configure link checkers to follow redirects and report the final status code.
Code examples rot faster than prose. Warning signs:
Detection strategies:
<!-- version: 2.x --> and check against current major versionKey rules with rationale:
MD001: true # Heading levels increment by 1 (no skipping from H1 to H3)
MD004: true # Consistent unordered list marker (* or - or +, pick one)
MD010: true # No hard tabs (spaces only)
MD012: true # No multiple consecutive blank lines
MD022: true # Headings surrounded by blank lines
MD025: true # Only one H1 per document
MD041: true # Document starts with H1
MD051: true # Link fragments must be valid anchors in the file
MD052: true # Reference-style links must be defined
Disable for technical docs:
MD013: false # Line length (too strict for code-heavy docs)
MD033: false # Inline HTML (needed for admonitions, tabs)
# Find all docs files not modified in 180+ days
git log --format="%ci %H" -- docs/ | \
awk -v cutoff="$(date -d '180 days ago' +%Y-%m-%d)" '$1 < cutoff'
# Find version references that might be stale
grep -r "v[0-9]\+\.[0-9]\+" docs/ | grep -v "CHANGELOG"
Broken links are visible failures. Broken code examples are silent failures. Users copy the example, it doesn't work, and they assume the product is broken. Example testing catches issues before users do.
External link checks take 2-10 minutes and are unreliable (network conditions). Move external link checks to scheduled CI (nightly or weekly). Run internal link checks on PRs only.
Introducing Vale to an existing docs repository will report hundreds of violations. Use MinAlertLevel = error initially to catch only critical issues, then lower the threshold over time.
Accumulated redirects slow page load and create dependency on the redirect chain. Update links to their final destination during content audits.
tools
# User Doc Patterns > Patterns for writing clear, accessible end-user documentation. ## Knowledge Base ### User Documentation vs Developer Documentation | User Docs | Developer Docs | |-----------|---------------| | Task-oriented ("How do I...") | Concept-oriented ("How does it work...") | | Plain language | Technical language | | Screenshots and visual aids | Code examples | | Step-by-step procedures | API references | | Feature names and UI labels | Function signatures and parameters | | A
tools
# Tutorial Structures > Pedagogical patterns and frameworks for creating effective technical tutorials. ## Knowledge Base ### The Tutorial Spectrum Tutorials exist on a spectrum between two extremes: | Recipe | Concept Guide | |--------|--------------| | "Do exactly this" | "Understand this idea" | | Step-by-step | Explanation-heavy | | Fast to complete | Deep understanding | | Low retention | High retention | The best tutorials blend both: steps for doing, explanations for understanding.
tools
# Tutorial Patterns ## Tutorial vs. How-to Guide: The Critical Distinction Before writing, identify which document is actually needed: | Tutorial | How-to Guide | |----------|-------------| | "Build a REST API in Node.js" | "Add JWT authentication to your Express API" | | For someone new to this | For someone who knows the domain | | Explains why each step is done | Steps are efficient, minimal explanation | | Has checkpoints, explores | Numbered steps, no detours | | Learner reaches a comple
tools
# Tech Blogging Patterns ## The Developer Reading Pattern Developers do not read technical posts linearly. They scan in this order: 1. Headline (is this relevant to me?) 2. Code blocks (is this real code I can use?) 3. Headers (what does this cover?) 4. First paragraph (what's the point?) 5. Key takeaways / conclusion (is it worth reading fully?) Design for scanning first, reading second. Put real code within the first 25% of the post. ## The Before/After Pattern The contrast between a pain