Improve docs by running coding agents on tasks that depend on them
Last updated
Copy this prompt
Paste this into a general agent such as ChatGPT agent or Claude, then add your own inputs.
Help me run this UseCaseProof playbook: Improve docs by running coding agents on tasks that depend on them. The problem: Internal and product docs drift from the product. Engineers discover the gaps only when onboarding someone or when a coding agent fails a task that should have been documented. Writing better docs from memory misses the steps that actually break. Failure transcripts from agents that tried to follow the docs are a concrete signal of what to fix—without inventing pass-rate claims. How the agent should work: You define a small suite of tasks that a competent person (or coding agent) should complete using only your docs—for example 'add a webhook endpoint,' 'run the local stack,' or 'rotate a test API key.' A coding agent attempts each task in a disposable environment with access to the docs and the repo. You (or a second agent pass) analyze the failure transcript: missing steps, wrong commands, outdated paths, ambiguous prerequisites. The system drafts doc patches as pull requests. A person reviews and merges. You re-run the same tasks until they succeed or you decide the remaining failures are product bugs, not doc bugs. Never publish invented pass rates; report only what you measured on your own suite. Follow these steps: 1. Choose five to ten tasks that depend on specific doc pages, and write a success check for each (command output, file created or test passed) 2. Give the coding agent a clean environment, the docs URL or path, and the repo—no tribal knowledge in the prompt 3. Capture the full transcript and mark where the agent stalled, guessed or followed a wrong step 4. Cluster failures by doc page and failure type (missing prerequisite, wrong command, outdated screenshot, broken link) 5. Draft a doc PR for each cluster; keep product-bug findings in the issue tracker instead of papering over them in docs 6. Have a tech writer or owning engineer review every doc PR before merge 7. Re-run the same task suite after merge and record pass/fail for that run only 8. Add new tasks when you ship features that need docs, and retire tasks the product no longer supports Human-approval checkpoint: Engineers or tech writers review and merge every doc change. Someone decides whether a failure is a doc gap or a product bug. Credentials, production projects and customer data stay out of the test environment. Guardrails: Agents can modify code or infra if you give them write access beyond docs—so restrict the environment and require human review on merges. Failure transcripts may include secrets the agent printed; scrub logs before sharing. Do not invent or advertise pass-rate statistics; only share counts from your own recorded runs. Flaky environments create false doc bugs, so pin tool versions for each suite run. Suggested tools from this playbook (not ranked; check current features and pricing): Claude Code, Cursor, Codex or similar coding agents, Your docs site or repo (for example Docusaurus, MkDocs or Notion exported to the repo), GitHub or GitLab for doc PRs, A disposable cloud VM or container for each run, Your existing CI to optionally re-check commands mentioned in docs. Do not send messages, move money, grant access, merge code, or take any irreversible action until I approve. If you need an input I have not provided, ask me instead of guessing.
The problem
Internal and product docs drift from the product. Engineers discover the gaps only when onboarding someone or when a coding agent fails a task that should have been documented. Writing better docs from memory misses the steps that actually break. Failure transcripts from agents that tried to follow the docs are a concrete signal of what to fix—without inventing pass-rate claims.
How the agent works
You define a small suite of tasks that a competent person (or coding agent) should complete using only your docs—for example 'add a webhook endpoint,' 'run the local stack,' or 'rotate a test API key.' A coding agent attempts each task in a disposable environment with access to the docs and the repo. You (or a second agent pass) analyze the failure transcript: missing steps, wrong commands, outdated paths, ambiguous prerequisites. The system drafts doc patches as pull requests. A person reviews and merges. You re-run the same tasks until they succeed or you decide the remaining failures are product bugs, not doc bugs. Never publish invented pass rates; report only what you measured on your own suite.
Setup steps
- Choose five to ten tasks that depend on specific doc pages, and write a success check for each (command output, file created or test passed)
- Give the coding agent a clean environment, the docs URL or path, and the repo—no tribal knowledge in the prompt
- Capture the full transcript and mark where the agent stalled, guessed or followed a wrong step
- Cluster failures by doc page and failure type (missing prerequisite, wrong command, outdated screenshot, broken link)
- Draft a doc PR for each cluster; keep product-bug findings in the issue tracker instead of papering over them in docs
- Have a tech writer or owning engineer review every doc PR before merge
- Re-run the same task suite after merge and record pass/fail for that run only
- Add new tasks when you ship features that need docs, and retire tasks the product no longer supports
Tools that can do this
- Claude Code, Cursor, Codex or similar coding agents
- Your docs site or repo (for example Docusaurus, MkDocs or Notion exported to the repo)
- GitHub or GitLab for doc PRs
- A disposable cloud VM or container for each run
- Your existing CI to optionally re-check commands mentioned in docs
Some tool links may be affiliate links. We only list tools that fit the playbook; recommendations are not sold. Disclosure.
Not ranked. Tools marked Featured pay for a highlighted listing; that never decides which tools we include. Check each vendor's current features and pricing.
Make one of these tools? Feature your tool on every playbook where it is already listed.
Human in the loop
Engineers or tech writers review and merge every doc change. Someone decides whether a failure is a doc gap or a product bug. Credentials, production projects and customer data stay out of the test environment.
Risks and guardrails
Agents can modify code or infra if you give them write access beyond docs—so restrict the environment and require human review on merges. Failure transcripts may include secrets the agent printed; scrub logs before sharing. Do not invent or advertise pass-rate statistics; only share counts from your own recorded runs. Flaky environments create false doc bugs, so pin tool versions for each suite run.
ROI notes
Before you start, note which doc pages generate the most support questions and how long onboarding takes for one well-defined task. After each cycle, record tasks attempted, tasks that succeeded on that run, doc PRs merged and support questions on those pages. The value is docs that match how the product actually works; it depends on task design and how fast you merge patches.
Quick answers
How do I improve docs by running coding agents on tasks that depend on them?
You define a small suite of tasks that a competent person (or coding agent) should complete using only your docs—for example 'add a webhook endpoint,' 'run the local stack,' or 'rotate a test API key.' A coding agent attempts each task in a disposable environment with access to the docs and the repo. The full setup is 8 steps.
Do I need to code to set this up?
Some code is needed. We rate the setup Hard.
Which tools can do this?
Claude Code, Cursor, Codex or similar coding agents, Your docs site or repo (for example Docusaurus, MkDocs or Notion exported to the repo), GitHub or GitLab for doc PRs, A disposable cloud VM or container for each run, Your existing CI to optionally re-check commands mentioned in docs. Not ranked; check each vendor's current features and pricing.
Where does a human stay in control?
Engineers or tech writers review and merge every doc change. Someone decides whether a failure is a doc gap or a product bug. Credentials, production projects and customer data stay out of the test environment.
What's a starter prompt I can paste into ChatGPT agent or Claude?
A playbook-specific starter prompt is in the Copy this prompt section above. It is written from this playbook's steps and human-approval checkpoint, for a general agent such as ChatGPT agent or Claude.
Also useful: get a first-pass review on pull requests; answer questions from internal docs; generate tests for legacy code; run browser QA on core user flows.
Related playbooks
Get a first-pass review on every pull request
Reviewers are a bottleneck and miss routine issues.
Hand well-scoped issues to a coding agent
Small bugs and chores sit in the backlog because nobody has time.
Write missing unit tests for legacy code
Untested legacy code makes every change risky.
All AI agent examples, by function · More Software Engineering playbooks