Install
openclaw skills install @openghz/update-project-docsThis skill should be used when the user asks to "update documentation for my changes", "check docs for this PR", "what docs need updating", "sync docs with code", "scaffold docs for this feature", "document this feature", "review docs completeness", "add docs for this change", "what documentation is affected", "docs impact", or mentions documentation updates in any project. Provides a guided workflow for updating project documentation based on code changes.
openclaw skills install @openghz/update-project-docsGuides you through updating project documentation based on code changes on the active branch. Works with any project regardless of language, framework, or documentation format.
Important: For first-time runs or updates spanning a long period, it is strongly recommended to use the most capable model with thinking/extended thinking enabled and effort set to maximum. The first run performs a full-project audit that determines the baseline for all future incremental updates — any documentation gaps missed during this run will not be caught by subsequent incremental diffs, since incremental mode only reviews code changes after the recorded sync point. Investing in thoroughness up front pays off in every future run.
.docs-sync record): Perform a full-project audit — read the entire codebase, compare with existing docs, fill every gap. Do not rely on git diff.Always run this before any other workflow step.
git status --porcelain
If the output is non-empty, there are uncommitted changes (modified, staged, or untracked files). Stop and ask the user how to proceed before continuing. Present these options:
Use the AskUserQuestion tool to present this choice. Do not silently include or exclude uncommitted changes — the user must decide explicitly.
The skill records the commit hash of the code state that the documentation is synced to in a tracking file so subsequent runs can do incremental updates instead of re-scanning the entire codebase.
Look for the sync record in this order:
.docs-syncdocs/.docs-sync.claude/docs-synclast_synced_commit: in docs/index.md)<!-- docs-sync: <hash> -->)The file format is a single line with the commit hash, optionally with a timestamp:
abc1234567890def...
2026-04-11T10:30:00Z
Decide the run mode based on what you find:
git cat-file -e <hash>)git rev-list --ancestry-path --first-parent --reverse <recorded-hash>..HEAD | head -n 1git diff <effective-base>...HEADDo not use git diff as the entry point. A first run means the documentation has never been audited against the current codebase — there may be missing, outdated, or stale documentation regardless of recent git history. Even if git diff origin/main...HEAD is empty, the docs may still need substantial work.
Instead, perform a full-project audit (see the "First-Run Full Audit" workflow below). After the audit is complete and documentation is updated, record the current HEAD as the code-sync point so subsequent runs can switch to incremental mode.
Before analyzing changes, understand the project's documentation setup.
# Detect the default branch
git remote show origin | grep 'HEAD branch'
# Or check common names
git branch -a | grep -E 'main|master|develop'
Use the Glob tool to search for common documentation locations:
docs/, documentation/, doc/site/, website/, content/wiki/, guides/, manual/README.md files alongside source codeapi-docs/, api-reference/Also check for documentation build configuration files that reveal the doc root:
mkdocs.yml (MkDocs)docusaurus.config.js / docusaurus.config.ts (Docusaurus)conf.py (Sphinx)book.toml (mdBook)antora.yml (Antora).vitepress/ (VitePress)_config.yml with docs theme (Jekyll)| Format | Extensions | Common In |
|---|---|---|
| Markdown | .md | Most projects |
| MDX | .mdx | React-based doc sites |
| reStructuredText | .rst | Python projects (Sphinx) |
| AsciiDoc | .adoc, .asciidoc | Java/enterprise projects |
| HTML | .html | Legacy or generated docs |
Many documentation systems use a sidebar or navigation config that defines the canonical hierarchy and ordering of pages. If one exists, it is the single source of truth for how documentation files should be organized on disk. Check for:
| Config File | System |
|---|---|
sidebars.js / sidebars.ts | Docusaurus |
mkdocs.yml → nav: section | MkDocs |
SUMMARY.md | mdBook |
_sidebar.md | Docsify |
_toc.yml | Jupyter Book |
.vitepress/config.* → sidebar | VitePress |
antora.yml → nav: | Antora |
_data/navigation.yml | Jekyll |
book.json / book.js | GitBook |
When a sidebar config is found:
Getting Started > Installation, the corresponding file should live in a directory path that reflects that grouping (e.g., docs/getting-started/installation.md)If no sidebar config is found, fall back to the existing directory structure as the organizational guide.
Check for lint/build commands in:
package.json (scripts section) — look for lint, docs:build, docs:lintMakefile / justfile — look for docs, lint-docs, build-docs targetstox.ini / noxfile.py — look for docs environments.github/workflows/, .gitlab-ci.yml) — look for doc validation stepsUse this workflow when no sync record exists. The goal is to bring documentation up to parity with the current state of the codebase, not to review recent changes.
Build a picture of what the project actually contains. Use Glob and Read (or delegate to the Explore subagent for larger codebases) to identify:
__init__.py, index.*, main.*, cli.*pyproject.toml, package.json, Cargo.toml, go.mod, etc. for project purpose and dependenciesIgnore internal-only utilities, test fixtures, and build artifacts.
List every existing documentation file and note what each covers:
docs/, etc.)README.md at the project rootCompare the codebase to the docs and categorize. Documentation maintenance is not just about adding and updating — deleting obsolete docs and merging redundant ones are equally important to keep the documentation concise, accurate, and maintainable.
| Status | Meaning | Action |
|---|---|---|
| Missing | Feature/API exists in code but has no documentation | Create a new doc |
| Outdated | Doc exists but references removed/changed code | Update the doc |
| Obsolete | Doc describes a feature/workflow that no longer exists or is no longer relevant to the project | Delete — remove the file, remove its sidebar entry, remove links pointing to it |
| Redundant | Multiple docs cover the same topic with overlapping content, or a single topic is fragmented across files unnecessarily | Merge — consolidate into one doc, delete the duplicates, update all links |
| Orphaned | Doc exists on disk but is not referenced by sidebar or any other doc | Evaluate: add to sidebar, merge into another doc, or delete |
| Accurate | Doc matches current code | Leave alone |
Also check whether the doc site itself is complete:
index.html for Docsify)?If the project's documentation is already organized into subdirectories, do not assume the existing structure is correct. Evaluate it against the current state of the project:
api/)Before making changes, show the user the categorized list. Include any directory restructuring proposals:
First-run audit results:
Missing docs (5):
- CLI commands: `mytool run`, `mytool init`
- Public function: `parse_config()`
- Configuration: `MYTOOL_CACHE_DIR` env var
- ...
Outdated docs (2):
- docs/api/client.md — references removed `Client.legacy_connect()`
- docs/config.md — missing new `timeout` option
Obsolete docs to delete (2):
- docs/guides/legacy-auth.md — legacy auth system was removed in v3.0
- docs/api/xml-export.md — XML export feature no longer exists
Redundant docs to merge (1):
- docs/guides/setup.md + docs/getting-started/installation.md — both cover
installation steps with overlapping content → merge into docs/getting-started/installation.md
Orphaned docs (1):
- docs/notes/roadmap.md — not in sidebar, not linked from any doc → delete or add to sidebar
Missing infrastructure (3):
- docs/index.html (Docsify entry point)
- docs/_coverpage.md
- Sidebar references docs/guides/advanced.md which does not exist
Directory restructuring (2):
- Move docs/deployment.md → docs/guides/deployment.md (matches sidebar section "Guides")
- Create docs/cli/ directory (sidebar has "CLI Reference" section but files are in docs root)
Confirm the plan before making any edits.
If the doc site is incomplete, fill in the missing infrastructure files. See "Workflow: Scaffold Documentation Site Infrastructure" below.
If directory restructuring was proposed and the user confirmed:
Walk through each action with user confirmation. The full set of operations includes:
Execute deletions and merges before creating new docs, to avoid writing content that would overlap with existing docs about to be merged.
Use this workflow when a sync record exists. It reviews only the changes since the last documentation sync.
Resolve the effective diff base from the recorded commit hash:
RECORDED=<recorded-hash-from-sync-record>
SYNC_RECORD_PATH=<path-to-sync-record-file-or-doc-page>
NEXT=$(git rev-list --ancestry-path --first-parent --reverse "$RECORDED"..HEAD | head -n 1)
BASE="$RECORDED"
# If the immediate next commit updated the sync record, it is the previous
# documentation-sync commit and should be skipped on the next run.
if [ -n "$NEXT" ] && git diff-tree --no-commit-id --name-only -r "$NEXT" -- "$SYNC_RECORD_PATH" | grep -q .
then
BASE="$NEXT"
fi
# See all changed files since the last sync
git diff $BASE...HEAD --stat
# See detailed changes in source directories
git diff $BASE...HEAD -- src/ lib/ packages/
# See the commit log for context
git log --oneline $BASE..HEAD
Only changes since the effective diff base are reviewed, instead of re-scanning the full codebase every time. In the normal case, this skips the immediately preceding documentation-sync commit without skipping unrelated code commits.
Look for changes that affect public-facing behavior:
| Change Type | Likely Doc Impact |
|---|---|
| New exported function/class | New API reference page or section |
| Changed function signature | Update parameter docs and examples |
| New configuration option | Update configuration reference |
| Changed default behavior | Update descriptions and examples |
| Deprecated feature | Add deprecation notice and migration |
| New CLI command/flag | Update CLI reference |
| Bug fix with workaround docs | Remove or update workaround guidance |
| Removed feature/API | Delete the corresponding doc |
| Merged/consolidated modules | Merge the corresponding docs into one |
Internal-only changes (private utilities, refactors without behavior change) typically don't need doc updates.
See references/CODE-TO-DOCS-MAPPING.md for detailed discovery strategies. Key techniques:
Use this when the project needs a documentation site but the infrastructure files are missing or incomplete. Most commonly triggered during a first-run audit.
| Situation | What to do |
|---|---|
| Project already uses a specific doc system (MkDocs, Docusaurus, Sphinx, VitePress, mdBook, etc.) | Respect it — fill in missing files using that system's conventions |
Project has partial Docsify setup (e.g., _sidebar.md exists but no index.html) | Complete the Docsify setup |
| Project has no doc site infrastructure at all | Default to Docsify — lightweight, no build step, plain Markdown |
| User explicitly requested a different system | Follow the user's instructions |
Docsify is a zero-build documentation site generator — it serves Markdown files directly via a single index.html. When scaffolding a new doc site or completing a partial Docsify setup, create these files under docs/:
docs/index.html — the Docsify entry point:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Project Name</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0">
<meta name="description" content="Project description">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
</head>
<body>
<div id="app">Loading...</div>
<script>
window.$docsify = {
name: 'Project Name',
repo: '',
loadSidebar: true,
loadNavbar: false,
coverpage: true,
auto2top: true,
search: 'auto',
subMaxLevel: 3,
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
</body>
</html>
Replace Project Name and the description based on the project's metadata (pyproject.toml, package.json, etc.).
docs/_sidebar.md — navigation sidebar:
- [Home](/)
- Getting Started
- [Installation](/getting-started/installation.md)
- [Quick Start](/getting-started/quick-start.md)
- Guides
- [Basic Usage](/guides/basic-usage.md)
- API Reference
- [Overview](/api/index.md)
Populate the sidebar based on the actual topics the project needs documented. The file-system structure under docs/ should mirror the sidebar hierarchy.
Critical: Every link in
_sidebar.mdmust use an absolute path starting with/(resolved from the docs root), e.g./guides/basic-usage.md— never the relative formguides/basic-usage.md. Docsify resolves relative sidebar links against the current page's URL, not the docs root, so when a user is already on/task-configuration/foo.mdand clicks a relative linktask-configuration/bar.md, the browser requests/task-configuration/task-configuration/bar.mdand 404s. Absolute paths always resolve from the docs root regardless of which page the user is currently viewing. This rule applies to every sidebar entry, including nested groups and the home link.
docs/_coverpage.md — landing page:

# Project Name <small>v1.0</small>
> Brief tagline describing what the project does.
- Key feature 1
- Key feature 2
- Key feature 3
[GitHub](https://github.com/owner/repo)
[Get Started](#project-name)
Fill in real content from the project metadata — remove the logo line if there's no existing logo.
docs/README.md — home page content (Docsify uses this as the default landing page):
# Project Name
Introduction to the project.
## Features
- ...
## Installation
...
## Quick Example
...
docs/.nojekyll — empty file to disable Jekyll processing on GitHub Pages:
Before creating these files, tell the user what will be created and confirm. They may prefer a different doc system, or want specific branding/metadata in the landing page.
Before making changes, read the existing doc to understand:
Common updates include:
For each change:
See references/DOC-CONVENTIONS.md for how to discover and follow the project's documentation conventions. Always match:
Run any documentation validation commands discovered in the project setup step:
# Examples — use whichever applies to the project
npm run lint # or yarn/pnpm equivalent
make docs-lint
sphinx-build -W ... # Warnings as errors
mkdocs build --strict
Use this when adding documentation for entirely new features.
If a sidebar/navigation config was discovered: Use the sidebar hierarchy as the primary guide for placement. Find the section in the sidebar where the new doc logically belongs, and place the file in the directory path that mirrors that sidebar position. Then update the sidebar config to include the new entry.
If no sidebar exists: Examine the existing documentation directory structure to find the right location:
| Doc Type | Where to Look |
|---|---|
| API reference | api/, api-reference/, reference/ |
| Guide / How-to | guides/, tutorials/, how-to/ |
| Configuration | configuration/, config/, reference/ |
| CLI reference | cli/, commands/ |
| Conceptual / Explanation | concepts/, architecture/, explanation/ |
In either case, match the project's existing structure rather than inventing new locations.
Follow the naming conventions used by existing docs:
my-feature.md) vs snake_case (my_feature.md)01-my-feature.md) for orderingindex.md, _index.md, README.md)Instead of applying a fixed template, read 2-3 similar existing docs and replicate their structure:
Minimal fallback template (if no existing docs to reference):
---
title: Feature Name
description: Brief description of what this feature does.
---
# Feature Name
Brief introduction explaining what this feature does and why it's useful.
## Usage
Basic usage example with code.
## API Reference
Detailed reference for parameters, options, and return values.
## Examples
Additional examples for common use cases.
## Related
- Links to related documentation
If the project has a sidebar/navigation config (discovered in the project structure step), you must update it when adding a new page:
Common sidebar config files:
_sidebar.md, SUMMARY.md (Docsify, mdBook)sidebars.js (Docusaurus)mkdocs.yml nav section (MkDocs)_toc.yml (Jupyter Book)antora.yml nav (Antora)If no sidebar config exists, skip this step.
After all documentation updates are applied and validated, record the current code-sync commit hash so the next run can resolve its incremental diff base correctly.
git rev-parse HEAD
Update (or create) the sync tracking file. Prefer the location that already exists; otherwise ask the user where to create it. Default: .docs-sync at the repository root.
<commit-hash>
<ISO-8601 timestamp>
Example .docs-sync content:
abc1234567890abcdef1234567890abcdef123456
2026-04-11T14:22:00Z
Notes:
HEAD (the recorded hash represents what the docs are synced to, not what was reviewed).docs-sync to .gitignore? No — the file must be committed so other contributors and future runs can read itWhen committing documentation updates, include the sync file in the same commit so the sync state and the docs it represents stay in lockstep.
Before committing documentation changes:
_sidebar.md (or equivalent) starts with / and resolves from the docs root; no relative paths that would cause duplicate-prefix 404s when navigating from a nested pageHEAD hashreferences/DOC-CONVENTIONS.md - How to discover and follow project documentation conventionsreferences/CODE-TO-DOCS-MAPPING.md - Strategies for mapping source code changes to documentation files