codebase-doc-writer
Purpose
Analyze the repository and existing /docs content to generate bootstrap architecture documentation and durable AI-readable maintenance context.
Default Behavior
On first run, generate bootstrap docs and indexes only. Do not generate deep per-module or per-feature documentation unless explicitly requested or required for a change task.
Required Inputs
- Repository source tree
- Existing
/docscontent if present - Root README and configuration files if present
Analysis Order
- Inspect repo structure
- Inspect existing
/docs - Identify entrypoints and startup paths
- Identify major components and boundaries
- Identify major runtime flow categories
- Identify unknowns and confidence limits
- Generate bootstrap docs and indexes
Reference: analysis-rules.md
Output Files
docs/system-overview.mddocs/architecture/components.mddocs/architecture/runtime-flows.mddocs/modules/README.mddocs/features/README.mddocs/ai-context.mddocs/known-gaps.md
Reference: doc-templates.md, output-policy.md
Documentation Rules
- Separate observed facts from inference
- Prefer file-backed explanations
- Avoid pretending uncertain flows are complete
- Re-use existing
/docswhere accurate - Note contradictions between code and docs
- Write outputs for both humans and future AI-assisted changes
- If a section references workflow, lifecycle, request path, or process steps, include a Mermaid system design diagram for that section when possible
- Keep Mermaid diagrams code-backed; do not invent nodes or edges that are not supported by the repository
- If a workflow diagram cannot be produced with confidence, explicitly state why and mark the missing parts as Unknown
First-Run Bootstrap Policy
When no prior generated architecture docs exist, create only the bootstrap set:
docs/system-overview.mddocs/architecture/components.mddocs/architecture/runtime-flows.mddocs/modules/README.mddocs/features/README.mddocs/ai-context.mddocs/known-gaps.md
The runtime-flows.md file should be an index of major flow categories, not a full end-to-end trace of every feature.
Include at least one Mermaid diagram in runtime-flows.md representing the top-level flow categories and entrypoints when possible.
The modules and features README files should be indexes and scoping guides, not full coverage documents.
Include Mermaid diagrams in bootstrap docs where possible, especially in system-overview.md, architecture/components.md, and architecture/runtime-flows.md.
Scoped Deep-Documentation Policy
When the user asks about a specific module, subsystem, or feature:
- Read bootstrap docs first
- Inspect the relevant code paths
- Generate or update only the relevant scoped document
- Refresh
ai-context.mdonly if project-wide understanding changes - Append unresolved questions to
known-gaps.md
Examples:
- Billing module →
docs/modules/billing.md - Login flow →
docs/features/login.md - Order creation →
docs/features/order-creation.md
Update Rules
When a later request targets a specific module or feature:
- Read the bootstrap docs first
- Trace only the requested scope
- Create or update the specific module or feature doc
- Update
ai-context.mdif architectural understanding changed - Append unresolved issues to
known-gaps.md
Existing Docs Policy
- Inspect existing
/docs - Preserve useful material
- Merge or refine when accurate
- Do not overwrite good existing docs just to match a template
- Record stale or contradictory sections in
known-gaps.md
Confidence and Uncertainty
Label all findings as one of:
- Observed — directly confirmed from code
- Inferred — derived from structure or patterns
- Unknown — not yet confirmed
In generated docs, uncertainty should appear naturally:
- "Observed entrypoint:
src/index.js" - "Likely service boundary inferred from router and component wiring"
- "Background worker initialization is not yet confirmed"
Helper Scripts
- repo_inventory.py — scan repo structure for a structured starting inventory
- bootstrap_doc_plan.py — generate a doc plan from inventory and existing docs
More from essentialsoft/agentskills
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
1bio-ai-product-manager
help brainstorm ai chatbot and ai product ideas, analyze biology-related user needs, and draft product requirements documents, user stories, acceptance criteria, and api-aware feature requirements. use when the user wants product strategy help, prd drafting, requirement generation, roadmap thinking, or product discovery for applications and api services in biology or life science contexts.
1