sds-mode/code-to-docs-skill/code-to-docs-update
- community
Checking that the SKILL.md file is still in the repository.
Incrementally update an existing code-to-docs vault after coding changes. Diffs against the last documented commit, re-analyzes only affected modules, merges with existing docs, and tracks issue resolution. Use when someone says update docs, sync docs, refresh documentation, or after making code changes.
Install
npx vskill@latest install sds-mode/code-to-docs-skill/code-to-docs-updateSKILL.md
Overview
Run an incremental documentation update instead of a full generation. Reads _state/analysis.json from the existing vault, diffs against the stored commit, re-analyzes only affected modules, and merges results with existing docs.
The governing idea: touch only what changed. A module that did not change is carried forward by leaving its analysis report alone on disk — not by reading it, not by re-summarizing it, and never by re-deriving its boundaries. Anything the update needs to know about an unchanged module is already in _state/analysis.json.
Related Skills
| Skill | Purpose | |
|---|---|---|
code-to-docs:code-to-docs | Full generation (quick or full mode) — use when no vault exists yet | |
code-to-docs:code-to-docs-digest | Load existing vault context before coding (read-only) |
Invocation
<path>— codebase root (default:.current directory)--output— vault path containing the existing_state/analysis.json(default:./docs-vault/)
Prerequisites
- An existing vault with
_state/analysis.jsonat the output path - The codebase must be a git repository, and the vault's stored
git_commitmust be non-null and reachable in the current repo (needed forgit diff) - If any prerequisite is missing, fall back to a full generate run and inform the user
A vault written before the analysis artifacts existed (no schema_version / module_index) is not a missing prerequisite — it migrates in place with a one-time Haiku backfill. See Step 1 below.
Model Tiers
Same tiers as code-to-docs:code-to-docs — see that skill for the full table. Key rule: use the cheapest model that meets the task's cognitive demand. Haiku for extraction/mechanical, Sonnet for writing, Opus only for complex modules or large-codebase synthesis.
Pass 2 tier is escalate_final = escalate OR loc > 1000 OR complexity == "high" OR language ∈ {bash, sh, zsh, shell, powershell}, recomputed from the module's fresh Pass 1 receipt. Do not take the raw escalate flag at face value, and do not re-derive the tier from the report's prose.
Pass Pointers, Not Payloads
Same rule as code-to-docs:code-to-docs, and it is what makes an update cheap: agent prompts carry paths and small structured data, never the text of a file on disk. See ../code-to-docs-references/output-structure.md "The Reference-Passing Rule".
In update mode this has one specific consequence worth stating plainly: carrying a module forward is a no-op. Its _state/modules/<slug>.md report already sits at the path recorded in module_index, so an unchanged module costs zero reads and zero tokens. Reading it — or reading its generated Modules/{Name}.md — to "carry it forward" defeats the entire mechanism.
Execution
`../code-to-docs-references/analysis-guide.md` section "Incremental Update Flow" is authoritative for every step below — read it before executing. Also read ../code-to-docs-references/output-structure.md (state schema, vault layout) and ../code-to-docs-references/obsidian-templates.md (formatting rules). Do not duplicate the reference's per-step tables here.
The flow, in order:
- Claim, load & validate state — take the concurrency claim first by exclusive-create of
_state/.lock(if it already exists, another update is in flight: report and abort). Then read and schema-validate_state/analysis.json; on missing or malformed state, fall back to a full generate run. Ifschema_versionormodule_indexis absent, run the one-time v1 → v2 migration (Haiku-only backfill) and continue — do not fall back to full generate. Record the loadedgit_commit/timestampas the claim token. Read only the state file here. Release the lock on every exit path, including the step-2 no-changes exit. - Check the stored commit, then diff — if
git_commitis null or unreachable (rebased/squashed/gc'd/shallow), fall back to full generate. Otherwise rungit diff <stored_commit>..HEAD --name-only, and also capture the content diff of changed files inside known module roots, scoped bymodule_index[*].roots(step 4 needs it). Empty diff → report "no changes" and exit. - Map changed files to modules — a lookup, not a survey: exact
files_analyzed[path]hit, else a unique root prefix match, else an ambiguous match where modules share a root, else outside every module. Seeoutput-structure.md"Resolving a Changed File to Its Module". Also mark as affected any module whose carried-forward report is damaged — mismatchedsource-commit, missing file, or a missing/duplicated<!-- c2d:sN -->marker counted anchored (grep -cE '^<!-- c2d:s[1-7] -->$'≠ 7; a loose substring count over-reports on reports that quote markers in prose). Build the affected-module list; everything else is carried forward. - Auto-select quick/full — decide now, from the changed-file list,
files_analyzed,module_index, and the step-2 content diff (used to detect new cross-module imports). New/deleted module, changed dependency structure, or >50% churn → full; otherwise quick. When unsure, prefer full. - Re-analyze affected modules — re-check the claim (lock still yours, state unchanged) before writing anything, then run the same two-pass analysis as baseline against each module's existing report path: Pass 1 overwrites sections 1-6, Pass 2 appends section 7. In full mode, also run Module Identification scoped to the case-4 paths to pick up genuinely new modules. Unchanged modules are left alone entirely.
- Merge synthesis — rebuild the dependency graph from fresh receipts plus the stored graph, rewrite
_state/synthesis.md, and merge issues (see Issue Tracking below). - Selective generation — regenerate affected module docs always, plus the docs of any module in the relink set (analysis unchanged, but it referenced something removed); gate each cross-module output on signals covering every input in its dispatch-table row (graph, purposes, patterns, issues, module set), and report what was skipped. Clean up every artifact of a deleted module. Pass inputs by reference per the Phase 2 dispatch table.
- Update state (with a concurrency guard) — re-read the state file and abort if its
git_commit/timestampchanged since step 1 (a concurrent update); otherwise write the new state and append a session entry. Re-analyzed modules get freshmodule_indexentries; carried-forward modules keep their originalanalyzed_at/source_commit. - Verify — Haiku agent checks wikilinks + frontmatter across the files written this run, plus (only if something was deleted or renamed) files carrying links to the removed titles.
Issue Tracking Across Updates
The per-case merge rules live in ../code-to-docs-references/analysis-guide.md "Update Step 6: Merge Synthesis" — read them there. They are not restated here, because a copy of that table in this file drifted from the original once already.
The one invariant worth stating twice, because it is the difference between useful and actively harmful output:
Marking an issueresolvedrequires positive evidence that the code it points at actually changed — the diff touched itsfile(and overlapped itslineswhen recorded), or the module was deleted outright. Never flip an issue toresolvedmerely because a non-deterministic re-analysis didn't mention it. That silently tells users a still-present bug is fixed.
Red Flags
- Diffing against a null or unreachable stored commit instead of falling back to full generation
- Marking an issue
resolvedwithout positive evidence — the diff touched its file/lines, or its module was deleted - Choosing quick vs full from data that only exists after re-analysis — the mode is decided in step 4 from signals gathered in step 2
- Re-analyzing unchanged modules — only affected modules get re-analyzed
- Skipping state-file validation, or writing without the concurrency guard — checked twice, before Step 5 and at Step 8
- Deleting unchanged module docs — preserve them; regenerate only affected modules and the relink set
- Re-surveying the codebase to re-derive module roots —
module_indexis authoritative; a re-survey can rename a module and break every wikilink pointing at it - The orchestrator reading an unchanged module's `_state/modules/<slug>.md` or `Modules/{Name}.md` — carrying forward means leaving the file alone, not loading it. (A relink-set doc is regenerated, but the dispatched agent reads that report by path; the orchestrator still never does — see #14.)
- Advancing a carried-forward module's `analyzed_at` / `source_commit` — that falsely claims it was analyzed at this commit and destroys staleness tracking
- Falling back to a full generate run on a v1 state file instead of migrating it
- Reading the previous `_state/synthesis.md` — every input needed to rewrite it is in
module_indexand the receipts - Writing reports without re-checking the concurrency claim first — losing the race after Step 5 leaves your reports beside another run's state
- Leaving a deleted module's report or doc on disk — every future update carries it forward as a module that no longer exists
- Preserving the doc of a module that linked to a deleted one — its
dependenciesfrontmatter and prose wikilinks dangle permanently, and scoped verification stops looking for them after this run. Regenerate it from its existing report (the relink set) - Overwriting rather than merging a shared file's owners in `files_analyzed` — the losing module is then never re-analysed when a file it owns changes
- Skipping a cross-module regeneration without saying so — a silent skip is indistinguishable from a bug; report what was skipped and which signal was unchanged
- Gating an output on signals that miss one of its dispatch-table inputs — e.g. gating System Overview on the graph alone when it also consumes system-wide patterns; the output then drifts out of sync with what it projects
- All red flags from
code-to-docs:code-to-docsalso apply during the re-analysis phases — including its reference-passing rules
Rationalization Traps
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/code-to-docs-update/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sds-mode/code-to-docs-skill/code-to-docs-update)