document-code skill
✓ VerifiedDocuments code entry points by performing structured analysis, dependency mapping, and generating markdown and HTML knowledge files.
- GitHub stars
- 1,663
- Files
- 2
- Last commit
- Nov 9, 2026
- License
- Apache-2.0
- Allowed tools
- —
What does the document-code skill do?
document-code documents code entry points by performing structured analysis, dependency mapping, and generating markdown and HTML knowledge files.
Summary generated from the skill's SKILL.md.
About the document-code skill
Mapping code entry points and building structured knowledge files is what this skill enables for developers. It automates the process of analyzing files, folders, functions, or APIs to create a clear understanding of how code operates. An agent should load this tool when a user needs to document a module, understand complex execution flows, or map out dependencies within a codebase.
The workflow begins by validating the entry point and searching for existing knowledge using the npx ai-devkit@latest memory search command. It then performs a dependency analysis up to a depth of three, categorizing imports, function calls, and services while avoiding external or generated code. The process produces a markdown file located at docs/ai/implementation/knowledge-{name}.md which serves as the primary source of truth.
Users can also opt to generate a companion HTML artifact for easier scanning. This single-file HTML output uses a card-based grid layout and includes mermaid diagrams via CDN to visualize relationships. The tool ensures that documentation includes implementation details, error handling, security considerations, and potential risks discovered during the analysis.
What an agent can do with it
- 1Document a specific functionAsk the agent to analyze a single function to capture its signature, parameters, and return values.
- 2Map module dependenciesRequest a dependency view for a folder to see how different modules interact up to three levels deep.
- 3Create visual code diagramsGenerate mermaid diagrams to clarify complex execution flows or relationships within the code.
- 4Generate scannable HTML documentationRequest an HTML version of the documentation to view the code structure in a card-based grid layout.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the document-code skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the document-code skill in Claude Code
~/.claude/skills/document-code/SKILL.md
$ npx degit codeaholicguy/ai-devkit/skills/document-code ~/.claude/skills/document-codeInstall the document-code skill in Claude Code (project)
.claude/skills/document-code/SKILL.md
$ npx degit codeaholicguy/ai-devkit/skills/document-code .claude/skills/document-codeInstall the document-code skill in Codex
~/.agents/skills/document-code/SKILL.md
$ npx degit codeaholicguy/ai-devkit/skills/document-code ~/.agents/skills/document-codeInstall the document-code skill in Gemini CLI
~/.gemini/skills/document-code/SKILL.md
$ npx degit codeaholicguy/ai-devkit/skills/document-code ~/.gemini/skills/document-codeInstall the document-code skill in Claude.ai
npx degit codeaholicguy/ai-devkit/skills/document-code document-code && zip -r document-code.zip document-code # claude.ai → Customize → Skills → + → Create skill → Upload a skill → document-code.zip
Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachablecodeaholicguy/ai-devkit/skills/document-code is public and reachablegithub.com/codeaholicguy/ai-devkit/tree/HEAD/skills/document ↗Pass
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-09github.com/codeaholicguy/ai-devkit/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/codeaholicguy/ai-devkit/blob/HEAD/skills/document ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/codeaholicguy/ai-devkit/blob/HEAD/skills/document ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 87 linesgithub.com/codeaholicguy/ai-devkit/blob/HEAD/skills/document ↗Pass
SKILL.md
View on GitHubCode Documentation Assistant
Build structured understanding of code entry points with an analysis-first workflow.
Hard Rule
- Do not create documentation until the entry point is validated and analysis is complete.
Workflow
- Gather & Validate
- Confirm entry point (file, folder, function, API), purpose, and desired depth.
- Verify it exists; resolve ambiguity or suggest alternatives if not found.
- Search for existing knowledge before analyzing:
npx ai-devkit@latest memory search --query "<entry point name or purpose>"
- Collect Source Context
- Summarize purpose, exports, key patterns.
- Folders: list structure, highlight key modules.
- Functions/APIs: capture signature, parameters, return values, error handling.
- Analyze Dependencies
- Build dependency view up to depth 3, track visited nodes to avoid loops.
- Categorize: imports, function calls, services, external packages.
- Exclude external systems or generated code.
- Synthesize
- Overview (purpose, language, high-level behavior).
- Core logic, execution flow, patterns.
- Error handling, performance, security considerations.
- Improvements or risks discovered during analysis.
- Create Documentation
- Normalize name to kebab-case (
calculateTotalPrice→calculate-total-price). - Create
docs/ai/implementation/knowledge-{name}.mdusing the Output Template — this is the source of truth. - Include mermaid diagrams when they clarify flows or relationships.
- Offer HTML Artifact
- After the markdown is written, ask the user once: "Also generate an HTML artifact for easier scanning? (y/N)".
- If yes, generate sibling
docs/ai/implementation/knowledge-{name}.htmlper the HTML Artifact spec. Regenerate from the markdown on subsequent runs; never hand-edit. - If no or no response, stop here — markdown alone is a complete result.
HTML Artifact
Generated only when the user opts in at step 6. A self-contained HTML file optimized for scanning, not reference reading. Complements the markdown — does not replace it.
Constraints:
- Single file. Inline CSS. No build step. Only external asset allowed is mermaid via CDN (
https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js). - Card-based grid layout, not a long scroll. The reader should capture structure at a glance.
- Responsive down to laptop width. Print-friendly.
- No interactivity beyond collapsible deep-dives and mermaid pan/zoom.
Section mapping (from the Output Template):
- Overview → hero card: title, one-line purpose, language/type badges.
- Implementation Details → grid of sectioned cards with short bullets, not prose.
- Dependencies → graph card (mermaid) plus a categorized list (imports, calls, services, external).
- Visual Diagrams → full-width rendered mermaid blocks.
- Additional Insights → callout boxes, color-coded by kind (info, warning, risk).
- Next Steps → checklist card.
- Metadata → compact footer (date, depth, files touched).
Red Flags and Rationalizations
| Rationalization | Why It's Wrong | Do Instead |
|---|---|---|
| "I already understand this code" | Understanding ≠ documented understanding | Write it down, then verify |
| "The code is self-documenting" | Future readers lack your current context | Capture the why, not just the what |
| "Dependencies are obvious" | Implicit dependencies cause surprises | Map them explicitly to depth 3 |
Validation
- Documentation covers all Output Template sections.
- If an HTML artifact was generated, it opens standalone in a browser, renders mermaid, and reflects the markdown content (no drift).
- Summarize key insights, open questions, and related areas for deeper dives.
- Confirm file path(s) and remind to commit.
Output Template
- Overview
- Implementation Details
- Dependencies
- Visual Diagrams (mermaid)
- Additional Insights
- Metadata (date, depth, files touched)
- Next Steps
Files in this skill
2document-code skill questions
How do I install the document-code skill in Claude Code?
Run npx degit codeaholicguy/ai-devkit/skills/document-code ~/.claude/skills/document-code. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the document-code skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What types of code entry points can be documented?
The tool can document modules, files, folders, functions, or APIs.
Does the tool provide visual diagrams?
Yes, it includes mermaid diagrams to clarify flows or relationships within the documentation.
Can I get an HTML version of the documentation?
Yes, after the markdown is written, you can opt-in to generate a self-contained HTML artifact optimized for scanning.