Analyze source code changes on the current branch and identify documentation that is stale, inaccurate, or missing. Use before creating a PR to check if docs need updating, or in CI after merges to main to automatically fix docs. Trigger when the user mentions "doc changes", "docs update", "check docs", "document changes", or wants to know if code changes affect documentation.
Analyze source code changes to find documentation that is stale, inaccurate, or missing, then either report findings or directly apply fixes.
The mode is determined by how the skill is invoked. Local interactive use defaults to report mode. CI sets edit mode via the prompt.
Before making any doc edits, read the write-docs skill at .claude/skills/write-docs/SKILL.md. All edits must follow its conventions for tone, components, frontmatter, code blocks, and testing directives.
Figure out what changed relative to the base branch:
git diff main...HEAD --name-status
git diff main...HEAD -- 'src/prefect/' 'src/integrations/'
/tmp/diff.patchFilter the diff to only source code changes. Skip:
**/tests/**).github/)docs/, *.md, *.mdx)uv.lock, package-lock.json)ui-v2/)Scan the diff for changes that users would encounter:
Function and class signatures:
CLI commands:
@app.command(), click/typer decorators)Configuration and settings:
Setting, Field in settings classes)Behavioral changes:
Skip:
_ in _internal modules)For each extracted change, search the docs for references. Use parallel searches for efficiency.
Exclude auto-generated files. Before searching or editing, filter out all auto-generated doc files. These are maintained by generation scripts and will be updated separately before each release. Never search, flag, or edit these paths:
docs/v3/api-ref/ — entire directory (generated by scripts/generate_api_ref.py and scripts/generate_settings_ref.py)docs/v3/examples/ — entire directory (generated by scripts/generate_example_pages.py)This page is generated by or automatically generatedSearch strategy:
docs/ (excluding auto-generated paths above) for function names, class names, CLI command names, setting namesBuild a findings list with these categories:
Stale — docs describe something that changed:
Missing — new public API/feature with no doc coverage:
Broken examples — code blocks that reference changed APIs:
Print a structured report grouped by doc file:
## Documentation Changes Report
### `docs/v3/concepts/flows.mdx`
1. **[Stale]** Line 45: `@flow(retries=3)` — `retries` parameter renamed to `max_retries` in src/prefect/flows.py
- **Suggested fix:** Update parameter name in code example and surrounding prose
2. **[Broken example]** Line 78-85: Code block uses `flow.run()` which was removed
- **Suggested fix:** Replace with `flow()` direct invocation
### `docs/v3/how-to-guides/workflows/retries.mdx`
1. **[Stale]** Line 23: "Default retry delay is 5 seconds" — default changed to 10 seconds in this branch
- **Suggested fix:** Update to "Default retry delay is 10 seconds"
### Missing coverage
1. **[Missing]** New `@flow(on_cancellation=...)` hook added — no docs mention this parameter
- **Recommendation:** Add a section to `docs/v3/concepts/flows.mdx` under "Flow lifecycle hooks" or create a new how-to guide
### No changes needed
- `docs/v3/get-started/quickstart.mdx` — references checked, all current
After presenting the report, offer:
Directly apply fixes for Stale and Broken example findings on existing pages:
docs/v3/api-ref/, docs/v3/examples/) or containing a generated-by comment — do not edit these even if they appear stale{/* pmd-metadata: notest */} only if the fixed code genuinely can't be testedFor Missing coverage findings, do not create new pages. Instead, collect them for the PR body.
Before considering edits complete, verify each change:
docs/docs.jsonAfter applying fixes (if the user chose to), mention:
just lint in docs/ to check Vale styledocs/v3/api-ref/ directory (including settings-ref.mdx, Python SDK reference, CLI reference, and REST API reference), the entire docs/v3/examples/ directory, and any file containing a generated-by comment (e.g., This page is generated by). These files are regenerated by scripts before each release and must not be edited manually or by automation.pmd-metadata directives and preserve them. If you're unsure whether a modified block is testable, mark it notest and note why.