DocsCI for prevent broken code examples

Prevent Broken Code Examples in Docs

Broken code examples in documentation are the #1 cause of developer frustration and support tickets. DocsCI executes every snippet on every PR — so you ship docs that actually work.

< 30s

Typical run time

6+

Languages tested

100%

Snippet coverage

0

Config changes to docs

Broken examples cost you developers

The first thing a developer does with your docs is copy a code example. If it doesn't work, they open a support ticket, file a GitHub issue, or just leave. Broken examples are silent churn.

  • An import path changes in v2.0 — the quick-start example breaks, nobody notices for 3 weeks
  • A method is renamed in the SDK — the docs still show the old name, developers get TypeError
  • A required parameter is added to an API endpoint — the curl example in docs returns 422
  • Language runtime updates break old syntax in examples that never get re-tested
  • Your team spends hours in support answering questions that a working code example would prevent

Execute every code example on every PR

DocsCI extracts every fenced code block from your documentation and runs it in an isolated, hermetic sandbox. JavaScript runs in a V8 isolate. Python runs in Pyodide WASM. Bash is validated. HTTP examples run against your configured staging endpoint. If any snippet fails, DocsCI blocks the PR and posts a comment on the exact line — with an AI-generated fix.

Everything you need

🔬

Extract and execute every snippet

DocsCI finds every fenced code block in Markdown, MDX, RST, and AsciiDoc files. Each one is extracted, run in an isolated sandbox, and verified.

🏗️

Hermetic sandboxes per snippet

JavaScript and TypeScript run in V8 isolates (via isolated-vm). Python runs in Pyodide WebAssembly. No shared state, no host contamination, no side effects.

Fast — even on large doc sets

DocsCI runs analyzers in parallel with concurrency tuned for Vercel's compute limits. A 100-snippet doc set typically runs in under 30 seconds.

🎯

Precise PR comments

Every broken snippet gets a PR comment with: the file path, line number, the error message, and an AI-generated corrected code snippet.

🔑

Secret scanning before execution

40+ regex patterns scan snippets for API keys, tokens, private keys, and connection strings before execution. No credentials leak through execution.

🌐

Network-isolated by default

Snippets cannot make outbound network calls unless you add domains to the docsci.yml allowlist. RFC-1918 private ranges are always blocked.

How it works

1

Add DocsCI to your CI pipeline

One GitHub Action, one API call. DocsCI reads your docs from the repository — no git hooks or doc build step needed.

- name: Run DocsCI
  run: |
    tar czf docs.tar.gz docs/
    curl -sf -X POST https://snippetci.com/api/runs/queue \
      -H "Authorization: Bearer ${{ secrets.DOCSCI_TOKEN }}" \
      -F "docs_archive=@docs.tar.gz" \
      -o result.json
    jq -e '.status == "passed"' result.json
2

DocsCI executes every fenced code block

JS, TS, Python, Go, Ruby, Bash, cURL — every snippet runs in the right sandbox. Failures are collected with error messages and stack traces.

3

Broken snippets block the PR

If any snippet fails, the CI check fails. DocsCI posts an inline comment on the broken snippet with the error and a patch diff. Merge only verified code.

Frequently asked questions

Does DocsCI catch all broken code examples?

DocsCI executes all fenced code blocks in supported languages. Examples that require external services not in the allowlist will be flagged as skipped rather than failed. Configure your staging endpoint allowlist to test HTTP examples end-to-end.

What languages does DocsCI execute?

JavaScript, TypeScript, Python (via Pyodide WASM), Bash (simulated validation), Go (static check), Ruby (sandboxed), and cURL (executed against allowlisted endpoints). Unsupported languages are skipped.

Can DocsCI handle code examples with external dependencies?

Yes. DocsCI's sandbox supports npm packages (JS/TS) and PyPI packages (Python) via a curated allowlist. Configure additional packages in docsci.yml under snippets.packages.

How do I exclude code examples that are intentionally invalid (e.g., showing error states)?

Add a docsci-skip comment above the fenced block: <!-- docsci-skip --> in Markdown, or configure skip_patterns in docsci.yml to match blocks containing 'ERROR' or 'expected output' markers.

Ready to stop shipping broken docs?

Join API and platform teams who use DocsCI to ship verified documentation.