@opendirectory.dev/skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/.claude/skills/claude-md-generator/.env.example +7 -0
  2. package/.claude/skills/claude-md-generator/README.md +78 -0
  3. package/.claude/skills/claude-md-generator/SKILL.md +248 -0
  4. package/.claude/skills/claude-md-generator/evals/evals.json +35 -0
  5. package/.claude/skills/claude-md-generator/references/section-guide.md +175 -0
  6. package/dist/e2e.test.d.ts +1 -0
  7. package/dist/e2e.test.js +62 -0
  8. package/dist/fs-adapters.d.ts +4 -0
  9. package/dist/fs-adapters.js +101 -0
  10. package/dist/fs-adapters.test.d.ts +1 -0
  11. package/dist/fs-adapters.test.js +108 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.js +211 -0
  14. package/dist/transformers.d.ts +6 -0
  15. package/dist/transformers.js +2 -0
  16. package/package.json +25 -0
  17. package/registry.json +226 -0
  18. package/skills/blog-cover-image-cli/.github/workflows/publish.yml +19 -0
  19. package/skills/blog-cover-image-cli/LICENSE +15 -0
  20. package/skills/blog-cover-image-cli/README.md +126 -0
  21. package/skills/blog-cover-image-cli/SKILL.md +7 -0
  22. package/skills/blog-cover-image-cli/agent-skill/blog-cover-generator/README.md +30 -0
  23. package/skills/blog-cover-image-cli/agent-skill/blog-cover-generator/SKILL.md +72 -0
  24. package/skills/blog-cover-image-cli/bin/cli.js +226 -0
  25. package/skills/blog-cover-image-cli/examples/100x_UX_Research_AI_Agent.png +0 -0
  26. package/skills/blog-cover-image-cli/examples/Firecrawl-supabase-bolt.png +0 -0
  27. package/skills/blog-cover-image-cli/examples/Git-City_Case_study_Cover_Image.jpg +0 -0
  28. package/skills/blog-cover-image-cli/examples/THE DISTRIBUTION LAYER (2).png +0 -0
  29. package/skills/blog-cover-image-cli/examples/canva-perplexity-duolingo-cover-image.png +0 -0
  30. package/skills/blog-cover-image-cli/examples/gamma-mistral-veed.png +0 -0
  31. package/skills/blog-cover-image-cli/examples/server-survival-case-study-cover-image(1).png +0 -0
  32. package/skills/blog-cover-image-cli/examples/viral-meme-automation.png +0 -0
  33. package/skills/blog-cover-image-cli/index.js +2 -0
  34. package/skills/blog-cover-image-cli/package-lock.json +2238 -0
  35. package/skills/blog-cover-image-cli/package.json +37 -0
  36. package/skills/blog-cover-image-cli/src/geminiGenerator.js +126 -0
  37. package/skills/blog-cover-image-cli/src/imageValidator.js +54 -0
  38. package/skills/blog-cover-image-cli/src/logoFetcher.js +86 -0
  39. package/skills/claude-md-generator/.env.example +7 -0
  40. package/skills/claude-md-generator/README.md +78 -0
  41. package/skills/claude-md-generator/SKILL.md +254 -0
  42. package/skills/claude-md-generator/evals/evals.json +35 -0
  43. package/skills/claude-md-generator/references/section-guide.md +175 -0
  44. package/skills/cook-the-blog/README.md +86 -0
  45. package/skills/cook-the-blog/SKILL.md +130 -0
  46. package/skills/dependency-update-bot/.env.example +13 -0
  47. package/skills/dependency-update-bot/README.md +101 -0
  48. package/skills/dependency-update-bot/SKILL.md +376 -0
  49. package/skills/dependency-update-bot/evals/evals.json +45 -0
  50. package/skills/dependency-update-bot/references/changelog-patterns.md +201 -0
  51. package/skills/docs-from-code/.env.example +13 -0
  52. package/skills/docs-from-code/README.md +97 -0
  53. package/skills/docs-from-code/SKILL.md +160 -0
  54. package/skills/docs-from-code/evals/evals.json +29 -0
  55. package/skills/docs-from-code/references/extraction-guide.md +174 -0
  56. package/skills/docs-from-code/references/output-template.md +135 -0
  57. package/skills/docs-from-code/scripts/extract_py.py +238 -0
  58. package/skills/docs-from-code/scripts/extract_ts.ts +284 -0
  59. package/skills/docs-from-code/scripts/package.json +18 -0
  60. package/skills/explain-this-pr/README.md +74 -0
  61. package/skills/explain-this-pr/SKILL.md +130 -0
  62. package/skills/explain-this-pr/evals/evals.json +35 -0
  63. package/skills/google-trends-api-skills/README.md +78 -0
  64. package/skills/google-trends-api-skills/SKILL.md +7 -0
  65. package/skills/google-trends-api-skills/google-trends-api/SKILL.md +163 -0
  66. package/skills/google-trends-api-skills/google-trends-api/references/api-responses.md +188 -0
  67. package/skills/google-trends-api-skills/google-trends-api/scripts/discover_keywords.py +344 -0
  68. package/skills/google-trends-api-skills/seo-keyword-research/SKILL.md +205 -0
  69. package/skills/google-trends-api-skills/seo-keyword-research/references/keyword-placement-guide.md +89 -0
  70. package/skills/google-trends-api-skills/seo-keyword-research/references/tech-blog-examples.md +207 -0
  71. package/skills/google-trends-api-skills/seo-keyword-research/scripts/blog_seo_research.py +373 -0
  72. package/skills/hackernews-intel/.env.example +33 -0
  73. package/skills/hackernews-intel/README.md +161 -0
  74. package/skills/hackernews-intel/SKILL.md +156 -0
  75. package/skills/hackernews-intel/evals/evals.json +35 -0
  76. package/skills/hackernews-intel/package.json +15 -0
  77. package/skills/hackernews-intel/scripts/monitor-hn.js +258 -0
  78. package/skills/kill-the-standup/.env.example +22 -0
  79. package/skills/kill-the-standup/README.md +84 -0
  80. package/skills/kill-the-standup/SKILL.md +169 -0
  81. package/skills/kill-the-standup/evals/evals.json +35 -0
  82. package/skills/kill-the-standup/references/standup-format.md +102 -0
  83. package/skills/linkedin-post-generator/.env.example +14 -0
  84. package/skills/linkedin-post-generator/README.md +107 -0
  85. package/skills/linkedin-post-generator/SKILL.md +228 -0
  86. package/skills/linkedin-post-generator/evals/evals.json +35 -0
  87. package/skills/linkedin-post-generator/references/linkedin-format.md +216 -0
  88. package/skills/linkedin-post-generator/references/output-template.md +154 -0
  89. package/skills/llms-txt-generator/.env.example +18 -0
  90. package/skills/llms-txt-generator/README.md +142 -0
  91. package/skills/llms-txt-generator/SKILL.md +176 -0
  92. package/skills/llms-txt-generator/evals/evals.json +35 -0
  93. package/skills/llms-txt-generator/references/llms-txt-spec.md +88 -0
  94. package/skills/llms-txt-generator/references/output-template.md +76 -0
  95. package/skills/llms-txt-generator/test-output/genzcareer.in/llms.txt +31 -0
  96. package/skills/luma-attendees-scraper/README.md +170 -0
  97. package/skills/luma-attendees-scraper/SKILL.md +7 -0
  98. package/skills/luma-attendees-scraper/luma_attendees_export.js +223 -0
  99. package/skills/meeting-brief-generator/.env.example +21 -0
  100. package/skills/meeting-brief-generator/README.md +90 -0
  101. package/skills/meeting-brief-generator/SKILL.md +275 -0
  102. package/skills/meeting-brief-generator/evals/evals.json +35 -0
  103. package/skills/meeting-brief-generator/references/brief-format.md +114 -0
  104. package/skills/meeting-brief-generator/references/output-template.md +150 -0
  105. package/skills/meta-ads-skill/README.md +100 -0
  106. package/skills/meta-ads-skill/SKILL.md +7 -0
  107. package/skills/meta-ads-skill/meta-ads-skill/SKILL.md +41 -0
  108. package/skills/meta-ads-skill/meta-ads-skill/references/report_templates.md +47 -0
  109. package/skills/meta-ads-skill/meta-ads-skill/references/workflows.md +51 -0
  110. package/skills/meta-ads-skill/meta-ads-skill/scripts/auth_check.py +22 -0
  111. package/skills/meta-ads-skill/meta-ads-skill/scripts/formatters.py +46 -0
  112. package/skills/newsletter-digest/.env.example +20 -0
  113. package/skills/newsletter-digest/README.md +147 -0
  114. package/skills/newsletter-digest/SKILL.md +221 -0
  115. package/skills/newsletter-digest/evals/evals.json +35 -0
  116. package/skills/newsletter-digest/feeds.json +7 -0
  117. package/skills/newsletter-digest/package.json +15 -0
  118. package/skills/newsletter-digest/references/digest-format.md +123 -0
  119. package/skills/newsletter-digest/references/output-template.md +136 -0
  120. package/skills/newsletter-digest/scripts/fetch-feeds.js +141 -0
  121. package/skills/newsletter-digest/scripts/ghost-publish.js +147 -0
  122. package/skills/noise2blog/.env.example +16 -0
  123. package/skills/noise2blog/README.md +107 -0
  124. package/skills/noise2blog/SKILL.md +229 -0
  125. package/skills/noise2blog/evals/evals.json +35 -0
  126. package/skills/noise2blog/references/blog-format.md +188 -0
  127. package/skills/noise2blog/references/output-template.md +184 -0
  128. package/skills/outreach-sequence-builder/.env.example +12 -0
  129. package/skills/outreach-sequence-builder/README.md +108 -0
  130. package/skills/outreach-sequence-builder/SKILL.md +248 -0
  131. package/skills/outreach-sequence-builder/evals/evals.json +36 -0
  132. package/skills/outreach-sequence-builder/references/output-template.md +171 -0
  133. package/skills/outreach-sequence-builder/references/sequence-format.md +167 -0
  134. package/skills/outreach-sequence-builder/references/signal-playbook.md +117 -0
  135. package/skills/position-me/README.md +71 -0
  136. package/skills/position-me/SKILL.md +7 -0
  137. package/skills/position-me/position-me/SKILL.md +50 -0
  138. package/skills/position-me/position-me/references/EVALUATION_SOP.md +40 -0
  139. package/skills/position-me/position-me/references/REPORT_TEMPLATE.md +58 -0
  140. package/skills/position-me/position-me/scripts/extract_links.py +49 -0
  141. package/skills/pr-description-writer/README.md +81 -0
  142. package/skills/pr-description-writer/SKILL.md +141 -0
  143. package/skills/pr-description-writer/evals/evals.json +35 -0
  144. package/skills/pr-description-writer/references/pr-format-guide.md +145 -0
  145. package/skills/producthunt-launch-kit/.env.example +7 -0
  146. package/skills/producthunt-launch-kit/README.md +95 -0
  147. package/skills/producthunt-launch-kit/SKILL.md +380 -0
  148. package/skills/producthunt-launch-kit/evals/evals.json +35 -0
  149. package/skills/producthunt-launch-kit/references/copy-rules.md +124 -0
  150. package/skills/reddit-icp-monitor/.env.example +16 -0
  151. package/skills/reddit-icp-monitor/README.md +117 -0
  152. package/skills/reddit-icp-monitor/SKILL.md +271 -0
  153. package/skills/reddit-icp-monitor/evals/evals.json +40 -0
  154. package/skills/reddit-icp-monitor/references/icp-format.md +131 -0
  155. package/skills/reddit-icp-monitor/references/reply-rules.md +110 -0
  156. package/skills/reddit-post-engine/.env.example +13 -0
  157. package/skills/reddit-post-engine/README.md +103 -0
  158. package/skills/reddit-post-engine/SKILL.md +303 -0
  159. package/skills/reddit-post-engine/evals/evals.json +35 -0
  160. package/skills/reddit-post-engine/references/subreddit-playbook.md +156 -0
  161. package/skills/schema-markup-generator/.env.example +19 -0
  162. package/skills/schema-markup-generator/README.md +114 -0
  163. package/skills/schema-markup-generator/SKILL.md +192 -0
  164. package/skills/schema-markup-generator/evals/evals.json +35 -0
  165. package/skills/schema-markup-generator/references/json-ld-spec.md +263 -0
  166. package/skills/schema-markup-generator/references/output-template.md +556 -0
  167. package/skills/show-hn-writer/.env.example +14 -0
  168. package/skills/show-hn-writer/README.md +88 -0
  169. package/skills/show-hn-writer/SKILL.md +303 -0
  170. package/skills/show-hn-writer/evals/evals.json +35 -0
  171. package/skills/show-hn-writer/references/hn-rules.md +74 -0
  172. package/skills/show-hn-writer/references/title-formulas.md +93 -0
  173. package/skills/stargazer/README.md +79 -0
  174. package/skills/stargazer/SKILL.md +7 -0
  175. package/skills/stargazer/stargazer-skill/SKILL.md +58 -0
  176. package/skills/stargazer/stargazer-skill/assets/.env.example +18 -0
  177. package/skills/stargazer/stargazer-skill/scripts/convert_to_csv.py +63 -0
  178. package/skills/stargazer/stargazer-skill/scripts/count_emails.py +52 -0
  179. package/skills/stargazer/stargazer-skill/scripts/stargazer_deep_extractor.py +450 -0
  180. package/skills/tweet-thread-from-blog/.env.example +14 -0
  181. package/skills/tweet-thread-from-blog/README.md +109 -0
  182. package/skills/tweet-thread-from-blog/SKILL.md +177 -0
  183. package/skills/tweet-thread-from-blog/evals/evals.json +35 -0
  184. package/skills/tweet-thread-from-blog/references/output-template.md +193 -0
  185. package/skills/tweet-thread-from-blog/references/thread-format.md +107 -0
  186. package/skills/twitter-GTM-find-skill/README.md +43 -0
  187. package/skills/twitter-GTM-find-skill/SKILL.md +7 -0
  188. package/skills/twitter-GTM-find-skill/twitter-GTM-find/SKILL.md +37 -0
  189. package/skills/twitter-GTM-find-skill/twitter-GTM-find/references/icp-checklist.md +35 -0
  190. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/package.json +23 -0
  191. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/run_pipeline.sh +8 -0
  192. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/src/debug.ts +23 -0
  193. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/src/extractor.ts +79 -0
  194. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/src/icp-filter.ts +87 -0
  195. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/src/index.ts +94 -0
  196. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/src/scraper.ts +41 -0
  197. package/skills/twitter-GTM-find-skill/twitter-GTM-find/scripts/tsconfig.json +13 -0
  198. package/skills/yc-intent-radar-skill/README.md +39 -0
  199. package/skills/yc-intent-radar-skill/SKILL.md +7 -0
  200. package/skills/yc-intent-radar-skill/yc-jobs-scraper/SKILL.md +59 -0
  201. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/auth.js +29 -0
  202. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/db.js +62 -0
  203. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/export_radar_candidates.js +40 -0
  204. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/package-lock.json +1525 -0
  205. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/package.json +12 -0
  206. package/skills/yc-intent-radar-skill/yc-jobs-scraper/scripts/scraper.js +217 -0
  207. package/src/e2e.test.ts +35 -0
  208. package/src/fs-adapters.test.ts +91 -0
  209. package/src/fs-adapters.ts +65 -0
  210. package/src/index.ts +182 -0
  211. package/src/transformers.ts +6 -0
  212. package/tsconfig.json +8 -0
@@ -0,0 +1,97 @@
1
+ # docs-from-code
2
+
3
+ ![docs-from-code](https://github.com/user-attachments/assets/493c7c61-9aa9-48e9-a71b-7c77c8c6a949)
4
+
5
+ Automatically generate and maintain README.md, API reference docs, and an Architecture section by reading your codebase. Uses [graphify](https://github.com/safishamsi/graphify) to build a knowledge graph first, then uses AI to write clean documentation grounded in what actually exists.
6
+
7
+ ## What It Generates
8
+
9
+ | Output | When |
10
+ |--------|------|
11
+ | `README.md` (full) | Project has no README |
12
+ | `README.md` (sections) | README exists but API or architecture sections are stale |
13
+ | `docs/API.md` | Project has HTTP routes |
14
+ | Architecture section | Always, from graphify's god nodes and communities |
15
+ | GitHub PR | When you ask it to open one |
16
+
17
+ ## Why graphify?
18
+
19
+ The skill uses graphify as its extraction engine:
20
+ - 20 languages via tree-sitter AST: Python, TypeScript, Go, Rust, Java, and 15 more
21
+ - Architecture insight: god nodes and community clusters show what everything connects through
22
+ - 71.5x fewer tokens than reading raw files, efficient on large codebases
23
+ - SHA256 cache: re-runs only process changed files
24
+ - Honest tagging: `EXTRACTED` (found in source) vs `INFERRED` (reasonable inference with confidence score)
25
+ - Extracts rationale from `# NOTE:`, `# WHY:`, `# HACK:` comments and docstrings
26
+
27
+ The bundled `scripts/` (TypeScript and Python AST extractors) serve as a fallback if graphify is unavailable.
28
+
29
+ ## Supported Languages (via graphify)
30
+
31
+ Python, TypeScript, JavaScript, Go, Rust, Java, C, C++, Ruby, C#, Kotlin, Scala, PHP, Swift, Lua, Zig, PowerShell, Elixir, Objective-C, Julia
32
+
33
+ ## Requirements
34
+
35
+ - Python 3.10+ (for graphify)
36
+ - Node.js 18+ (for fallback TypeScript extractor)
37
+ - `gh` CLI (optional, for opening PRs automatically)
38
+ - `GITHUB_TOKEN` env var (optional, for PRs)
39
+
40
+ ## Setup
41
+
42
+ ### 1. Install graphify
43
+
44
+ ```bash
45
+ pip install graphifyy
46
+ ```
47
+
48
+ No API keys needed for extraction. graphify uses your agent's existing model access.
49
+
50
+ ### 2. Configure (Optional)
51
+
52
+ ```bash
53
+ cp .env.example .env
54
+ # Add GITHUB_TOKEN if you want auto-PR support
55
+ ```
56
+
57
+ ## How to Use
58
+
59
+ Be inside your project and ask:
60
+
61
+ ```
62
+ "Generate a README for this project"
63
+ "My API docs are out of date, update them from the code"
64
+ "Create docs/API.md from my FastAPI routes"
65
+ "Add an architecture section to our README"
66
+ "Document this TypeScript library"
67
+ ```
68
+
69
+ The agent will:
70
+ 1. Run `graphify . --no-viz` to build a knowledge graph of your codebase
71
+ 2. Read `GRAPH_REPORT.md` for god nodes, communities, and architecture insights
72
+ 3. Query the graph for routes, types, and data models
73
+ 4. Read existing docs to understand what needs updating
74
+ 5. Generate accurate docs grounded in the graph
75
+ 6. Write files and optionally open a GitHub PR
76
+
77
+ ## Project Structure
78
+
79
+ ```
80
+ docs-from-code/
81
+ ├── SKILL.md # Agent instructions
82
+ ├── README.md # This file
83
+ ├── .env.example # Environment variables template
84
+ ├── scripts/
85
+ │ ├── package.json # Script dependencies (ts-morph)
86
+ │ ├── extract_ts.ts # TypeScript/JS AST extractor
87
+ │ └── extract_py.py # Python AST extractor
88
+ ├── references/
89
+ │ ├── extraction-guide.md # Per-framework extraction notes
90
+ │ └── output-template.md # README and API.md templates
91
+ └── evals/
92
+ └── evals.json # Test prompts
93
+ ```
94
+
95
+ ## License
96
+
97
+ MIT
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: docs-from-code
3
+ description: Generates and updates README.md and API reference docs by reading your codebase's functions, routes, types, schemas, and architecture. Uses graphify to build a knowledge graph first, then writes accurate docs from it. Use when asked to write docs, generate a README, document an API, update stale docs, create an API reference from code, add an architecture section, or document a project in any language. Trigger when a user says their docs are missing, outdated, or wants to document their codebase without writing it manually.
4
+ compatibility: [claude-code, gemini-cli, github-copilot]
5
+ author: OpenDirectory
6
+ version: 1.0.0
7
+ ---
8
+
9
+ # docs-from-code
10
+
11
+ You are a technical writer. Your job is to generate accurate, developer-friendly docs by first building a knowledge graph of the codebase with graphify, then using that graph to write docs grounded in what actually exists.
12
+
13
+ **DO NOT invent code.** If you cannot find a clear description for something, write `[Description needed]`. Accurate but sparse docs are better than confident but wrong docs.
14
+
15
+ **Before starting:** Confirm you are inside a codebase directory. If the user pointed you at a remote repo, clone it first. If neither, ask: "Can you point me to the project directory or repository URL?"
16
+
17
+ ---
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Install graphify and Build the Knowledge Graph
22
+
23
+ graphify uses tree-sitter AST (20 languages, no LLM) for code structure and Claude subagents for semantic understanding of docs and comments.
24
+
25
+ ```bash
26
+ pip install graphifyy
27
+ graphify . --no-viz
28
+ ```
29
+
30
+ `--no-viz` skips HTML output. You only need `GRAPH_REPORT.md` and `graph.json`.
31
+
32
+ This produces `graphify-out/` in the project root:
33
+ - `GRAPH_REPORT.md` — god nodes, community clusters, surprising connections, suggested questions
34
+ - `graph.json` — full queryable knowledge graph (persistent, SHA256-cached)
35
+
36
+ **QA:** Did `graphify-out/GRAPH_REPORT.md` get created? How many nodes and edges? If graphify fails, go to Step 1B.
37
+
38
+ #### Step 1B: Fallback (if graphify unavailable)
39
+
40
+ ```bash
41
+ # TypeScript/JS projects:
42
+ cd <skill-directory>/scripts && npm install
43
+ npx ts-node extract_ts.ts <project-root> <project-root>/.docs-extract.json
44
+
45
+ # Python projects:
46
+ python3 <skill-directory>/scripts/extract_py.py <project-root> <project-root>/.docs-extract.json
47
+ ```
48
+
49
+ Read `references/extraction-guide.md` for framework-specific notes on the fallback output.
50
+
51
+ ---
52
+
53
+ ### Step 2: Read the Graph Report
54
+
55
+ Read `graphify-out/GRAPH_REPORT.md` in full. This gives you:
56
+ - **God nodes** — highest-degree concepts (what everything connects through). Use these for the Architecture section.
57
+ - **Community clusters** — logical groupings of related code. Use these for module documentation.
58
+ - **Surprising connections** — non-obvious cross-file relationships. Note these in Architecture.
59
+ - **Suggested questions** — graphify's assessment of what is worth documenting.
60
+
61
+ Then run targeted queries for specific doc sections:
62
+
63
+ ```bash
64
+ # API routes
65
+ graphify query "show all API routes and endpoints" --graph graphify-out/graph.json
66
+
67
+ # Data models
68
+ graphify query "what are the main data models and types?" --graph graphify-out/graph.json
69
+
70
+ # Auth flow
71
+ graphify query "how does authentication work?" --graph graphify-out/graph.json
72
+
73
+ # Entry points
74
+ graphify query "what is the entry point and how is the app initialised?" --graph graphify-out/graph.json
75
+ ```
76
+
77
+ Each query returns a focused subgraph. Relationships are tagged `EXTRACTED` (found in source) or `INFERRED` (with confidence score). Trust `EXTRACTED` fully. Use `INFERRED` but flag uncertainty.
78
+
79
+ **QA:** Cross-check 2-3 routes from the query against actual source files before writing docs.
80
+
81
+ ---
82
+
83
+ ### Step 3: Read Existing Documentation
84
+
85
+ Before writing anything new, check what already exists:
86
+
87
+ 1. Read `README.md` if present. Note which sections exist and which are stale or missing.
88
+ 2. Read `docs/API.md`, `docs/api.md`, or `API.md` if present.
89
+ 3. Read `CHANGELOG.md` for context on recent changes worth noting.
90
+
91
+ Decide what to generate:
92
+ - **No README** — generate a full README from Template 1 in `references/output-template.md`
93
+ - **README exists, API section stale** — update only that section (Template 3)
94
+ - **README exists, fully outdated** — ask: "Your README exists but appears outdated. Rewrite fully or update specific sections?"
95
+
96
+ **QA:** List exactly what you will write or update before starting.
97
+
98
+ ---
99
+
100
+ ### Step 4: Generate Documentation
101
+
102
+ Read `references/output-template.md` for the exact templates to use.
103
+
104
+ **README — Project Description:**
105
+ From `package.json` or `pyproject.toml` description + god nodes summary from `GRAPH_REPORT.md`.
106
+
107
+ **README — Architecture Section:**
108
+ Use god nodes and community clusters to write a plain-English architecture overview. Example:
109
+ > "The system is organised around 3 core modules: `AuthService` (god node, connects to 14 other components), `DatabaseAdapter` (bridges all data access), and `EventBus` (central to async flows). The auth and request-handling modules are tightly coupled; the analytics module is independent."
110
+
111
+ **README — Installation and Quick Start:**
112
+ From the entry point file + `scripts` in `package.json` or `Makefile`.
113
+
114
+ **API Reference (`docs/API.md`):**
115
+ From the `graphify query "show all API routes"` output. One section per resource, grouped by path prefix. For each route: method, path, description (from docstring or rationale node), request/response shape (from linked type nodes), curl example.
116
+
117
+ Flag anything without a docstring as `[Description needed]`. Do not invent behaviour.
118
+
119
+ **QA:** Check 3 random routes in the generated `docs/API.md` against the actual source file. Do the paths and descriptions match?
120
+
121
+ ---
122
+
123
+ ### Step 5: Write Files, Clean Up, and Open PR
124
+
125
+ 1. Write `README.md` to the project root (full file or updated sections only).
126
+ 2. Write `docs/API.md` if routes were found. Create `docs/` if needed.
127
+ 3. Clean up: `rm -rf graphify-out/ .docs-extract.json`
128
+
129
+ Ask the user: "Docs written. Should I open a GitHub PR with these changes?"
130
+
131
+ If yes:
132
+ ```bash
133
+ git checkout -b docs/auto-generated-$(date +%Y%m%d)
134
+ git add README.md docs/
135
+ git commit -m "docs: auto-generate README and API reference from codebase"
136
+ gh pr create \
137
+ --title "docs: auto-generated README and API reference" \
138
+ --body "Generated by docs-from-code skill using graphify knowledge graph. All routes and types verified against source."
139
+ ```
140
+
141
+ **QA:** Did the files write? Do paths exist? Did the PR open cleanly?
142
+
143
+ ---
144
+
145
+ ## What Good Output Looks Like
146
+
147
+ - Architecture section explains god nodes and module relationships in plain English
148
+ - Every route in `docs/API.md` matches a real path from the graphify query output
149
+ - README Quick Start has a runnable snippet from tests or the entry point
150
+ - INFERRED relationships that influenced descriptions are noted as "likely" or "appears to"
151
+ - Missing descriptions are flagged `[Description needed]`, not fabricated
152
+
153
+ ## What Bad Output Looks Like
154
+
155
+ - Routes or functions that do not appear in the graphify query results
156
+ - Architecture section that is generic ("the app has controllers, services, and models")
157
+ - Examples using wrong function names or parameter types
158
+ - INFERRED edges described as definite facts without a confidence qualifier
159
+
160
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "skill_name": "docs-from-code",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "My Express API has no README at all. Generate one from the codebase.",
7
+ "expected_output": "Agent runs `graphify . --no-viz` to build the knowledge graph. Reads GRAPH_REPORT.md for god nodes and community clusters. Queries graph for routes and types. Generates a complete README.md with: project name and description, installation steps, an Architecture section based on god nodes, API reference with all found routes (method, path, description from graphify), configuration table from .env.example. Writes README.md to the project root.",
8
+ "files": []
9
+ },
10
+ {
11
+ "id": 2,
12
+ "prompt": "My FastAPI project has routes across 3 router files but no API docs. Generate docs/API.md for me.",
13
+ "expected_output": "Agent runs graphify on the project. Queries `graphify query 'show all API routes'` to get routes across all router files. Groups routes by resource prefix from graph output. Generates docs/API.md with each route containing: method, path, description from docstring or rationale node (or [Description needed]), request params from Pydantic model nodes in graph, curl example. INFERRED relationships are qualified with 'likely' or 'appears to'.",
14
+ "files": []
15
+ },
16
+ {
17
+ "id": 3,
18
+ "prompt": "I have a Next.js app router project. The README exists but the API section is 6 months out of date — we added 5 new endpoints. Update only the API section.",
19
+ "expected_output": "Agent runs graphify and queries for API routes. Reads existing README.md to locate the current API section. Replaces only that section with updated route documentation from graphify output. Leaves all other README sections untouched. Cleans up graphify-out/. Offers to open a PR.",
20
+ "files": []
21
+ },
22
+ {
23
+ "id": 4,
24
+ "prompt": "Add an architecture section to our README. We have a Go backend with a lot of internal packages and nobody knows how they connect.",
25
+ "expected_output": "Agent runs graphify on the Go project (tree-sitter supports Go natively). Reads GRAPH_REPORT.md to identify god nodes and community clusters. Writes an Architecture section in README.md describing: the top 3-5 god nodes by name and what they connect to, the 2-3 main community clusters and what they represent, any surprising cross-module connections flagged by graphify. Plain English, no invented relationships.",
26
+ "files": []
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,174 @@
1
+ # Extraction Guide
2
+
3
+ ## Primary: graphify
4
+
5
+ graphify is the primary extraction engine. Run it first:
6
+
7
+ ```bash
8
+ pip install graphifyy
9
+ graphify . --no-viz
10
+ ```
11
+
12
+ ### What graphify produces for docs
13
+
14
+ | Output | Use for |
15
+ |--------|---------|
16
+ | `GRAPH_REPORT.md` god nodes | Architecture section: "what everything connects through" |
17
+ | `GRAPH_REPORT.md` communities | Module breakdown: how to organise the API reference |
18
+ | `graphify query "API routes"` | `docs/API.md` route list |
19
+ | `graphify query "data models"` | Request/response types in API docs |
20
+ | `graphify query "auth flow"` | Authentication section in README |
21
+ | `graphify query "entry point"` | Quick start and installation section |
22
+ | `rationale_for` nodes in graph | Architecture decisions and "why it was built this way" |
23
+
24
+ ### Querying the graph
25
+
26
+ ```bash
27
+ # Routes
28
+ graphify query "show all HTTP routes and endpoints" --graph graphify-out/graph.json
29
+
30
+ # Types
31
+ graphify query "what are the main data models, interfaces, and types?" --graph graphify-out/graph.json
32
+
33
+ # Auth
34
+ graphify query "how does authentication and authorization work?" --graph graphify-out/graph.json
35
+
36
+ # Config
37
+ graphify query "what environment variables and configuration options are available?" --graph graphify-out/graph.json
38
+
39
+ # Architecture
40
+ graphify query "what are the most connected components and how do modules relate?" --graph graphify-out/graph.json
41
+
42
+ # Entry point
43
+ graphify query "how is the application started and initialised?" --graph graphify-out/graph.json
44
+ ```
45
+
46
+ ### Reading graph output
47
+
48
+ Every edge in graphify output is tagged:
49
+ - `EXTRACTED` — found directly in source code. Treat as fact.
50
+ - `INFERRED` — reasonable inference with confidence score (0.0-1.0). Use in docs but qualify: "likely", "appears to", or add `[verify]`.
51
+ - `AMBIGUOUS` — flagged for review. Do not include in docs without manual verification.
52
+
53
+ ---
54
+
55
+ ## Fallback: Custom Extraction Scripts
56
+
57
+ Use this when graphify is unavailable. The scripts produce `.docs-extract.json` with the same structure used to write docs.
58
+
59
+ ---
60
+
61
+ ## TypeScript / JavaScript Projects
62
+
63
+ ### Next.js (App Router)
64
+ - Routes: `app/**/route.ts` — exported HTTP method handlers (GET, POST, etc.)
65
+ - Pages: `app/**/page.tsx` — document as "page components", not endpoints
66
+ - Types: `src/types/**/*.ts`, `lib/types.ts` — shared TypeScript interfaces
67
+ - Utilities: `lib/**/*.ts`, `utils/**/*.ts` — exported helper functions
68
+ - Key files to read: `app/layout.tsx` (app metadata), `next.config.ts` (config)
69
+
70
+ ### Next.js (Pages Router)
71
+ - Routes: `pages/api/**/*.ts` — default exported handler functions
72
+ - Types: same as App Router
73
+ - Key config: `next.config.js`
74
+
75
+ ### Express
76
+ - Routes: calls to `app.get()`, `app.post()`, `router.get()`, etc.
77
+ - Middleware: exported functions used as middleware
78
+ - Models: any class or interface representing data shapes
79
+ - Key files: `src/app.ts` or `app.js`, `src/routes/`, `src/models/`
80
+
81
+ ### Hono
82
+ - Routes: `app.get('/path', handler)`, `app.post()`, etc. Same pattern as Express.
83
+ - Zod schemas: exported `z.object(...)` definitions. Document as request/response schemas.
84
+
85
+ ### Fastify
86
+ - Routes: `fastify.get('/path', opts, handler)` calls
87
+ - Schemas: inline JSON schema objects in route options
88
+
89
+ ---
90
+
91
+ ## Python Projects
92
+
93
+ ### FastAPI
94
+ - Routes: functions decorated with `@app.get()`, `@app.post()`, `@router.get()`, etc.
95
+ - Pydantic models: classes extending `BaseModel`. Document as request/response schemas.
96
+ - Dependencies: functions used with `Depends()`. Document if they affect auth or request shape.
97
+ - Key files: `main.py`, `app/main.py`, `routers/`
98
+
99
+ ### Flask
100
+ - Routes: functions decorated with `@app.route('/path', methods=['GET'])` or `@blueprint.route()`
101
+ - Models: SQLAlchemy model classes (extend `db.Model`)
102
+ - Key files: `app.py`, `__init__.py`, `routes/`, `models/`
103
+
104
+ ### Django REST Framework
105
+ - Views: classes extending `APIView`, `ViewSet`, `ModelViewSet`
106
+ - Serializers: classes extending `Serializer` or `ModelSerializer`
107
+ - URLs: `urlpatterns` lists. Read `urls.py` directly.
108
+ - Key files: `views.py`, `serializers.py`, `urls.py`, `models.py`
109
+
110
+ ---
111
+
112
+ ## Output JSON Schema
113
+
114
+ The extraction scripts output `.docs-extract.json`:
115
+
116
+ ```json
117
+ {
118
+ "projectName": "my-api",
119
+ "language": "typescript",
120
+ "framework": "express",
121
+ "entryPoints": ["src/index.ts"],
122
+ "functions": [
123
+ {
124
+ "name": "createUser",
125
+ "signature": "createUser(name: string, email: string): Promise<User>",
126
+ "description": "Creates a new user record in the database",
127
+ "params": [
128
+ { "name": "name", "type": "string", "description": "" },
129
+ { "name": "email", "type": "string", "description": "" }
130
+ ],
131
+ "returns": "Promise<User>",
132
+ "file": "/src/services/user.ts",
133
+ "isExported": true
134
+ }
135
+ ],
136
+ "routes": [
137
+ {
138
+ "method": "POST",
139
+ "path": "/users",
140
+ "handler": "createUserHandler",
141
+ "description": "",
142
+ "file": "/src/routes/users.ts"
143
+ }
144
+ ],
145
+ "types": [
146
+ {
147
+ "name": "User",
148
+ "kind": "interface",
149
+ "definition": "interface User { id: string; name: string; email: string; }",
150
+ "description": "",
151
+ "file": "/src/types/user.ts"
152
+ }
153
+ ],
154
+ "dependencies": { "express": "^4.18.0" },
155
+ "scripts": { "start": "node dist/index.js" }
156
+ }
157
+ ```
158
+
159
+ ---
160
+
161
+ ## What to Prioritise When Writing Docs
162
+
163
+ From the extracted data, prioritise in this order:
164
+
165
+ 1. Routes — developers integrating with your API need these most
166
+ 2. Public types and interfaces — define the data contract
167
+ 3. Exported utility functions — frequently called helpers
168
+ 4. Classes — especially models and services
169
+ 5. Internal or private functions — lowest priority, often skip
170
+
171
+ Skip:
172
+ - Test files (`*.test.ts`, `*.spec.ts`, `_test.py`)
173
+ - Generated files (`*.generated.ts`, Prisma client output)
174
+ - Config files with no user-facing exports
@@ -0,0 +1,135 @@
1
+ # Output Templates
2
+
3
+ Use these templates when generating documentation. Fill in real content from the extracted code metadata. Never invent function signatures or examples.
4
+
5
+ ---
6
+
7
+ ## Template 1: README.md
8
+
9
+ Use when the project has no README, or when asked to generate a fresh one.
10
+
11
+ ```markdown
12
+ # [Project Name]
13
+
14
+ [1-2 sentence description of what this project does. Derived from package.json description or the main entry file's module docstring.]
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ # Clone the repo
20
+ git clone <repo-url>
21
+ cd <project-name>
22
+
23
+ # Install dependencies
24
+ npm install # or: pip install -r requirements.txt
25
+
26
+ # Configure environment
27
+ cp .env.example .env
28
+ # Edit .env with your values
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```[language]
34
+ [Minimal working example derived from the entry point or test files]
35
+ ```
36
+
37
+ ## API Reference
38
+
39
+ [Generated from routes — see API Reference template below]
40
+
41
+ ## Configuration
42
+
43
+ | Variable | Required | Description |
44
+ |----------|----------|-------------|
45
+ | [from .env.example or config files] | | |
46
+
47
+ ## Scripts
48
+
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ [from package.json scripts or Makefile]
52
+
53
+ ## License
54
+
55
+ [from package.json or LICENSE file]
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Template 2: API Reference (docs/API.md)
61
+
62
+ Use for projects with HTTP routes. One entry per route.
63
+
64
+ ```markdown
65
+ # API Reference
66
+
67
+ Base URL: `https://api.yourdomain.com`
68
+
69
+ Authentication: [describe auth method if detected: Bearer token, API key header, etc.]
70
+
71
+ ---
72
+
73
+ ## [Resource Name]
74
+
75
+ ### [METHOD] [/path]
76
+
77
+ [Description from JSDoc or docstring if available; otherwise inferred from function name]
78
+
79
+ **Request**
80
+
81
+ | Parameter | Type | Required | Description |
82
+ |-----------|------|----------|-------------|
83
+ | [from function params, Zod schema, or Pydantic model] | | | |
84
+
85
+ **Request Body** (if POST/PUT/PATCH)
86
+
87
+ ```json
88
+ {
89
+ [derived from type definitions, Pydantic model, or Zod schema]
90
+ }
91
+ ```
92
+
93
+ **Response**
94
+
95
+ ```json
96
+ {
97
+ [derived from return type or response model]
98
+ }
99
+ ```
100
+
101
+ **Example**
102
+
103
+ ```bash
104
+ curl -X [METHOD] https://api.yourdomain.com[/path] \
105
+ -H "Authorization: Bearer YOUR_TOKEN" \
106
+ -H "Content-Type: application/json" \
107
+ -d '[request body if applicable]'
108
+ ```
109
+
110
+ ---
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Template 3: README Update (Sections Only)
116
+
117
+ Use when README already exists and only specific sections need updating.
118
+ Identify which sections are stale (missing routes, outdated function signatures) and regenerate only those. Preserve the rest verbatim.
119
+
120
+ Sections commonly stale after code changes:
121
+ - `## API Reference` — when routes are added or changed
122
+ - `## Configuration` — when new env vars are added
123
+ - `## Installation` — when dependencies change
124
+ - `## Quick Start` — when the entry point changes
125
+
126
+ ---
127
+
128
+ ## Rules for Filling Templates
129
+
130
+ 1. Document only exported functions and public routes. Skip private or internal helpers.
131
+ 2. Every code example must be runnable. If you cannot produce a real working example, write `[TODO: add example]` rather than inventing fake code.
132
+ 3. Route descriptions come from JSDoc or docstrings. If none exist, infer from the function or handler name only. Do not make up behaviour.
133
+ 4. Types come from the extraction output. Do not guess or invent type signatures.
134
+ 5. Keep descriptions factual. "Creates a user and returns the new record" is good. "Seamlessly manages your user lifecycle" is bad.
135
+ 6. Flag missing information explicitly. If a route has no docstring and an unclear name, write `[Description needed]` rather than hallucinating.