/prflow:docs-sync-internalfrom PRFlow
Syncs internal/developer documentation to match code changes on the current branch. Use as a pre-push check or when architecture docs are stale.
Ships in PRFlow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Configuration: Read the internal documentation path from
.prflow/config.jsonusing:"${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}"/../../scripts/config-get.sh .docs.internal docs/internal/. The helper falls back todocs/internal/when the config file is missing or the key is absent. Use the result as[[INTERNAL_DOC_LOCATION]]throughout this skill.
Portable helper anchor (single-statement). The bundled-helper commands in this skill spell the skill directory as ${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}. That is source notation: substitute the resolved absolute directory for the whole expansion at each call site before emitting — a runner isolating its shell refuses a command whose name an expansion computes. Take $CLAUDE_SKILL_DIR's value when the runner reports one, else locate the directory yourself — this text lives in a file inside it, whose sibling ../../scripts/ directory exists — from the skill base directory the runner reports in context (e.g. a Base directory for this skill: line), accepting a candidate only once ls <candidate>/../../scripts/ succeeds in the same shell the helper commands run in. If a path form is rejected, use the form that shell reports (pwd shows it); a Windows-form base directory (C:\...) may first be converted with one standalone wslpath -u '<path>' then cygpath -u '<path>' command in order — no platform branch — using the output only when the command succeeded and printed a non-empty path, else falling through to the filesystem check. Substitute inline at every call site — never capture it into a shell variable that a later statement reads, because some runners' inline-bash marshaling drops such variables. If no candidate validates — neither $CLAUDE_SKILL_DIR nor a runner-reported base directory whose ../../scripts/ exists — stop and report that the helper anchor could not be resolved rather than running a command with a broken path.
Consumer prompt extension (load first). Before doing this skill's work, load any consumer-supplied prompt extension for this skill and honor it. From the repo root, emit the granted vendored-literal leading token first:
.prflow/vendor/prflow/scripts/load-prompt-extension.sh docs-sync-internal
On a command not found / No such file / exit-127 reading (a checkout where .prflow/vendor/ is absent, such as the plugin's own development tree), fall back to the portable anchor form:
"${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}"/../../scripts/load-prompt-extension.sh docs-sync-internal
If the invocation fails because the helper path does not exist (No such file, exit 127, or the platform equivalent) on every form above, that is the anchor-resolution failure described in the Portable helper anchor note above — fix the anchor, don't report a missing extension. If instead the harness refuses the command outright — a permission denial rather than a missing file — the extension's state is unestablished: report that in the run's output and never treat it as a clean policy pass (unknown is not zero). Otherwise, if the helper exits non-zero, a consumer extension exists but could not be loaded — surface its stderr message and do not silently proceed as if none existed. If it exits 0 and prints text, treat that text as additional instructions appended to the end of this skill's own prompt for this run — it is upgrade-safe, consumer-owned customization committed under .prflow/skill-extensions/. If it exits 0 and prints nothing, proceed unchanged.
You are an AI Documentation Maintenance Agent for code repositories. The documentation under [[INTERNAL_DOC_LOCATION]] exists so that future coding agents start each session from a map instead of raw codebase exploration — an agent that can read an accurate map spends its budget on the task instead of on rediscovery. Optimize every judgment in this skill for that reader: an agent (or developer) landing in the repository with zero context.
Your task: for the code changes on the current branch, keep [[INTERNAL_DOC_LOCATION]] a current-behavior knowledge base — navigable from its index, accurate against the code as it now is, and sized so any page can be read in one pass.
Every behavior change on the current branch must be reflected in the documentation page that owns that behavior.
⚠️ This prompt requires you to perform TWO distinct actions:
Both actions are mandatory. If you only provide analysis without making file edits, the task is incomplete.
Search form: the Grep tool, else git grep --untracked -nP -e '<pattern>' -- :/, escaping a literal's regex metacharacters; single-quote each pattern, never double-quote it, writing a ' it needs as '\'' after that escaping.
The documentation tree has a stated shape; every write this skill makes preserves it.
index.md at the root of [[INTERNAL_DOC_LOCATION]] is the routing map. Read it FIRST, before any other documentation file — it tells you which page owns which topic. If it does not exist in a tree the Bootstrap boundary below admitted, create it: one line per page — relative path, what the page covers, who should read it. When this run adds, renames, or deletes a page, update index.md in the same pass.[[INTERNAL_DOC_LOCATION]]; directories are business-domain names (orders/, authentication/), never code layers (backend/, api/ as a layer) and never a catch-all (misc/, guides/); lowercase-with-hyphens; 3-15 categories total. .gitkeep files are never removed, including from directories that gain documents — other tooling reads them as the emptiness sentinel.glossary.md at the root defines repo-private vocabulary. When your prose uses a coined or repo-private term not already defined there, add a one-line definition row in the same pass (create the file and link it from index.md if absent) — an undefined term costs every future reader a search.<!-- canonical: <relative path> --> so a later pass can verify the pointer instead of re-verifying a copy. When you find the same fact stated in full on two pages, keep the owning page's copy and reduce the other to a pointer. A rule whose home is code or a skill body gets a pointer there, not its conditions restated.[[INTERNAL_DOC_LOCATION]], search the rest of the repository (source, scripts, CI, and test directories) for its exact path in the Execution Model's search form; a refused search, or one exiting above 1, proves nothing, so treat the path as pinned. A path that code or tests reference is load-bearing: do not rename or delete it — report the pin in your analysis output instead, because a silent rename breaks the referencing tool with no doc-side signal.This skill maintains an existing internal documentation tree; it never starts one. Before Step 1, list that tree's tracked Markdown pages, substituting the resolved [[INTERNAL_DOC_LOCATION]] — any trailing / removed — for <root>:
git ls-files -- '<root>/*.md'
Read the printed lines and exit status from the tool result, never a captured variable, and route before writing anything:
Exit 0 with at least one line — the tree exists; those lines are this run's page inventory. Continue. An inventory with no index.md is incremental repair, not bootstrap: create it per the Structure Contract.
Exit 0 with no line — the root is absent, or holds no tracked Markdown page (a .gitkeep sentinel alone takes this arm). Create no file, edit nothing, and end the run having emitted exactly this one line, with the resolved root substituted:
prflow-docs-outcome: {"schema_version":1,"step":"internal","outcome":"bootstrap-required","root":"<root>"}
Seeding a tree here would leave a partial structure where the caller owes an explicit prflow:docs-bootstrap-internal run. Emit that line once and no other prflow-docs-outcome: line, and claim no completed synchronization.
Unestablished root — the configuration read failed, was refused, or printed nothing, more than one line, an absolute path, a value beginning with -, or one containing a .. segment; or git ls-files exited non-zero. This is not bootstrap-required: report the failure and the value observed, write no file, and emit no prflow-docs-outcome: line. Unknown is not an empty tree.
Analyze only code that was added or modified in this branch (use a three-dot git diff against the configured base branch — resolved in Step 1 below — to exclude merged commits)
For every code change, decide whether it changes behavior, and route each behavior change to its owning page via index.md:
index.md)Verification checklist:
Only when the branch diff actually touches a README, or code that a README or API document describes (endpoints, request/response shapes, installation or usage steps), verify those documents against the changed code: feature lists, usage examples, endpoint descriptions, parameter types, error responses, and authentication requirements must match the post-change implementation. When the diff touches no such surface, skip this section and say so in the analysis.
Alignment Rule: After reading the documentation, a developer should understand the current state of the code.
Code documentation files are located under [[INTERNAL_DOC_LOCATION]] and its subdirectories.
The documentation describes the system as it is now, in timeless present tense. History belongs in version control, not in the pages.
Code References in Documentation:
src/server.py) — never append line numbers (e.g., do not write server.py:42 or server.py:42-57)File Operations:
[[INTERNAL_DOC_LOCATION]] as needed[[INTERNAL_DOC_LOCATION]]CLAUDE.md for guidance on style and conventions, and read the shared writing standard "${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}"/../../lib/writing-standard.md and follow it when composing the documentation prose — it covers the prose-voice rules the consumer's CLAUDE.md does not. A failed load emits a breadcrumb naming the file and the failure kind, and you compose without it.Output:
[[INTERNAL_DOC_LOCATION]] to fix inaccuraciesStructure your output using markdown formatting with proper headers, bullet points, and code blocks.
Organize findings by severity and category:
For each issue provide:
Include summary statistics at the end (e.g., "Found 3 critical issues, 5 missing docs, 2 improvements")
Make output scannable using bullet points, numbered lists, and clear headings.
⚠️ Clear the Bootstrap boundary above first, then ALWAYS perform all five steps. Step 5 (verify-against-code) is non-negotiable — skipping it is the single most common cause of inaccurate doc updates.
Step 1: Run Git Diff Resolve the configured base branch by printing it, then substituting the printed value as a literal:
"${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}"/../../scripts/config-get.sh .base_branch main
Read the printed base branch from the tool result. On a non-zero exit or an empty value, fall back to main and log docs-sync-internal: could not read .base_branch — falling back to main. Substitute the printed value as a LITERAL into the diff command below (e.g. git diff origin/<base>...HEAD) — never through a shell-variable capture (VAR=$(...)) and never as an origin/$VAR expansion.
Run git diff origin/<base>...HEAD (THREE dots, <base> the printed literal, default main) to get ONLY changes from this branch, excluding merged commits. Focus on code files: .cs, .js, .ts, .tsx, .py, .csproj, .sln, Dockerfile, .config, etc.
Step 2: Read the Index, Then Analyze Each Code File
Read [[INTERNAL_DOC_LOCATION]]/index.md first (creating it per the Structure Contract if absent). Then, for EACH code file that changed:
index.md, confirming with a content search that no other page also states the factStep 3: Provide Analysis Output Create markdown-formatted report listing:
index.mdStep 4: Make Actual File Edits ⚠️ MANDATORY - do not skip this step
Edit files in [[INTERNAL_DOC_LOCATION]], routing every write through the Structure Contract:
index.md in the same passStep 5: Verify Every Factual Claim Against the Codebase ⚠️ MANDATORY — do not skip. Write docs from the code, never from the issue body, the plan, or your memory of what the change "should" do.
A doc update copied from issue or plan prose inherits every contradiction between that prose and the shipped code, and ships those errors into the docs. Before you finish, re-open the actual source and confirm each concrete assertion in the lines you added or edited:
grep/open the file and confirm the symbol exists, is spelled exactly as written, and lives where the doc says. If the doc claims "X is handled in path/to/Foo", open that file and find it before you write the sentence.grep/ls/find you actually ran, and propagate the corrected number to every place in the doc that repeats it (summary tables, ordered steps, prose). A stale count in one section while another is fixed is a classic half-edit.lines 130–149, :765-771) or exact occurrence counts that have no structural meaning; they rot on the next unrelated edit. Reference the symbol name, the function, or the section instead. If a number genuinely matters (a table count, an enum size), keep it but treat it as something Step 5 must re-verify on every future pass.On each page whose claims this step verified, set or refresh a freshness marker near the top: <!-- verified-against: <short commit sha> <YYYY-MM-DD> --> — it tells the next reader (and the next run of this skill) when the page was last checked against the tree, which "recently edited" alone cannot.
In the Step 3 analysis output, add a short "Claims verified" list: each non-trivial factual assertion you added/changed, and the command or file read that confirmed it. An assertion you could not verify must be removed or rewritten until you can — never shipped on faith.
Before completing, verify you have:
bootstrap-required outcome line and wrote nothinggit diff against the configured base branch (Step 1) to see ONLY this branch's changes[[INTERNAL_DOC_LOCATION]]/index.md first and routed every write through it (creating it if absent)verified-against marker on verified pagesindex.md and glossary.md in the same pass where the Structure Contract required it[[INTERNAL_DOC_LOCATION]] boundaries⚠️ If ANY behavior change is not reflected on its owning page, the task is incomplete.
Accountability Check:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
21 skills in this plugin
/challengeUse when asked to challenge, refute, push back on, or stress-test an idea, feature request, bug report, GitHub issue, approach, or PR, including one already review-approved. Returns an evidence-backed recommendation without implementing it./create-issuePermanent alias for /prflow:spec, which runs the same issue-drafting pipeline; prefer /prflow:spec. Use when a rough user story, bug report, feature idea, piece of feedback, or an implementation plan should be recorded as a GitHub issue rather than built right now. Kept so existing /prflow:create-issue and /devflow:create-issue invocations keep working./docsUse when documentation generally needs to catch up with a branch before pushing or merging, covering internal developer docs, external customer-facing docs, and release notes together — "update the docs", "do a docs pass before I merge", "make sure everything's documented". Prefer this when no single documentation target is named; use the narrower prflow:docs-sync-internal, prflow:docs-sync-external, or prflow:docs-release-notes when the user names one./docs-bootstrap-externalUse when customer-facing documentation must be created from scratch or comprehensively rebuilt — "we have no public docs", "set up user-facing documentation", "build external docs from our internal ones", "do a full docs refresh" — or when large portions of the internal docs still have no external counterpart. For incremental alignment of external docs that already exist, use prflow:docs-sync-external./docs-bootstrap-internalUse when a codebase has no structured developer documentation yet and needs it built from scratch — "we have no docs at all", "set up internal docs for this repo", "the docs directory is a mess, start over", "create developer documentation for this codebase" — including an empty or disorganized docs directory or a ground-up reorganization. For incremental updates to docs that already exist, use prflow:docs-sync-internal./docs-release-notesUse when a change needs a user-visible release-note, changelog, or changeset entry — "add a release note", "add a changeset for this", "what goes in the changelog?", "write up what shipped", "note this for the next release" — or when finalizing a branch whose customer-visible features, bug fixes, or UI changes should be announced before merge. Narrower than prflow:docs, which sweeps internal docs, external docs, and release notes together.npx claudepluginhub the01geek/prflow --plugin prflowOther plugins' skills for the same job