Open
Conversation
Add a documentation plugin that analyzes codebases to produce a single CODEBASE_ANALYSIS.md with source-of-truth citations. Designed for legacy and AI-generated codebases where engineers need deep understanding to operate, debug, and extend the system. Key capabilities: - Outline-driven pipeline: file tree → outline → iterative analysis → assembly - Clickable citations: every finding links to source code via markdown links - Discrepancy detection: cross-references README/metadata vs actual code - Actionable failure modes: detection methods + recovery commands for oncall - Architecture diagrams: delegates to aws-architecture-diagram skill (deploy-on-aws plugin) for draw.io output; Mermaid fallback for flow diagrams and architecture overview when skill unavailable - Deep analysis: iterative deepening (scan → question → search → write) - Tool-agnostic: works on Claude Code, Cursor, Codex, and other tools - Large codebase support: tracked sequential analysis with resumable progress file; optional parallel workers when environment supports them Output sections: Architecture Overview, Code Analysis, Request Lifecycle, Domain Logic Deep-Dive, Startup & Initialization, Components, API Contracts, Data Models, Deployment, Configuration, Monitoring & Observability, Security, Local Development, Discrepancies, Failure Modes, Timeout/Dependency Chain, Runbook Hints, Business Context. Plugin structure: - One skill: document-service (auto-triggers on documentation requests) - Two MCP servers: awsknowledge (HTTP) and awsiac (stdio/uvx) - 8 reference files for progressive disclosure - Codex and Claude Code marketplace support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC: #79
Summary
Add
codebase-documentorplugin — deep codebase analysis that produces a singleCODEBASE_ANALYSIS.mdwith source-of-truth citations.This plugin addresses two growing problems identified in the RFC: tribal knowledge loss when engineers leave teams, and the documentation gap created by AI-assisted coding where thousands of lines are generated faster than teams can document them. Engineers inherit codebases where original authors are unavailable, design decisions exist only in someone's head, and AI-generated code works but nobody documented why it's structured that way. The gap between code production speed and documentation speed is widening.
The plugin produces structured, verifiable documentation — not one-time chat responses. Every finding links back to the specific file and line it was derived from, so readers can verify claims and identify stale documentation when code changes. It uses an iterative deepening approach (scan → question → search → write) rather than a single-pass skim, and is designed to run for extended time to produce deep analysis. The output goes significantly beyond what a naive "explain this code" prompt produces: it traces end-to-end request flows, detects discrepancies between documentation and actual code, documents failure modes with recovery commands for oncall engineers, and flags implicit knowledge (hardcoded values, magic numbers, undocumented assumptions) that would otherwise disappear when teams rotate.
While the plugin works with any codebase, it is optimized for AWS-deployed services. It parses CDK constructs, CloudFormation resources, and Terraform blocks as first-class application code — recognizing that in CDK, the infrastructure IS the application logic. It consults
awsknowledgeandawsiacMCP servers for AWS service enrichment and IaC validation, and integrates with theaws-architecture-diagramskill (deploy-on-aws plugin) to produce validated draw.io diagrams with official AWS4 icons. Failure modes include AWS-specific detection methods and recovery commands. The plugin is tool-agnostic and works on Claude Code, Cursor, Codex, and other coding assistants.What's included
Plugin infrastructure:
.claude-plugin/plugin.json) and MCP server config (.mcp.json).codex-plugin/plugin.json)Skill —
document-service:[file:line](./file#Lline)linksaws-architecture-diagramskill (deploy-on-aws plugin) for draw.io output; Mermaid fallback for flow diagrams and architecture overviewOutput sections: Architecture Overview, Code Analysis, Request Lifecycle, Domain Logic Deep-Dive, Startup & Initialization, Components, API Contracts, Data Models, Deployment, Configuration, Monitoring & Observability, Security, Local Development, Discrepancies, Failure Modes, Timeout/Dependency Chain, Runbook Hints, Business Context.
MCP servers:
awsknowledge(HTTP) — AWS service descriptions, architecture guidanceawsiac(stdio) — CDK/CloudFormation resource schema validationChanges
.claude-plugin/plugin.json): metadata, keywords, Apache-2.0 license.mcp.json): awsknowledge (HTTP) + awsiac (stdio/uvx)skills/document-service/SKILL.md): 6-step autonomous workflow with iterative deepening.claude-plugin/marketplace.jsonand.agents/plugins/marketplace.json.codex-plugin/plugin.jsonand.agents/plugins/marketplace.jsonplugins/codebase-documentorEvaluation
Tested blind against aws-samples/sample-deepseek-ocr-selfhost — a CDK TypeScript + Python project with 6 CDK stacks, ECS GPU inference, Lambda processing, and API Gateway. The README was removed before analysis to simulate a legacy handoff.
The plugin produced a 571-line
CODEBASE_ANALYSIS.mdwith a draw.io architecture diagram that:Sample output (analysis report + draw.io diagram + SVG render): https://gist.github.com/XinyuQu/2001dff63cc5c5ab12c2f0eb1ea2a78a
Test plan
[file:line](./file#Lline)formatmise run lint:manifests— all 5 schemas validmise run lint:cross-refs— 0 errors, 0 warningsgitleaks— no leaks foundbandit— 0 findingssemgrep— 0 findings (with repo exclusions)checkov— cleandprint check— cleanBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.