{"id":"2862fd0f-97de-44c3-9eb5-d3c11fa97222","shortId":"NkbHeg","kind":"skill","title":"docgen","tagline":"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.","description":"# Docgen\n\nSystematic documentation generation with progress tracking and completeness guarantees. Analyzes code file-by-file, ensures nothing is skipped, and produces structured output per component.\n\nDocgen 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.\n\nThe 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.\n\n<workflow>\n\n## Workflow\n\n### 1. Scope the Target\n\nIdentify what needs documenting: single file, directory, module, or entire package. Be specific — \"the auth module\" means every file in that directory.\n\n### 2. Build the File Manifest\n\nEnumerate every file to document with its path. This is the completeness checklist — no file gets dropped silently. Count them: this is your denominator.\n\n### 3. Analyze Each File\n\nFor each file in the manifest:\n\n- **Read the file fully** — do not guess from file names\n- Extract: purpose, public interface, dependencies, key patterns\n- Document using the component template in `references/component-template.md`:\n  - **Purpose** — one sentence\n  - **Public Interface** — every export with signature and description\n  - **Dependencies** — imports and external services\n  - **Key Patterns** — design patterns, invariants, async considerations\n  - **Usage Example** — minimal, copy-pasteable\n  - **Notes** — edge cases and gotchas (only if they exist)\n- Scale the template to complexity: a 10-line utility needs Purpose + Interface + Example; a complex service gets the full template\n- Mark the file as documented. Report progress: `[3/12 files documented]`\n\n### 4. Cross-Reference\n\nAfter all files are documented:\n\n- Verify imports and dependencies between documented components\n- Note common patterns across the module\n- Flag circular dependencies or unclear boundaries\n\n### 5. Synthesize\n\nProduce the final documentation:\n\n- Module overview (what it does, how components relate)\n- Per-component documentation (from step 3)\n- Dependency map (what depends on what)\n\n</workflow>\n\n<guardrails>\n\n### Guardrails\n\n- **Don't guess from file names** — read the actual code. File and function names lie. Read the implementation before writing any documentation claim.\n- **Don't skip small files** — they often contain critical glue (re-exports, config, type definitions).\n- **Don't document in batches from memory** — read each file fresh. Memory drifts.\n- **Don't declare completeness without checking the manifest** — every file must be checked off.\n- **Don't restate code without explaining WHY** — `// increments counter by 1` on `counter++` adds no value. Explain the reason behind the logic.\n\n</guardrails>\n\n<validation>\n\n### Validation Checkpoint\n\nBefore declaring documentation complete, verify:\n\n- [ ] Every file in the manifest was documented (none skipped)\n- [ ] Progress was tracked explicitly throughout\n- [ ] Cross-references between components are accurate\n- [ ] Documentation was generated from code reading, not memory\n\n</validation>\n\n<example>\n\n## Example\n\n**Documenting `src/auth/`:**\n\n**Manifest:** 4 files — `middleware.ts`, `session.ts`, `guards.ts`, `index.ts`\n\n[1/4] `middleware.ts` — Authentication middleware. Extracts JWT from Authorization header, validates with `session.verify()`, attaches user to request context. Exports: `authMiddleware()`.\n\n[2/4] `session.ts` — Session management. Creates/verifies JWTs using `jsonwebtoken`. Token lifetime: 24h. Exports: `createSession()`, `verify()`.\n\n[3/4] `guards.ts` — Route guards. `requireAdmin()` checks `user.role === 'admin'`. `requireAuth()` checks session exists. Both use `authMiddleware` output.\n\n[4/4] `index.ts` — Re-exports: `authMiddleware`, `requireAdmin`, `requireAuth`, `createSession`.\n\n**Cross-reference:** `guards.ts` depends on `middleware.ts` output. `middleware.ts` depends on `session.ts`. `index.ts` is the public API surface.\n\n</example>\n\n## Usage Patterns\n\n- \"Document the authentication module\"\n- \"Generate API reference docs for this package\"\n- \"I need complete docs for everything in src/services/\"\n- \"What does this module do and how do I use it?\" (single-component mode)\n\n## References\n\n- **[Docgen Strategy](references/docgen-strategy.md)** — Five-step documentation workflow: scope target, build file manifest, analyze each file, cross-reference, synthesize\n- **[Component Template](references/component-template.md)** — Per-component documentation structure with scaling guidance for utilities, services, and config files","tags":["docgen","flow","cofin","agent-skills","ai-agents","beads","claude-code","codex","cursor","developer-tools","gemini-cli","opencode"],"capabilities":["skill","source-cofin","skill-docgen","topic-agent-skills","topic-ai-agents","topic-beads","topic-claude-code","topic-codex","topic-cursor","topic-developer-tools","topic-gemini-cli","topic-opencode","topic-plugin","topic-slash-commands","topic-spec-driven-development"],"categories":["flow"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/cofin/flow/docgen","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add cofin/flow","source_repo":"https://github.com/cofin/flow","install_from":"skills.sh"}},"qualityScore":"0.455","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 11 github stars · SKILL.md body (4,683 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:07:36.350Z","embedding":null,"createdAt":"2026-04-23T13:03:58.945Z","updatedAt":"2026-05-18T19:07:36.350Z","lastSeenAt":"2026-05-18T19:07:36.350Z","tsv":"'1':125,414 '1/4':472 '10':258 '2':151 '2/4':491 '24h':501 '3':180,330 '3/12':110,279 '3/4':505 '4':282,466 '4/4':521 '5':310 'accur':453 'across':301 'actual':346 'ad':80 'ad-hoc':79 'add':417 'admin':512 'also':74 'alway':115 'analysi':62 'analyz':37,181,598 'api':7,546,555 'async':235 'attach':484 'auth':143 'authent':474,552 'authmiddlewar':490,519,526 'author':479 'batch':381 'behind':423 'boundari':309 'build':16,152,595 'case':245 'check':395,402,510,514 'checklist':168 'checkpoint':427 'circular':305 'claim':360 'code':38,347,407,458 'common':299 'complement':54 'complet':35,88,167,393,431,563 'complex':256,266 'compon':12,52,210,297,322,326,451,582,605,610 'config':374,620 'consider':236 'contain':368 'content':15 'context':488 'copi':241 'copy-past':240 'core':98 'count':174 'counter':412,416 'cover':120 'coverag':25 'creat':13 'creates/verifies':495 'createsess':503,529 'critic':369 'cross':284,448,531,602 'cross-refer':283,447,530,601 'declar':392,429 'definit':376 'denomin':179 'depend':204,225,294,306,331,334,534,539 'descript':224 'design':232 'directori':135,150 'doc':8,57,67,95,557,564 'docgen':1,27,53,585 'document':5,9,20,29,82,89,105,112,132,160,207,276,281,290,296,315,327,359,379,430,439,454,463,550,591,611 'drift':389 'drop':172 'edg':244 'engin':63 'ensur':43 'entir':138 'enumer':156 'everi':100,146,157,219,398,433 'everyth':566 'exampl':238,264,462 'exist':251,516 'explain':409,420 'explicit':24,109,445 'export':220,373,489,502,525 'extern':228 'extract':200,476 'file':22,40,42,101,111,134,147,154,158,170,183,186,192,198,274,280,288,342,348,365,386,399,434,467,596,600,621 'file-by-fil':39 'final':314 'five':69,589 'five-phas':68 'five-step':588 'flag':304 'flow':56,66,94 'flow-doc':55,65,93 'fresh':387 'full':92,270 'fulli':193 'function':350 'generat':4,30,456,554 'get':104,171,268 'glue':370 'gotcha':247 'guarante':36,99 'guard':508 'guardrail':337 'guards.ts':470,506,533 'guess':196,340 'guid':18 'guidanc':615 'header':480 'hoc':81 'identifi':129 'implement':355 'import':226,292 'increment':411 'index.ts':471,522,542 'interfac':203,218,263 'invari':234 'jsonwebtoken':498 'jwt':477 'jwts':496 'key':205,230 'know':116 'lie':352 'lifetim':500 'line':259 'logic':425 'manag':494 'mani':21 'manifest':155,189,397,437,465,597 'map':332 'mark':272 'mean':145 'memori':383,388,461 'middlewar':475 'middleware.ts':468,473,536,538 'minim':239 'mode':583 'modul':10,136,144,303,316,553,572 'must':400 'name':199,343,351 'need':86,131,261,562 'none':440 'note':243,298 'noth':44 'often':367 'one':215 'output':50,520,537 'overview':317 'packag':139,560 'pasteabl':242 'path':163 'pattern':206,231,233,300,549 'per':51,325,609 'per-compon':324,608 'phase':70 'produc':48,312 'progress':32,106,278,442 'provid':59 'public':202,217,545 'purpos':201,214,262 're':372,524 're-export':371,523 'read':190,344,353,384,459 'readm':14 'reason':422 'refer':17,285,449,532,556,584,603 'references/component-template.md':213,607 'references/docgen-strategy.md':587 'relat':323 'remain':123 'report':277 'request':487 'requireadmin':509,527 'requireauth':513,528 'restat':406 'rout':507 'run':96 'scale':252,614 'scope':103,126,593 'sentenc':216 'servic':229,267,618 'session':493,515 'session.ts':469,492,541 'session.verify':483 'signatur':222 'silent':173 'singl':133,581 'single-compon':580 'skill' 'skill-docgen' 'skip':46,363,441 'small':364 'source-cofin' 'specif':141 'src/auth':464 'src/services':568 'standalon':77 'step':329,590 'strategi':586 'structur':49,87,612 'surfac':547 'synthes':311,604 'systemat':28,61 'target':128,594 'task':83 'templat':211,254,271,606 'throughout':446 'token':499 'topic-agent-skills' 'topic-ai-agents' 'topic-beads' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-developer-tools' 'topic-gemini-cli' 'topic-opencode' 'topic-plugin' 'topic-slash-commands' 'topic-spec-driven-development' 'track':26,33,108,444 'type':375 'unclear':308 'usag':237,548 'use':2,76,208,497,518,578 'user':485 'user.role':511 'util':260,617 'valid':426,481 'valu':419 'verifi':291,432,504 'without':90,394,408 'workflow':71,124,592 'write':6,357","prices":[{"id":"892b7a78-fa07-47d9-9e3d-d1007c7f9396","listingId":"2862fd0f-97de-44c3-9eb5-d3c11fa97222","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"cofin","category":"flow","install_from":"skills.sh"},"createdAt":"2026-04-23T13:03:58.945Z"}],"sources":[{"listingId":"2862fd0f-97de-44c3-9eb5-d3c11fa97222","source":"github","sourceId":"cofin/flow/docgen","sourceUrl":"https://github.com/cofin/flow/tree/main/skills/docgen","isPrimary":false,"firstSeenAt":"2026-04-23T13:03:58.945Z","lastSeenAt":"2026-05-18T19:07:36.350Z"}],"details":{"listingId":"2862fd0f-97de-44c3-9eb5-d3c11fa97222","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"cofin","slug":"docgen","github":{"repo":"cofin/flow","stars":11,"topics":["agent-skills","ai-agents","beads","claude-code","codex","context-driven-development","cursor","developer-tools","gemini-cli","opencode","plugin","slash-commands","spec-driven-development","subagents","tdd","workflow"],"license":"apache-2.0","html_url":"https://github.com/cofin/flow","pushed_at":"2026-04-27T19:07:26Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"48e661bc1dc5898fe0635409243cd811ab77ecbb","skill_md_path":"skills/docgen/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/cofin/flow/tree/main/skills/docgen"},"layout":"multi","source":"github","category":"flow","frontmatter":{"name":"docgen","description":"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."},"skills_sh_url":"https://skills.sh/cofin/flow/docgen"},"updatedAt":"2026-05-18T19:07:36.350Z"}}