octocode-documentation-writer
This skill should be used when the user asks to "generate documentation", "document this project", "create docs", "write documentation", "update documentation", "document all APIs", "generate onboarding docs", "create developer docs", or needs comprehensive codebase documentation. Orchestrates parallel AI agents to analyze code and produce documentation files.
What this skill does
# Repository Documentation Generator
**Production-ready 6-phase pipeline with intelligent orchestration, research-first validation, and conflict-free file ownership.**
<what>
This command orchestrates specialized AI agents in 6 phases to analyze your code repository and generate comprehensive documentation:
</what>
## Runtime Compatibility
- Model labels such as `Opus`, `Sonnet`, and `Haiku` are role hints, not hard requirements. Map them to the strongest available host models for the job.
- `Task` means the host runtime's parallel subagent mechanism. **IF** the host cannot run true parallel subagents โ **THEN** execute the same work sequentially and preserve exclusive file ownership.
- Pseudocode blocks in this document are behavioral templates. Adapt helper names, file APIs, and retry helpers to the active runtime instead of treating them as literal APIs.
- Session artifacts live under `.octocode/documentation/{session-name}/`. Short names like `analysis.json` below refer to files inside that session directory unless stated otherwise.
<steps>
<phase_1>
**Discovery+Analysis** (Phase 1)
Agent Role: High-capability reasoning model
Parallel: 4 parallel agents
What: Analyze language, architecture, flows, and APIs
Input: Repository path
Output: `analysis.json`
</phase_1>
<phase_2>
**Engineer Questions** (Phase 2)
Agent Role: High-capability reasoning model
What: Generates comprehensive questions based on the analysis
Input: `analysis.json`
Output: `questions.json`
</phase_2>
<phase_3>
**Research Agent** (Phase 3) ๐
Agent Role: Fast research/execution model
Parallel: Dynamic (based on question volume)
What: Deep-dive code forensics to ANSWER the questions with evidence
Input: `analysis.json` + `questions.json`
Output: `research.json`
</phase_3>
<phase_4>
**Orchestrator** (Phase 4)
Agent Role: High-capability reasoning model
What: Groups questions by file target and assigns exclusive file ownership to writers
Input: `questions.json` + `research.json`
Output: `work-assignments.json` (file-based assignments for parallel writers)
</phase_4>
<phase_5>
**Documentation Writers** (Phase 5)
Agent Role: Fast writing model
Parallel: 1-8 parallel agents (dynamic based on workload)
What: Synthesize research and write comprehensive documentation with exclusive file ownership
Input: `analysis.json` + `questions.json` + `research.json` + `work-assignments.json`
Output: `documentation/*.md` (16 core docs, 5 required, plus writer-owned supplementary files; `QA-SUMMARY.md` is generated in Phase 6)
</phase_5>
<phase_6>
**QA Validator** (Phase 6)
Agent Role: Fast validation model
What: Validates documentation quality using LSP-powered verification
Input: `documentation/*.md` + `analysis.json` + `questions.json` + `research.json`
Output: `qa-results.json` + `QA-SUMMARY.md`
</phase_6>
</steps>
<subagents>
Use the host's subagent mechanism to explore code with MCP tools (`localSearchCode`, `lspGotoDefinition`, `lspCallHierarchy`, `lspFindReferences`). Pick model tiers by capability, not by hard-coded model names.
</subagents>
<mcp_discovery>
Before starting, detect available research tools.
**Check**: Is `octocode-mcp` available as an MCP server?
Look for Octocode MCP tools (e.g., `localSearchCode`, `lspGotoDefinition`, `githubSearchCode`, `packageSearch`).
**If Octocode MCP exists but local tools return no results**:
> Suggest: "For local codebase research, add `ENABLE_LOCAL=true` to your Octocode MCP config."
**If Octocode MCP is not installed**:
> Suggest: "Install Octocode MCP for deeper research:
> ```json
> {
> "mcpServers": {
> "octocode": {
> "command": "npx",
> "args": ["-y", "octocode-mcp"],
> "env": {"ENABLE_LOCAL": "true"}
> }
> }
> }
> ```
> Then restart your editor."
Proceed with whatever tools are available โ do not block on setup.
</mcp_discovery>
**Documentation Flow:** analysis.json โ questions.json โ **research.json** โ work-assignments.json โ documentation (conflict-free!)
---
## โ ๏ธ CRITICAL: Parallel Agent Execution
<parallel_execution_critical importance="maximum">
**STOP. READ THIS TWICE.**
### 1. THE RULE
**Use the strongest parallel mechanism the host supports.** Prefer single-message fan-out when the runtime supports concurrent `Task` calls.
### 2. FORBIDDEN BEHAVIOR
**FORBIDDEN:** Claiming work ran in parallel when the host actually executed it sequentially.
**REASON:** False concurrency claims hide runtime limits and make failures harder to reason about.
### 3. REQUIRED FALLBACK
**IF** the runtime cannot perform true parallel fan-out:
- Run the same worker scopes sequentially
- Preserve exclusive file ownership
- Keep the same phase boundaries and aggregation steps
- Tell the user that execution is in sequential fallback mode
### 4. REQUIRED CONFIRMATION
Before launching any parallel phase (1, 3, 5), you **MUST** verify:
- [ ] The host can run the chosen fan-out pattern
- [ ] No dependencies exist between these parallel agents
- [ ] Each agent has exclusive scope (no file conflicts)
<correct_pattern title="โ
CORRECT: Single response launches all agents concurrently">
```
// In ONE assistant message, include ALL Task tool invocations when the host supports it:
Task(description="Discovery 1A-language", subagent_type="general-purpose", prompt="...", model="opus")
Task(description="Discovery 1B-components", subagent_type="general-purpose", prompt="...", model="opus")
Task(description="Discovery 1C-dependencies", subagent_type="general-purpose", prompt="...", model="opus")
Task(description="Discovery 1D-flows", subagent_type="general-purpose", prompt="...", model="opus")
// โ All 4 execute SIMULTANEOUSLY
```
</correct_pattern>
<wrong_pattern title="โ WRONG: Sequential calls lose parallelism">
```
// DON'T DO THIS when the host supports concurrency - each waits for previous to complete
Message 1: Task(description="Discovery 1A") โ wait for result
Message 2: Task(description="Discovery 1B") โ wait for result
Message 3: Task(description="Discovery 1C") โ wait for result
Message 4: Task(description="Discovery 1D") โ wait for result
// โ 4x slower! No parallelism achieved
```
</wrong_pattern>
</parallel_execution_critical>
---
## Execution Flow Diagram
```mermaid
flowchart TB
Start([/octocode-documentation-writer PATH]) --> Validate[Pre-Flight Validation]
Validate --> Init[Initialize Workspace]
Init --> P1[Phase 1: Discovery+Analysis]
subgraph P1_Parallel["๐ RUN IN PARALLEL (4 agents)"]
P1A[Agent 1A:<br/>Language & Manifests]
P1B[Agent 1B:<br/>Components]
P1C[Agent 1C:<br/>Dependencies]
P1D[Agent 1D:<br/>Flows & APIs]
end
P1 --> P1_Parallel
P1_Parallel --> P1Agg[Aggregation:<br/>Merge into analysis.json]
P1Agg --> P1Done[โ
analysis.json created]
P1Done -->|Reads analysis.json| P2[Phase 2: Engineer Questions<br/>Single High-Capability Agent]
P2 --> P2Done[โ
questions.json created]
P2Done -->|Reads questions.json| P3[Phase 3: Research ๐<br/>Parallel Research Agents]
subgraph P3_Parallel["๐ RUN IN PARALLEL"]
P3A[Researcher 1]
P3B[Researcher 2]
P3C[Researcher 3]
end
P3 --> P3_Parallel
P3_Parallel --> P3Agg[Aggregation:<br/>Merge into research.json]
P3Agg --> P3Done[โ
research.json created<br/>Evidence-backed answers]
P3Done -->|Reads questions + research| P4[Phase 4: Orchestrator<br/>Single High-Capability Agent]
P4 --> P4Group[Group questions<br/>by file target]
P4 --> P4Assign[Assign file ownership<br/>to writers]
P4Assign --> P4Done[โ
work-assignments.json]
P4Done --> P5[Phase 5: Documentation Writers]
P5 --> P5Input[๐ Input:<br/>work-assignments.json<br/>+ research.json]
P5Input --> P5Dist[Each writer gets<br/>exclusive file ownership]
subgraph P5_Parallel["๐ RUN IN PARALLEL (1-8 agents)"]
P5W1[Writer 1]
P5W2[Writer 2]
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.