Doc Detective
Active and stableRuns locally ✓No paid APITest documentation commands, links, and UI procedures locally or in CI, with results and captures that identify where a workflow broke.
npm i -g doc-detectiveIdeal use for this tool
Best for technical writers, CLI or API developers, and small teams that need onboarding docs to stay aligned with the product. It turns procedures into repeatable local and CI tests with reviewable results and captures. It does not judge writing quality or translation, and browser setup can be heavy on a small machine.
Details and illustrated features
Product changes can leave documentation pointing to an old button or a command that no longer works. Human review can judge clarity, but it rarely replays every step on every release. Doc Detective turns documentation procedures into executable checks: it reads documentation or standalone specifications, runs browser, HTTP, and command steps, and records what passed or failed. Its practical value is bringing documentation into the quality workflow before a reader reports the breakage.

Original explanatory workflow, not a product screenshot.
🧭 What is Doc Detective and how does it work?
Doc Detective is an open-source documentation testing framework. It can inspect Markdown, MDX, DITA, AsciiDoc, and HTML, extract inline or detected tests, and run standalone JSON or YAML specifications. A test then runs in a chosen context: an operating system, browser, API flow, or terminal process.
Steps can open a URL, find and click an element, make an HTTP request, run a command, capture a screenshot, or record a video. The result is not a linguistic quality score. It is evidence that executable instructions still work in the environment you tested. It complements editorial review rather than replacing it.
The verified stable package is 4.41.5, published to npm on 4 November 2026. Version 5.0 release candidates exist, but this entry is based on the stable line. Current installation docs require Node.js 22.22 or later on the v22 line, or Node.js 24 or later. The README still contains older “tested on v20 and v22” wording; this guide follows the more specific installation page.
🎯 How does it help you?
Imagine an onboarding guide that opens a signup page, asks the reader to press a button, then runs a verification command. A UI change can rename the button; a CLI release can change an option. Manually, someone must repeat the whole guide, save screenshots, and do it again after later changes.
With Doc Detective, the test lives next to the instructions or in a separate specification. Run it locally before a merge, then in CI. A failure identifies the affected step and can preserve a result, screenshot, or log for review. The added value is not a guarantee that every sentence is correct; it is turning executable claims into a repeatable contract.
It fits technical writers, CLI or API developers, and small teams with onboarding or setup docs that evolve with the product. It does not review tone, translation, accessibility of the prose, or the product’s underlying implementation tests.
🌟 Key features and capabilities
1. Three ways to define documentation tests
Define an inline test in a documentation comment, let Doc Detective detect testable commands and links, or keep a standalone JSON or YAML spec. Inline tests suit a small check that should change with the paragraph; a standalone spec is clearer for a long scenario or one reused by several pages.

The diagram summarizes test-definition choices. Actual comment patterns depend on the file type and fileTypes configuration.
- Where: Inline tests, Detected tests, and Specification schema documentation.
- How: begin with one important onboarding action; move a long workflow into its own spec.
- Example: Markdown can start with a one-line comment such as
<!-- test { "testId": "onboarding" } -->, addstepcomments, and close with<!-- test end -->. - Watch for: multiline inline comments are not supported, and detection patterns are configurable. Not every code block automatically becomes a safe test.
2. Combine browser, HTTP, and command actions
Documented actions include goTo, find, click, and type for UI work, httpRequest for APIs, runShell and runCode for commands, plus screenshot and record. One scenario can therefore follow the reader’s path instead of merely checking that a link responds.

Explanatory action map; a test does not need every action type.
- Where: the Actions section and each action schema.
- How: connect every step to a checkable claim: an element exists, an HTTP status is acceptable, or a command completes.
- Value: the test mirrors the procedure described by the page.
- Watch for:
runShellandrunCodeexecute with the user or CI runner’s permissions. Do not run an untrusted contribution on a machine carrying useful secrets.
3. Execution contexts across platforms and browsers
runOn selects the platform and browser at config, spec, or test level. The docs cover Windows, macOS, Linux, Android, and iOS with host-specific requirements. Desktop contexts include Chrome, Firefox, and WebKit/Safari where supported. Impossible combinations are skipped with an explanation instead of failing with an opaque driver error.

The matrix simplifies general compatibility. iOS requires macOS and Xcode; Android needs an SDK and hardware acceleration; some browser combinations are skipped.
- How: start with the context most readers use, then add a second platform only when behavior differs.
- Illustrative example: test a Web guide in Chrome on Linux CI, then add Safari/WebKit on macOS if the product supports it.
- Watch for: desktop Chrome has a practical minimum viewport. A true phone-sized capture needs an appropriate device context.
4. Reviewable results and screenshots
Doc Detective produces PASS or FAIL states with step context and, by default, writes testResults-<timestamp>.json. Screenshot steps save images, and recording actions can preserve video. A documentation failure becomes an artifact tied to a step instead of a vague “the guide is broken” report.

File names are illustrative; actual output depends on the output setting and test actions.
Treat failure captures as diagnostic evidence, not proof that the whole page is correct. An element can exist while the explanation is wrong, and rendering differences can affect captures. Redact account data before preserving screenshots or videos as CI artifacts.
5. Run tests in GitHub Actions
The project provides the official doc-detective/github-action@v1 Action. It installs Doc Detective, runs tests, and can fail the job when tests fail. The integration can also open an issue or pull request, but those write operations need explicit workflow permissions and repository settings.

CI workflow illustration. Opening an issue or pull request requires deliberate permissions configuration.
Check failure semantics carefully. The CLI’s exitOnFail default is false for historical compatibility, so a run can exit 0 while a test result is FAIL. Use --exit-on-fail or the equivalent setting when you want a merge gate, and verify the Action configuration instead of trusting a green job at a glance.
6. Install only the runtime assets you need
A global installation adds the CLI and then pre-installs heavy runtime assets during postinstall: Chrome, Firefox, drivers, ffmpeg, and packages such as WebdriverIO, Appium, and Sharp. Set DOC_DETECTIVE_AUTOINSTALL=0 to skip that pre-warm, install only Chrome or a selected runtime, and inspect state with doc-detective install status.
This helps control a small machine or a CI image, but it also means a seemingly small npm command may download browsers and packages. Set DOC_DETECTIVE_CACHE_DIR for a persistent cache; the current docs warn that the default temporary location may disappear after reboot.
🪜 Example: test an onboarding guide
Illustrative; not run on a real product: docs/onboarding.md opens a staging page, finds a create-account button, and runs a verification command.
- Pin the stable package locally or try it in an isolated environment. Do not build a production gate on
@next. - Choose the most change-prone claim: the button label or the final command.
- Add an inline test near those steps, or create
onboarding.spec.jsonfor a longer multi-context scenario. - Point it at staging rather than production data.
- Run
npx doc-detective --input docs/onboarding.md --exit-on-fail. - Inspect JSON and the screenshot. A failed
findmay mean changed text or an earlier page-load failure. - Add the GitHub Action after the local test is stable; begin with read-only permissions.
- Keep secrets in the CI secret store, not in specs, captures, or result logs.
⚖️ What changes compared with manual work?
| Task | Manual workflow | With Doc Detective |
|---|---|---|
| Replay instructions | A writer repeats the page after each release | The scenario runs locally and in CI |
| Find a stale button or link | Wait for review or a reader report | find and checkLink expose the break |
| Check a CLI command | Copy and paste by hand | runShell or runCode records a result |
| Preserve a failure | Write a note and take a screenshot | JSON and captures stay tied to steps |
| Block a merge | Separate human decision | CI gate when exitOnFail is enabled |
This compares workflow behavior, not measured time savings or a guarantee of complete documentation.
⚙️ Important configuration
.doc-detective.json controls inputs, file types, contexts, cache, and output. Review autoUpdate, exitOnFail, runOn, and shell in particular. A spec or test can override some context settings, so inspect the effective test that CI will execute rather than only the global config.
Auto-update is enabled by default for global and npx runs. It can invoke npm install -g or re-execute through npx -y ...@latest. CI skips this check when CI is set, and local project installs only show an update hint instead of mutating the lockfile. For reproducibility, pin a local dependency and lockfile, or use --no-auto-update/autoUpdate: false.
🚀 Installation and first run
For stable 4.41.5, current docs require Node.js 22.22+ on the v22 line or Node.js 24+. The documented global install is:
npm i -g doc-detective
Run tests in the current directory with:
npx doc-detective
doc-detective install status compares installed runtime assets with expectations. The commands and examples were not run for this entry.
🔗 Integrations and compatibility
The clearest official integration is the GitHub Action. A separate doc-detective/agent-tools repository supplies helpers for Claude Code, Codex, Cursor, OpenCode, Gemini, and other agents, but those helpers are optional and are not required by the core CLI. GitHub support also does not mean GitHub is mandatory; run the CLI locally or in another CI system.
💰 Cost and local operation
The code is free and open source under AGPL-3.0. Core local CLI use needs no account or paid API. CI runners, the system under test, or an optional agent host can have separate costs. Local execution is not necessarily offline: opening a URL, making an HTTP request, downloading browsers, or checking npm reaches the relevant external service.
On 9 November 2026, the GitHub organization page showed approximately 138 stars and 21 forks for the original repository. These are changing popularity counts, not user ratings or a security review.
⚠️ Limitations and when not to use it
- Browser and driver setup can be heavy on a small machine; install only needed assets or use CI.
- Tests become brittle when tied to frequently changing visible text or unstable selectors.
- A pass covers only the chosen scenario and environment, not every version, language, or platform.
- The core CLI emits results; rich notifications and reports need the GitHub Action or another component.
- It does not judge prose quality, readability, translation, or product decisions.
- Mobile runs require SDKs, emulation, and suitable acceleration; iOS needs macOS and Xcode.
🔐 Security and permissions
A Doc Detective test file is effectively executable code. runShell and runCode can execute commands, loadVariables reads .env, cookie actions can store or restore sessions, and browser or HTTP steps can reach external services. Run untrusted contributions in isolation with minimal secrets and permissions.

A cautious starting point, not a security audit of your project.
Pin the package, disable auto-update in auditable workflows, separate staging from production, and keep the GitHub Action read-only until issue or pull-request creation is deliberately required. Review result files and captures before sharing them; they can contain internal URLs, tokens, or account data.
📚 Sources and verification date
Original repository · Official documentation · Installation, cache, and updates · Inline tests · Input formats · Actions · Platforms and browsers · GitHub Action · Configuration schema. Sources checked 9 November 2026. The tool and example were not run; diagrams are original and explanatory.