Docgen
Use when generating documentation, writing API docs, documenting modules or components, creating README content, building reference guides, or documenting many files with explicit coverage tracking.From its SKILL.md
npx -y skills add cofin/flow --skill docgenAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.8 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
Docgen
Systematic documentation generation with progress tracking and completeness guarantees. Analyzes code file-by-file, ensures nothing is skipped, and produces structured output per component.
Docgen complements flow-docs — it provides the systematic analysis engine for flow-docs' five-phase workflow. It can also be used standalone for ad-hoc documentation tasks when you need structured, complete documentation without a full flow-docs run.
The core guarantee: every file in scope gets documented. Progress is tracked explicitly ([3/12 files documented]) so you always know what's been covered and what remains.
Workflow
1. Scope the Target
Identify what needs documenting: single file, directory, module, or entire package. Be specific — "the auth module" means every file in that directory.
2. Build the File Manifest
Enumerate every file to document with its path. This is the completeness checklist — no file gets dropped silently. Count them: this is your denominator.
3. Analyze Each File
For each file in the manifest:
- Read the file fully — do not guess from file names
- Extract: purpose, public interface, dependencies, key patterns
- Document using the component template in
references/component-template.md:- Purpose — one sentence
- Public Interface — every export with signature and description
- Dependencies — imports and external services
- Key Patterns — design patterns, invariants, async considerations
- Usage Example — minimal, copy-pasteable
- Notes — edge cases and gotchas (only if they exist)
- Scale the template to complexity: a 10-line utility needs Purpose + Interface + Example; a complex service gets the full template
- Mark the file as documented. Report progress:
[3/12 files documented]
4. Cross-Reference
After all files are documented:
- Verify imports and dependencies between documented components
- Note common patterns across the module
- Flag circular dependencies or unclear boundaries
5. Synthesize
Produce the final documentation:
- Module overview (what it does, how components relate)
- Per-component documentation (from step 3)
- Dependency map (what depends on what)
Guardrails
- Don't guess from file names — read the actual code. File and function names lie. Read the implementation before writing any documentation claim.
- Don't skip small files — they often contain critical glue (re-exports, config, type definitions).
- Don't document in batches from memory — read each file fresh. Memory drifts.
- Don't declare completeness without checking the manifest — every file must be checked off.
- Don't restate code without explaining WHY —
// increments counter by 1oncounter++adds no value. Explain the reason behind the logic.
Validation Checkpoint
Before declaring documentation complete, verify:
- Every file in the manifest was documented (none skipped)
- Progress was tracked explicitly throughout
- Cross-references between components are accurate
- Documentation was generated from code reading, not memory
Example
Documenting src/auth/:
Manifest: 4 files — middleware.ts, session.ts, guards.ts, index.ts
[1/4] middleware.ts — Authentication middleware. Extracts JWT from Authorization header, validates with session.verify(), attaches user to request context. Exports: authMiddleware().
[2/4] session.ts — Session management. Creates/verifies JWTs using jsonwebtoken. Token lifetime: 24h. Exports: createSession(), verify().
[3/4] guards.ts — Route guards. requireAdmin() checks user.role === 'admin'. requireAuth() checks session exists. Both use authMiddleware output.
[4/4] index.ts — Re-exports: authMiddleware, requireAdmin, requireAuth, createSession.
Cross-reference: guards.ts depends on middleware.ts output. middleware.ts depends on session.ts. index.ts is the public API surface.
Usage Patterns
- "Document the authentication module"
- "Generate API reference docs for this package"
- "I need complete docs for everything in src/services/"
- "What does this module do and how do I use it?" (single-component mode)
References
- Docgen Strategy — Five-step documentation workflow: scope target, build file manifest, analyze each file, cross-reference, synthesize
- Component Template — Per-component documentation structure with scaling guidance for utilities, services, and config files
What ships with it: 3 files
3.9 KB alongside SKILL.md
agents/
- openai.yaml150 B
references/
- component-template.md1.6 KB
- docgen-strategy.md2.1 KB
Gives 0 of the 12 instructions most docs writing skills give in ~1.0k tokens
Counted across 1,951 of the 3,904 authors here whose files we hold, read 2026-09-06
- Use third-person for skill descriptionsin 54 of 1951, across 35 files
- Start descriptions with Use whenin 43 of 1951, across 29 files
- Run baseline scenarios before writing any skillin 40 of 1951, across 26 files
- Use active voicein 40 of 1951, across 36 files
- Map file responsibilities before defining tasksin 36 of 1951, across 29 files
- Use checkbox syntax for tracking stepsin 35 of 1951, across 27 files
- Ask one question at a timein 35 of 1951
- Offer execution options after saving the planin 33 of 1951, across 24 files
- Include complete code in every stepin 33 of 1951, across 27 files
- Design units with clear boundaries and interfacesin 31 of 1951, across 23 files
- Announce the skill usage at the startin 30 of 1951
- Verify agent compliance after adding the skillin 29 of 1951, across 17 files
Said here and by no other author read
- enumerate every file in a manifest
- report progress using a counter
- verify imports and dependencies between components
- synthesize a module overview and dependency map
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.