/prflow:docs-bootstrap-internalfrom PRFlow
Bootstraps internal developer documentation from scratch for codebases with no docs, empty docs directories, or disorganized docs that need a ground-up reorganization.
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-bootstrap-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-bootstrap-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 Bootstrap Agent for code repositories. Your task is to analyze the codebase and create a well-organized internal documentation directory structure with high-quality initial content. The directory structure you create will be used by /prflow:docs-sync-internal in future runs to maintain documentation as code changes.
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.
Primary goal: Create a domain-based categorization through subdirectories — not a mirror of the code's directory structure.
Organize by business domain and feature area, not by technical layer.
Wrong (mirrors code structure):
[[INTERNAL_DOC_LOCATION]]backend/
[[INTERNAL_DOC_LOCATION]]frontend/
[[INTERNAL_DOC_LOCATION]]api/
[[INTERNAL_DOC_LOCATION]]cron/
[[INTERNAL_DOC_LOCATION]]plugins/
Right (domain-based):
[[INTERNAL_DOC_LOCATION]]orders/
[[INTERNAL_DOC_LOCATION]]customers/
[[INTERNAL_DOC_LOCATION]]authentication/
[[INTERNAL_DOC_LOCATION]]integrations/
[[INTERNAL_DOC_LOCATION]]setup/
Why: Developers look for docs about the feature they're working on ("how do orders work?"), not the code layer ("what's in the backend directory?"), so a feature's documentation belongs in one place even when it spans layers.
Use one level of subdirectories under [[INTERNAL_DOC_LOCATION]]. No nesting.
Wrong: [[INTERNAL_DOC_LOCATION]]integrations/payments/stripe/
Right: [[INTERNAL_DOC_LOCATION]]integrations/ (with files like payment-stripe.md)
Why: Flat structures are easier to navigate, easier for /prflow:docs-sync-internal to manage, and prevent category proliferation.
Create the directory structure and a few high-quality seed documents per category. Do not create 50 stub files with placeholder content. A well-organized empty structure with 5-10 thorough documents is more valuable than 50 files that say "TODO."
Establish what documentation already exists, using the runner's file tools (never a shell find, whose absence or error would silently read as "no docs"):
[[INTERNAL_DOC_LOCATION]]/**/* to enumerate every existing file under the documentation location..gitkeep files, means creation mode.If documentation already exists, this is a reorganization task, not a creation task. Preserve existing content — move files into the new structure rather than overwriting them — under three obligations:
git grep --untracked -nP -e '<pattern>' -- :/) for its exact path, escaping its regex metacharacters; single-quote each pattern, never double-quote it, writing a ' it needs as '\'' after that escaping; a refused search, or one exiting above 1, proves nothing, so treat the path as pinned. A path that code, tests, or tooling reference is load-bearing: do not move or rename it — report the pin in your completion report instead, because a silent rename breaks the referencing tool with no doc-side signal.Survey the codebase to identify feature domains. Use these signals — they are layer-agnostic on purpose, so a library, CLI tool, or plugin repository yields sensible domains, not only a web application:
Read the project's CLAUDE.md and README (or equivalent) with the file-read tool; skip whichever is absent — their absence is normal and blocks nothing.
Enumerate the top-level structure:
# Top-level structure
# An unquoted glob must survive zsh's default `nomatch`, which would otherwise refuse to run
# the command at all — a SKIPPED enumeration that reads like an empty one. The guard turns
# nomatch off under native zsh and is a no-op elsewhere ($ZSH_VERSION unset -> `&&`
# short-circuits, `|| :` stays rc-0). With nomatch off an unmatched glob leaves $1 the
# literal pattern, so `[ -e "$1" ]` decides match-vs-no-match structurally: no `2>/dev/null`
# to hide a real error, and exactly one of the three arms can print. An empty directory and a
# PERMISSION-unlistable one both leave the glob unmatched, so the second arm separates those
# two -- it tests mode bits only, so a failure with another cause (dead mount, EIO) still
# reaches the empty arm. Listing needs BOTH the read bit (to name the entries) and the search
# bit (to stat them for the trailing `/`), so that arm tests both. All three arms print on
# stdout so a caller capturing stdout can still tell "nothing here" from "could not look".
# Unhandled: bash's `failglob`,
# where an unmatched pattern aborts `set --` before it runs.
[ -n "${ZSH_VERSION:-}" ] && setopt nonomatch || :
set -- */
if [ -e "$1" ]; then
printf '%s\n' "$@"
elif [ ! -r . ] || [ ! -x . ]; then
echo "(current directory is not listable - listing NOT established)"
else
echo "(no subdirectories)"
fi
Then use the Glob tool (not a shell command) to enumerate the remaining signals. Run one Glob call per pattern (or brace-expand into a single pattern, e.g. **/*.{sql,schema}) and ignore VCS, dependency, and build directories (e.g. node_modules, vendor, build output) in the results:
**/*.{sql,schema} (or **/*.sql and **/*.schema as separate calls).**/pages/**, **/routes/**, and **/controllers/**, each a separate call.**/test/**, **/tests/**, and **/*_test.* / **/*.test.*, each a separate call.**/*.config.*, and **/*.{yml,yaml} (or **/*.yml and **/*.yaml as separate calls).While analyzing, keep a running list of repo-private vocabulary — coined terms, internal component names, domain jargon a newcomer would have to ask about — for the glossary seed in Step 5.
Based on your analysis, create a categorization plan. Categories should be:
Record a one-line rationale for each category (why it exists, derived from which signal) — Step 6 writes it into the index and Step 8 reports it, so decide it now while the evidence is in front of you.
Standard categories that apply to most projects (use if relevant):
| Category | When to include |
|---|---|
architecture/ | Always — system overview, design patterns, key abstractions |
setup/ | Always — development environment, build steps, configuration |
database/ | If the project has a database |
api/ | If the project exposes APIs |
authentication/ | If the project has auth/permissions |
integrations/ | If the project connects to external services |
Domain-specific categories (derived from your codebase analysis):
For an e-commerce platform, the categories might be orders/, customers/, products/, shipping/. For a CMS, these might be content/, publishing/, media/. Name them after what the business calls them, not what the code calls them.
For each category, create the empty file [[INTERNAL_DOC_LOCATION]]/<category>/.gitkeep with the file-write tool — one write per category, which both creates the directory and keeps it committable while empty. Do not rely on shell brace expansion or find -exec for this: brace expansion is unavailable in POSIX sh (a literal {...} directory gets created), and {} inside a larger -exec token is POSIX-unspecified, so either form silently misbuilds the tree on some hosts.
Leave the .gitkeep files in place, including in directories that later gain documents — nothing in this skill removes them.
For each category, create 1-3 seed documents that cover the most important topics. Prioritize:
Two seeds are mandatory, because they are the highest-value artifacts for an agent reader:
architecture/ seed includes a source-tree map — the repository's top-level directories with one line each saying what lives there. "Where things live" is the single question every fresh reader asks first, and nothing else in the tree answers it.[[INTERNAL_DOC_LOCATION]]/glossary.md with the repo-private vocabulary collected in Step 2 — one definition line per term. /prflow:docs-sync-internal grows this file as new terms appear, so it must exist from day one.Seed document quality standards:
src/server.py, never append line numbers (line numbers change as code evolves)[[INTERNAL_DOC_LOCATION]] if any docs already exist"${CLAUDE_SKILL_DIR:-<absolute skill base directory this runner reports in context>}"/../../lib/writing-standard.md and follow it when composing the seed documentation. A failed load emits a breadcrumb naming the file and the failure kind, and you compose without it.Create [[INTERNAL_DOC_LOCATION]]/index.md, the routing map future readers and /prflow:docs-sync-internal runs read FIRST: one line per document — relative path, what the page covers, who should read it — grouped by category. Without this file, a future maintenance run cannot route a write to the owning page and the map falls behind the corpus from the first change. List every seed document you wrote; /prflow:docs-sync-internal maintains the index from then on, so it must start complete.
The index also records two things only this run knows:
(deliberately thin) — so a later maintenance run can tell an intentionally sparse category from one whose docs are missing, instead of treating every thin category as a gap to fill.⚠️ MANDATORY — do not skip. Write docs from the code, never from your survey notes or your memory of what the codebase "should" contain. This run writes the largest volume of fresh prose the documentation tree will ever receive in one pass, all of it from a first read of an unfamiliar codebase — exactly the conditions under which plausible-but-wrong claims ship.
Before you finish, re-open the actual source and confirm each concrete assertion in every seed document:
grep/open the file and confirm the symbol exists, is spelled exactly as written, and lives where the doc says.grep/ls/Glob you actually ran, and propagate a corrected number to every place the doc repeats it.In the Step 8 report, include a short "Claims verified" list: each non-trivial factual assertion, 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.
End with a structured report so the caller (and the next maintenance run) can see what was decided, not only what was written:
index.md.Do not commit the changes. Leave committing to the caller.
| Mistake | Why it's wrong | What to do instead |
|---|---|---|
| Mirror the code directory tree | Developers look for features, not layers | Group by business domain |
| Create nested subdirectories | Hard to navigate, hard for sync skill to manage | Keep it flat — one level deep |
| Create 50 stub files | Empty files add noise, not value | Create structure + 5-10 quality seeds |
| Ignore existing docs | Overwrites previous work | Audit first, reorganize existing content |
| Name categories after frameworks | react/, php/, mysql/ are layers, not domains | Name after what the business calls them |
Create a catch-all misc/ or guides/ | Becomes a junk drawer | Every doc should fit a specific category |
Before completing, verify:
[[INTERNAL_DOC_LOCATION]] with the Glob tool (an unestablished enumeration was reported, never treated as empty)architecture/ seed includes the source-tree map, and glossary.md is seeded with the repo-private vocabulary[[INTERNAL_DOC_LOCATION]]/index.md listing every seed document (path — what it covers — who reads it), with per-category rationale and (deliberately thin) markers[[INTERNAL_DOC_LOCATION]] boundariesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub the01geek/prflow --plugin prflow21 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-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./docs-sync-externalUse when customer-facing or public documentation needs to catch up with internal docs or shipped changes — "our public docs still mention the old flag", "sync the user guide", "update the customer docs", "is anything in the external docs outdated or leaking internal detail?", "update the docs site". Narrower than prflow:docs; use prflow:docs-bootstrap-external when external docs do not exist yet.Other plugins' skills for the same job