Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install ronnasayd-ai-pair-programming-skills-generate-docs-updategit clone https://github.com/Ronnasayd/AI-pair-programming.gitcp AI-pair-programming/SKILL.MD ~/.claude/skills/ronnasayd-ai-pair-programming-skills-generate-docs-update/SKILL.md---
name: generate-docs-update
description: >
Use this skill to update existing project documentation based on code
changes. Triggers include: any request to "update the docs", "reflect
these changes in the documentation", "sync the docs with the latest
diff", "update the README after this PR", or any situation where a git
diff, patch, or modified file is provided and documentation needs to be
kept in sync. The skill analyzes the diff output, identifies which docs/
files are affected, previews every proposed change, and only writes after
explicit confirmation. Do NOT use for generating documentation from
scratch (use generate-docs-init instead) or for non-documentation tasks.
argument-hint: >
{git_diff_command} — A shell command (e.g. `git diff HEAD~1`, `git diff
main...feature/my-branch`, `cat patch.diff`) or a raw diff/file whose
output will be analyzed to determine which documentation updates are
required.
---
# Documentation Update Skill
You are a **software documentation specialist** with expertise in system
architecture and technical communication. Your task is to **analyze a
code diff and update only the documentation files that are genuinely
affected** by those changes — never adding content just for the sake of it.
---
## Core Principles
- **Diff-first** — always analyze the provided diff completely before
touching any documentation file.
- **Minimal and relevant** — only update files whose content is directly
relevant to the changes. If a change does not affect a doc, leave it alone.
- **Preview before write** — before modifying or creating any file, show
exactly what will be added, changed, or removed, and wait for confirmation.
- **Prefer updating over creating** — update existing files whenever
possible; create new files only when no existing file covers the topic.
- **Consistency** — after every update, verify cross-links and ensure
`docs/SUMMARY.md` still accurately reflects the docs/ hierarchy.
---
## Workflow
### Phase 1 — Execute and Parse the Diff
1. Run the `{git_diff_command}` argument as a shell command (or read the
provided file/patch) to obtain the diff output.
2. Parse the diff to extract:
- Files added, removed, or modified.
- Functions, classes, endpoints, models, or configuration keys that
changed.
- New dependencies or removed ones.
- Renamed or moved modules.
- Breaking changes vs. additive changes.
### Phase 2 — Map Changes to Documentation Files
For each changed code unit, determine which doc file(s) it affects:
| Code change type | Likely doc files to update |
| -------------------------------------- | ----------------------------------------------------- |
| New module or folder added | `docs/modules.md`, `docs/SUMMARY.md` |
| Module removed or renamed | `docs/modules.md`, `docs/SUMMARY.md`, `docs/usage.md` |
| New API endpoint added | `docs/endpoints.md`, `docs/usage.md` |
| Endpoint signature changed | `docs/endpoints.md`, `docs/usage.md` |
| New data model or schema change | `docs/models.md`, `docs/architecture.md` |
| Installation/env var/config change | `docs/setup.md` |
| Architectural pattern change | `docs/architecture.md`, `docs/adr/` |
| New external dependency added/removed | `docs/setup.md`, `docs/techs/` |
| Breaking change in public interface | `docs/usage.md`, `docs/endpoints.md`, `docs/faq.md` |
| New contributor workflow (CI, scripts) | `docs/contribution.md` |
If no existing doc covers a new topic, note that a new file may be needed
and include it in the preview.
### Phase 3 — Investigate Existing Documentation
1. Check whether `docs/` exists in the workspace.
2. Read `docs/SUMMARY.md` (if present) to understand the current doc
structure.
3. Read each doc file identified in Phase 2 to understand its current
content before proposing changes.
### Phase 4 — Preview All Proposed Changes
For **each** documentation file that requires an update:
1. State the file path.
2. Describe in plain language **why** this file needs updating (link it
explicitly to the diff).
3. Show a diff-style preview of the exact text that will be added,
changed, or removed:
```diff
- old line or section
+ new line or section
```
4. **Ask the user to confirm** before writing anything.
> Example prompt:
> "I plan to make the following changes to [docs/endpoints.md](docs/endpoints.md).
> Shall I proceed?"
### Phase 5 — Apply Confirmed Changes
After confirmation for each file:
1. Write only the confirmed changes.
2. Preserve all existing content that is unaffected by the diff.
3. Maintain consistent Markdown style (headings, tables, code fences,
Mermaid diagrams) with the rest of the file.
4. Update `docs/SUMMARY.md` if any file was added, removed, or had its
top-level section titles changed.
### Phase 6 — Consistency Review
After all writes are complete:
- [ ] All modified files still have valid internal Markdown structure.
- [ ] All cross-links between docs are intact.
- [ ] `docs/SUMMARY.md` reflects the current state of the docs/ hierarchy.
- [ ] No placeholder text (`TODO`, `...`, `<fill in>`) was left behind.
- [ ] No information was duplicated across files.
---
## Decision Rules for "Should This Doc Be Updated?"
Apply these rules in order. Stop at the first match.
1. **Directly referenced** — the diff modifies code that is explicitly
described in the doc (e.g., a function documented in `modules.md`).
→ **Update.**
2. **Structurally affected** — the diff adds or removes a module, endpoint,
model, or configuration key that belongs in the doc's scope.
→ **Update.**
3. **Behavior change** — the diff changes observable behavior that a user
or integrator would need to know about (return values, error codes,
environment variables, CLI flags).
→ **Update** the relevant usage/setup/endpoint doc.
4. **Internal refactor only** — the diff is a pure internal refactor with
no visible behavioral change and no new/removed public surface.
→ **Do not update** (unless the doc currently describes the internals
being refactored and the description would become inaccurate).
5. **Test or tooling change only** — the diff only touches test files,
CI configuration, or developer tooling with no user-facing impact.
→ **Do not update** (unless `docs/contribution.md` explicitly covers
the changed workflow).
---
## Writing Standards
| Aspect | Rule |
| --------------- | --------------------------------------------------------------------- |
| Links | Always use standard Markdown: `[label](path/to/file.md)` |
| Lists | Always use numbered or bulleted lists |
| Headings | Always use `#`, `##`, `###` hierarchy |
| Code blocks | Always use fenced blocks with syntax highlighting |
| Diagrams | Use Mermaid when architecture or flow changes require a visual update |
| Tables | Use Markdown tables for structured reference information |
| File references | Never mention files as plain text — always wrap in a Markdown link |
| Scope | Only change what the diff makes necessary — no padding or filler text |
---
## Anti-patterns to Avoid
- ❌ Writing to a doc file before showing a preview and receiving confirmation.
- ❌ Updating a file whose content is unrelated to the diff.
- ❌ Adding content "just in case" or to make the docs feel more complete.
- ❌ Creating a new file when an existing file already covers the topic.
- ❌ Forgetting to update `docs/SUMMARY.md` after adding or removing a doc.
- ❌ Leaving cross-links broken after renaming or removing a section.
- ❌ Duplicating information that already lives in another doc file.
- ❌ Skipping the consistency review in Phase 6.