一键导入
do-docs
Cascade documentation updates after a code change. Triggered by 'update docs', 'sync the docs', or any request about documentation updates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Cascade documentation updates after a code change. Triggered by 'update docs', 'sync the docs', or any request about documentation updates.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Pre-publish editorial gate for external-audience content: removes AI-writing tells and blocks hollow drafts. Use on documents, presentations, emails, posts, or web copy once a first draft exists. Triggered by 'de-slop this', 'editorial pass', 'humanize this', 'remove the AI tells', or invoked as a mandatory gate by email, do-presentation, linkedin, and x-com.
Stage, launch, grade, and schedule a Claude Managed Agent (CMA) from a build-sheet. Triggered by 'build the agent', 'launch this agent', 'deploy a managed agent', or as /imagine-agent's handoff.
Create/review/maintain Claude Code Routines (cloud scheduled agents, aka 'Cowork'). Triggered by 'set up a routine', 'schedule a cloud agent', 'cowork task', 'migrate to a routine'.
Create a polished Marp slide deck about a feature, concept, or system. Triggered by 'make a presentation', 'create slides', 'do-presentation', or 'explain this as a deck'.
Use when reading, searching, drafting, or sending email. Triggered by 'read my email', 'check my inbox', 'send an email', 'reply to that email', 'search my mail', or any request to read/send mail.
Use when reading posts or engaging on LinkedIn. Triggered by requests to comment on LinkedIn, browse the feed, write or interact with posts, check DMs, or read/reply to LinkedIn messages.
| name | do-docs |
| description | Cascade documentation updates after a code change. Triggered by 'update docs', 'sync the docs', or any request about documentation updates. |
After a code change lands, find every document that references the changed area and make targeted, surgical updates so docs match the actual implementation.
If .claude/skill-context/do-docs.md exists, read it and honor its declarations; otherwise use the generic defaults described below.
The context file is where a repo layers its own automation onto this generic baseline. It may declare: a stage/status marker command to run at the start and end of the cascade; how to resolve plan context for the change; the canonical doc locations and index files to scan; a semantic doc-impact tool; an auto-fix substrate to run before manual edits; index tables to maintain; and how to mark an associated plan complete. When the file is absent (the common case), this skill runs entirely on git and gh — no repo-specific tooling required.
Launch the exploration agents in parallel using the Task tool. Agents A and B are always run; Agent C runs only if the context file declares a semantic doc-impact tool; Agent D runs only when gh is available and the host has GitHub issues.
Agent-type pin (issue #2022): every sub-agent this skill spawns runs shell commands (git, gh, grep), so spawn them ONLY on a Bash-capable agent type — documentarian or general-purpose. Never select an agent type without shell tools for docs work: a tool-less child cannot execute its first git command and wedges, emitting the command as plain text with zero tool calls.
Spawn a sub-agent with this prompt:
Explore and summarize the code change described by: <INPUT>
### Pass 1: Structural read (diff only)
1. If this looks like a PR number (e.g. "123" or "#123"):
- Run: gh pr view <number> --json title,body,files,additions,deletions
- Run: gh pr diff <number>
2. If this looks like a commit SHA:
- Run: git show <sha> --stat
- Run: git show <sha>
3. If this is a text description:
- Search the recent git log for matching commits
- Run: git log --oneline -20
- Identify the most relevant recent commits and inspect their diffs
### Pass 2: Full file reads (not just diff)
For every modified file, read the ENTIRE file — not just the changed lines.
This reveals context the diff hides: return type conventions, naming patterns,
how callers use the changed code, and whether the change is consistent with
the rest of the file.
### Pass 3: Cross-file data flow
Trace how data flows between modified files. Look for:
- String keys used in one file and matched in another (fragile coupling)
- Shared data structures written by one module, read by another
- Import changes that add or remove cross-module dependencies
### Pass 4: Intent vs. actual changes
If a PR description or commit message exists, compare what it CLAIMS changed
against what the diff ACTUALLY shows. Flag discrepancies — stated removals
that are actually additions, described refactors that are incomplete, etc.
### Produce a structured summary:
- **What changed**: Files modified, functions added/removed/renamed, config keys changed
- **API surface changes**: New/removed/renamed public interfaces, parameters, return types
- **Behavioral changes**: Different defaults, new error conditions, changed workflows
- **Cross-file couplings**: Data that flows between modified files and how
- **Key terms**: Important identifiers (function names, config keys, command names, file paths) that docs might reference
- **Retired terms**: Old identifiers, patterns, or concepts that the change replaces — these become grep targets for stale references
Spawn a sub-agent with this prompt:
Inventory all documentation in this repository. For each file, note its purpose and what it references.
Discover documentation with git rather than assuming a fixed layout:
git ls-files '*.md' 'docs/**' 'README*'
If the repo-context file declares canonical doc locations or an index file, scan those
first and in the priority order it gives. Otherwise, prioritize by convention:
1. README.md and any top-level project guidance file (e.g. CONTRIBUTING.md)
2. docs/**/*.md
3. Any documentation index/table-of-contents file
4. Everything else returned by git ls-files
For each doc file found, produce one line:
<filepath> | <one-line purpose> | <key topics/identifiers referenced>
Do NOT read file contents in full — scan headings, section titles, and grep for key identifiers.
Run this agent only if the repo-context file declares a semantic doc-impact tool. The context file gives the exact invocation. Spawn a sub-agent that runs the declared tool with a 2-3 sentence natural-language summary of the change, and report the ranked results.
If no semantic tool is declared (the generic case), skip Agent C — lexical matching from Agents A and B plus the stale-reference sweep (Step 2b) is sufficient.
gh and issues are available)Spawn a sub-agent with this prompt:
Review all open GitHub issues to identify any that are affected by the code change
described below. Merged features often have downstream effects on planned work
whose context only lives in issue descriptions.
CHANGE SUMMARY:
<Insert Agent A's structured summary here>
Steps:
1. List open issues:
gh issue list --state open --json number,title,body,labels,comments --limit 50
2. For each issue, evaluate:
- Does the issue description reference components, APIs, or patterns that this change modifies?
- Does this change fulfill a prerequisite or dependency mentioned in the issue?
- Does this change invalidate assumptions, approaches, or estimates in the issue?
- Does this change introduce new capabilities the issue could leverage?
3. For each affected issue, post a comment (do NOT edit the issue body):
gh issue comment <number> --body "$(cat <<'COMMENT'
**Upstream change notice** — a related change just landed that may affect this issue.
**What changed:** [1-2 sentence summary of the relevant change]
**Impact on this issue:** [How it affects the planned work — prerequisite met, approach invalidated, new capability available, etc.]
**Action needed:** [What should be reconsidered — scope, approach, dependencies, or nothing]
_Auto-posted by /do-docs cascade_
COMMENT
)"
4. Report which issues were commented on and why. If no issues are affected, report that.
IMPORTANT: Only comment on issues where the impact is concrete and actionable.
Do not comment on tangentially related issues. Quality over quantity.
Wait for the launched agents to complete before proceeding. If an optional agent (C or D) was skipped or returned no results, proceed with the remaining agents' output only.
Using the outputs from Agent A (change summary), Agent B (doc inventory), and Agents C/D when run, evaluate every doc file against these four triage questions:
| # | Question | If YES |
|---|---|---|
| 1 | Does it reference the area that changed? (mentions the same files, functions, config keys, commands) | Needs update |
| 2 | Does it depend on the change? (describes behavior that the change alters) | Needs update |
| 3 | Does it teach a pattern this change modifies? (examples, templates, workflows using old API) | Needs update |
| 4 | Does it orchestrate a workflow using the changed components? (step-by-step instructions that now have different steps) | Needs update |
If ALL four answers are NO, skip that doc.
If Agent C ran, merge its results with relevance >= 0.5 into the affected list: if a doc is already listed, note the semantic reason as additional context; if not, add it with Agent C's reason as the justification. Agent C catches conceptual coupling that keyword matching misses.
Produce an ordered task list of affected docs, ordered by dependency — foundational docs first (primary guidance, feature docs), then derivative docs (commands, plans, skills).
Format:
## Affected Documents
1. [ ] `<filepath>` — <what needs to change and why>
2. [ ] `<filepath>` — <what needs to change and why>
...
## Unaffected (skipped)
- `<filepath>` — no references to changed area
...
If zero documents are affected, report that clearly and stop.
Using the Retired terms from Agent A's summary, grep across all tracked docs for old keywords that the change replaced. This catches references the triage questions miss — docs that use an old name, pattern, or concept without directly depending on the changed file.
# Search every tracked markdown/doc file for each retired term
git grep -n "<retired-term>" -- '*.md' docs/ 2>/dev/null
If the context file declares additional doc locations (config files, persona segments, etc.), include them in the sweep. Add any new hits to the affected documents list from Step 2.
After identifying docs that need updating, ask what docs should exist but don't:
If something is missing, add a task to create it (not just update existing docs).
If the repo-context file declares an auto-fix substrate, run it against the changed files before doing manual edits. Such a substrate typically handles mechanical fixes — renamed markdown links, renamed paths/symbols, index entries pointing at deleted files, and stale-term renames — so Step 3 only handles cases requiring human judgment. Follow the context file's invocation and output-handling instructions exactly, and do not re-commit changes the substrate commits itself.
If no substrate is declared (the generic case), skip this step — all edits are made manually in Step 3.
For each affected document still needing edits, in dependency order:
Rules for edits:
After all edits are complete:
Check only intended files were touched:
git diff --name-only
Every file in this list should appear in the Step 2 task list. If there are unexpected files, revert them.
Review each diff is minimal and correct:
git diff
Each change should be a targeted update, not a rewrite.
Flag conflicts for human review:
If any document has contradictory information that cannot be resolved from the code alone (e.g., a plan doc describes future work that may or may not still be valid), create a GitHub issue (when gh is available):
gh issue create --title "Doc conflict: <filepath> may need human review" \
--body "The /do-docs cascade found a potential conflict in <filepath> after <change description>. The doc references <X> but the code now does <Y>. Human judgment needed to resolve."
Report summary:
## Documentation Cascade Complete
**Change**: <brief description of what triggered the cascade>
**Documents updated**:
- `<filepath>` — <what was changed>
- `<filepath>` — <what was changed>
**Documents reviewed but not changed**:
- `<filepath>` — still accurate
**Issues created for human review**:
- #<number>: <title> (if any)
**Open issues commented on** (downstream impact notices):
- #<number>: <title> — <impact summary> (if any)
**No changes needed**: (list if applicable)
Commit changes:
git add -A && git commit -m "Docs: cascade updates for <brief change description>"
Documentation changes must be persisted. If this fails (e.g., nothing to commit), that's fine — report "no changes needed." Push if the workflow expects it (git push).
Push-ancestry guard (this repo — #2026). Before any git push to main
from a cascade, run the push-ancestry guard so a worktree HEAD left detached at
a PR branch head cannot register the open PR's ancestry as its merge:
sdlc-push-guard || { echo "Push refused: HEAD carries open-PR ancestry — checkout main / merge through gh pr merge"; exit 1; }
git push
The guard only fires when HEAD is at/descended-from an OPEN PR head; a clean
main checkout passes untouched. (The installed pre-push hook runs it too; this
explicit call makes the protection independent of hook installation.)
.env references in docs, setup commands, and deployment docs.This skill pairs with:
/do-build — run after build completes to cascade doc updates for the shipped code/do-plan — plans created here may need updating when prerequisites ship/do-pr-review — PR review can invoke this to verify docs match implementation