GitHub Documentation Sync Agent
Detect documentation drift in GitHub repos. Find code changes that outpaced their docs and open PRs to fix them.
The Challenge
Documentation starts accurate and then slowly drifts. A developer adds a new API parameter but forgets the docs. Someone renames a config key but the README still references the old one. Over time, the docs become a liability — developers stop trusting them, new hires get confused, and customers file support tickets about instructions that don't work anymore.
What This Prompt Does
Read Code & Docs
Fetches both source files and documentation to build a mapping of what describes what
Detect Drift
Compares APIs, configs, and features against their documentation to find mismatches
Update Docs
Rewrites outdated sections to match current code while preserving style and tone
Open PR
Commits all documentation fixes to a branch and opens a PR with a detailed change summary
The Prompt
The Prompt
Task
Use @GitHub/Read FileName it "GitHub/Read File" and call it with @GitHub/Read File to read source code files and their corresponding documentation. Compare them to detect documentation drift — functions, APIs, configs, or features that have changed in code but not in the docs. Update outdated documentation, create a branch, commit the changes, and open a PR using @GitHub/Get Branch SHAName it "GitHub/Get Branch SHA" and call it with @GitHub/Get Branch SHA, @GitHub/Create BranchName it "GitHub/Create Branch" and call it with @GitHub/Create Branch, @GitHub/Update FileName it "GitHub/Update File" and call it with @GitHub/Update File, and @GitHub/Create Pull RequestName it "GitHub/Create Pull Request" and call it with @GitHub/Create Pull Request.
Input
The user provides:
- The repository owner and name (e.g., "acme/web-app")
- The scope of the audit (e.g., "API docs", "README", "all docs", specific files)
- Key source files to compare against (optional, e.g., "src/api/routes.ts should match docs/api.md")
- The base branch (optional, defaults to "main")
Example: "Check if the README in acme/api still matches the actual API routes in src/routes/"
Context
Read Source Code and Documentation
- Use @GitHub/Read FileName it "GitHub/Read File" and call it with @GitHub/Read File to fetch documentation files (README.md, docs/, wiki pages, inline comments)
- Use @GitHub/Read FileName it "GitHub/Read File" and call it with @GitHub/Read File to fetch the corresponding source code files
- Build a mapping of which docs describe which code areas
Detect Documentation Drift
- API endpoints: Compare documented routes, parameters, and response shapes against actual route definitions
- Configuration options: Compare documented config keys and defaults against actual config schemas or .env.example
- Function signatures: Compare documented function parameters and return types against actual code
- Installation/setup steps: Verify documented commands still work with current package.json scripts and dependencies
- Feature descriptions: Check if documented features still exist and work as described
Categorize Issues
- Stale docs: Documentation that describes something that no longer exists
- Missing docs: Code that has been added with no corresponding documentation
- Inaccurate docs: Documentation that exists but describes behavior incorrectly
- Outdated examples: Code examples in docs that use old API patterns or deprecated methods
Update Documentation
- Rewrite outdated sections to match current code behavior
- Add documentation for undocumented features or APIs
- Remove references to deleted features
- Update code examples to use current patterns
- Preserve the existing documentation style and tone
Create Branch and PR
- Use @GitHub/Get Branch SHAName it "GitHub/Get Branch SHA" and call it with @GitHub/Get Branch SHA to get the current SHA of the base branch
- Use @GitHub/Create BranchName it "GitHub/Create Branch" and call it with @GitHub/Create Branch to create a new branch (e.g., "docs/sync-api-documentation")
- Use @GitHub/Update FileName it "GitHub/Update File" and call it with @GitHub/Update File to commit the updated documentation files
- Use @GitHub/Create Pull RequestName it "GitHub/Create Pull Request" and call it with @GitHub/Create Pull Request to open a PR with a detailed summary of all documentation changes
Output
Documentation Sync Report:
Repository: [owner/repo] Files Analyzed: [count] source files, [count] doc files
Drift Detected:
| Doc File | Issue Type | Description | |----------|-----------|-------------| | [docs/api.md] | Inaccurate | [endpoint X returns different fields than documented] | | [README.md] | Stale | [references removed feature Y] | | [docs/config.md] | Missing | [new config option Z not documented] |
Changes Made:
- Updated [file1] - [summary of changes]
- Updated [file2] - [summary of changes]
Pull Request: [PR URL] Status: Ready for review
Remaining Items (Manual Review Needed):
- [Items that require human judgment to resolve]
Example Usage
Try asking:
- →"Check if the README in acme/api still matches the actual API routes"
- →"Audit docs/configuration.md against the current .env.example and config schema"
- →"Find all undocumented API endpoints in acme/web-app and update the docs"