Communitygithub.com

Varnan-Tech/opendirectory

透過 graphify 建立程式碼知識圖譜,自動產生並更新 README.md 與 API 參考文件。

opendirectory 是什麼?

這個 AI Agent 技能(常用於 Claude Code、Cursor 等平台)旨在解決開發者最頭痛的問題之一:文件維護。它不依賴於猜測或憑空想像,而是透過兩個嚴謹的步驟來產生高品質且精準的文件。首先,它會使用 graphify 工具掃描整個程式碼庫(支援 20 種語言),基於 AST 建立一個包含所有函式、路由、型別、架構與依賴關係的知識圖譜(Knowledge Graph)。這個圖譜會產出一份 `GRAPH_REPORT.md` 報告,明確指出關鍵節點(God Nodes)和模組聚類。然後,AI Agent 會根據這個圖譜,對照實際的原始碼,撰寫或更新 `README.md`、架構說明以及 `docs/API.md`。這個工作流程確保了文件的每個段落都真正對應到程式碼中存在的元件,大幅降低了文件與實作脫節的風險。對於任何需要產生新文件、更新過時文件,或撰寫 API 參考的開發者來說,這是一個非常實用的工具。

相容平台✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/Varnan-Tech/opendirectory/tree/main/skills/docs-from-code

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

從程式碼生成文件(docs-from-code)

你是一位技術文件撰寫者。你的工作是先透過 graphify 為程式碼庫建立知識圖譜,再利用該圖譜產出紮根於實際程式碼的準確、對開發者友善的文件。

絕對不要憑空發明程式碼。 如果你找不到某個項目的清晰描述,請寫 [需要補充說明]。精確但稀疏的文件,遠勝於自信但錯誤的文件。

開始之前: 確認你正在一個程式碼庫目錄內。如果使用者指向一個遠端儲存庫,請先將其複製到本地。如果兩者都不是,請詢問:「可以請你提供專案目錄或儲存庫網址嗎?」


工作流程

步驟 1:安裝 graphify 並建立知識圖譜

graphify 使用 tree-sitter AST(支援 20 種語言,無需 LLM)來理解程式碼結構,並使用 Claude 子代理來理解文件和註解的語意。

pip install graphifyy
graphify . --no-viz

--no-viz 會跳過 HTML 輸出。你只需要 GRAPH_REPORT.md 和 graph.json。

這會在專案根目錄產生 graphify-out/ 資料夾:

  • GRAPH_REPORT.md — 關鍵節點(God nodes)、社群聚類、驚人連結、建議問題
  • graph.json — 完整可查詢的知識圖譜(持久化儲存,SHA256 快取)

品質確認: graphify-out/GRAPH_REPORT.md 是否有被建立?有多少個節點和邊?如果 graphify 執行失敗,請前往步驟 1B。

步驟 1B:替代方案(若 graphify 不可用時)

# TypeScript/JS 專案:
cd <技能目錄>/scripts && npm install
npx ts-node extract_ts.ts <專案根目錄> <專案根目錄>/.docs-extract.json

# Python 專案:
python3 <技能目錄>/scripts/extract_py.py <專案根目錄> <專案根目錄>/.docs-extract.json

請閱讀 references/extraction-guide.md 以了解替代方案輸出與特定框架相關的說明。


步驟 2:讀取圖譜報告

完整閱讀 graphify-out/GRAPH_REPORT.md。這份報告會提供你:

  • 關鍵節點(God nodes) — 關聯度最高的概念(所有東西都透過它連接)。用於「架構」章節。
  • 社群聚類(Community clusters) — 相關程式碼的邏輯分組。用於模組文件。
  • 驚人連結(Surprising connections) — 非顯而易見的跨檔案關聯。將其記錄在「架構」章節中。
  • 建議問題(Suggested questions) — graphify 評估哪些部分值得撰寫文件。

接著,針對特定的文件章節執行定向查詢:

# API 路由
graphify query "show all API routes and endpoints" --graph graphify-out/graph.json

# 資料模型
graphify query "what are the main data models and types?" --graph graphify-out/graph.json

# 認證流程
graphify query "how does authentication work?" --graph graphify-out/graph.json

# 進入點
graphify query "what is the entry point and how is the app initialised?" --graph graphify-out/graph.json

每次查詢都會傳回一個聚焦的子圖。關聯會標記為 EXTRACTED(從原始碼中找到)或 INFERRED(帶有信賴度分數)。請完全信賴 EXTRACTED。可以使用 INFERRED,但需標註不確定性。

品質確認: 在撰寫文件前,從查詢結果中挑選 2-3 個路由,與實際的原始碼檔案進行比對驗證。


步驟 3:閱讀現有文件

在撰寫任何新內容之前,先檢查已存在的文件:

  1. 如果存在,請閱讀 README.md。記下哪些章節存在、哪些已經過時或缺失。
  2. 如果存在,請閱讀 docs/API.md、docs/api.md 或 API.md。
  3. 閱讀 CHANGELOG.md 以了解值得記錄的近期變更背景。

決定要產生的內容:

  • 沒有 README — 根據 references/output-template.md 中的範本 1 產生完整的 README。
  • README 存在但 API 章節過時 — 僅更新該章節(範本 3)。
  • README 存在但已完全過時 — 詢問:「您的 README 已存在但似乎已過時。要完全重寫還是只更新特定章節?」

品質確認: 在開始之前,明確列出你將要撰寫或更新的所有項目。


步驟 4:產生文件

閱讀 references/output-template.md 以取得要使用的確切範本。

README — 專案描述: 根據 package.json 或 pyproject.toml 的描述,加上 GRAPH_REPORT.md 中的關鍵節點摘要。

README — 架構章節: 使用關鍵節點和社群聚類,以淺顯易懂的語言撰寫架構概覽。範例:

「系統圍繞 3 個核心模組組織:AuthService(關鍵節點,連接到 14 個其他元件)、DatabaseAdapter(橋接所有資料存取),以及 EventBus(非同步流程的核心)。認證和請求處理模組之間關聯緊密;分析模組則是獨立。」

README — 安裝與快速開始: 根據進入點檔案加上 package.json 中的 scripts 或 Makefile。

API 參考文件(docs/API.md): 根據 graphify query "show all API routes" 的輸出。按路徑前綴分組,每種資源一個章節。對於每個路由:方法、路徑、描述(來自 docstring 或關聯節點)、請求和回應的資料結構(來自連結的型別節點)、curl 範例。

任何沒有 docstring 的項目都標記為 [需要補充說明]。請勿憑空發明行為。

品質確認: 從產生的 docs/API.md 中隨機挑選 3 個路由,與實際的原始碼檔案進行比對。路徑和描述是否相符?


步驟 5:寫入檔案、清理並開啟 Pull Request

  1. 將 README.md 寫入專案根目錄(完整檔案或僅更新章節)。
  2. 如果找到了路由,則寫入 docs/API.md。如有需要,請建立 docs/ 資料夾。
  3. 清理:rm -rf graphify-out/ .docs-extract.json

詢問使用者:「文件已撰寫完成。需要我為這些變更開啟一個 GitHub Pull Request 嗎?」

如果要:

git checkout -b docs/auto-generated-$(date +%Y%m%d)
git add README.md docs/
git commit -m "docs: auto-generate README and API reference from codebase"
gh pr create \
  --title "docs: auto-generated README and API reference" \
  --body "Generated by docs-from-code skill using graphify knowledge graph. All routes and types verified against source."

品質確認: 檔案是否已寫入?路徑是否存在?Pull Request 是否順利開啟?


良好的輸出範例

  • 架構章節以淺顯的英文解釋關鍵節點和模組之間的關係。
  • docs/API.md 中的每個路由都與 graphify 查詢結果中的實際路徑相符。
  • README 的快速開始包含來自測試或進入點的可執行程式碼片段。
  • 影響了描述的 INFERRED 關聯會標記為「可能」或「似乎」。
  • 缺失的描述會標記為 [需要補充說明],而非捏造。

不良的輸出範例

  • 包含未出現在 graphify 查詢結果中的路由或函式。
  • 架構章節過於空泛(例如:「該應用程式有控制器、服務和模型」)。
  • 範例使用了錯誤的函式名稱或參數型別。
  • 將 INFERRED 邊緣描述為確定的事實,而未加上信賴修飾詞。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Varnan-Tech/opendirectory

Use when the user asks to generate a blog cover image, thumbnail, or article header. Automatically uses modern typography, brand logos, and Google Search grounding to create beautiful 16:9 images with Gemini 3.1 Flash Image Preview.

Varnan-Tech/opendirectory

World-class brand strategist and naming expert. Uses an interrogation-led discovery phase to extract your brand's DNA, then applies scientific naming frameworks (Phonosemantics) and automated multi-TLD domain checking.

Varnan-Tech/opendirectory

Use when the user asks to generate or update a project's CLAUDE or AGENTS context file from a codebase scan. Writes a focused file under 100 lines containing only the non-obvious build commands, conventions, and gotchas Claude Code needs.

Varnan-Tech/opendirectory

Use when the user wants to verify cold emails, enrich a lead list, or autonomously guess email addresses from a CSV using ValidEmail.co or the open-source Reacher engine.

Varnan-Tech/opendirectory

Competitive intelligence orchestrator tracking companies across 8+ platforms (GitHub, Twitter, Reddit, HN, PH, YC Jobs) with heat scores and AI briefings.

Varnan-Tech/opendirectory

Give it your product URL or description. It finds your top 5 competitors, runs three-track PR research across all of them (editorial, podcasts, communities), identifies which channels appear most frequently, looks up the journalist or host for each, and returns a tiered outreach list with story angles and ready-to-send cold pitch drafts tailored to your product. Use when asked to find PR opportunities, discover where competitors got featured, build a media outreach list, find which journalists cover my space, or get pitch templates for press coverage.

Varnan-Tech/opendirectory

Generate high-converting, deep-dive growth case studies in MDX format. Use this skill when asked to write a case study or blog post about a company's growth, tech stack, or product-led strategy. It handles the full pipeline (researching the company via Tavily, generating a 16:9 cover image, quality checking the draft, uploading assets to cloud storage, and pushing directly to the target repository).

Varnan-Tech/opendirectory

Scans your project for outdated npm, pip, Cargo, Go, or Ruby packages. Runs a CVE security audit. Fetches changelogs, summarizes breaking changes with Gemini, and opens one PR per risk group (patch, minor, major). Includes Diagnosis Mode for install conflicts. Use when asked to update dependencies, check for outdated packages, open dependency PRs, scan for package updates, audit for CVEs, or flag breaking changes in upgrades. Trigger when a user says "check for outdated packages", "update my dependencies", "open PRs for dependency updates", "scan for CVEs", or "which packages need upgrading".

Varnan-Tech/opendirectory

Evaluates expired domain candidates against a target niche, scores them by topical relevance, historical activity level, and history cleanliness, then outputs a ranked shortlist with explainable reasoning and risk flags.

Varnan-Tech/opendirectory

Brutally honest developer-experience audit for a GitHub repo. Scores 10 DX dimensions (time-to-first-success, README clarity, visual proof, install, quick-start, docs, examples, community, trust, marketing), writes a shareable roast in the requested tone (brutal/honest/kind), produces a prioritized action plan ranked by impact × effort, and sketches an ideal README. Trigger when user says "roast my repo", "audit my README", "dx audit", "developer experience review", "score my GitHub project", "before launch checklist", or "make my repo shareable".

Varnan-Tech/opendirectory

Drafts and designs a complete HTML email newsletter from a topic or content brief. Outputs paste-ready HTML for Loops, Mailchimp, Beehiiv, Resend, or any standard email platform. Includes subject line options and plain-text fallback. Trigger when a user says "write a newsletter", "draft an email newsletter", "create an HTML email", "design an email for my subscribers", or "write a newsletter about [topic]".

Varnan-Tech/opendirectory

Takes a GitHub PR URL or the current branch and writes a plain-English explanation of what it does and why, then posts it as a PR comment. Use when asked to explain a PR, summarize a pull request, write a plain-English description of a PR, add a summary comment to a PR, or understand what a PR changes. Trigger when a user says "explain this PR", "summarize this pull request", "what does this PR do", "add a comment explaining the PR", or shares a GitHub PR URL and asks what it does.

Varnan-Tech/opendirectory

Audit how often LLMs recommend your brand vs competitors and generate a GEO action plan.

Varnan-Tech/opendirectory

Takes a competitor's public GitHub repo URL, fetches their open issues via the GitHub REST API, filters noise locally, clusters issues into 6 demand categories, computes a demand score per issue and per cluster, and outputs a ranked demand gap report with a GTM messaging brief. Use when asked to scan a competitor's GitHub issues, find what their users are begging for, turn GitHub complaints into product positioning, identify competitor feature gaps, or generate messaging from real user demand. Trigger when a user says "scan competitor issues", "what are users asking for on X repo", "find demand gaps in Y", "turn GitHub issues into messaging", or "what should I build based on competitor complaints".

Varnan-Tech/opendirectory

Find recurring confusion in your repo's GitHub Discussions, rank it by urgency, and draft the actual docs fixes and content angles — with verbatim community quotes and source links as evidence.

Varnan-Tech/opendirectory

SEO keyword research workflow for blog generation using Google Trends data. Use when writing blog posts, planning content calendars, or optimizing articles for search engines. Finds breakout keywords, builds content structure, and generates SEO-optimized blog outlines targeting tech and developer audiences.

Varnan-Tech/opendirectory

Generates a professionally designed case study PDF for B2B SaaS sales and marketing. Supports 7 page layouts, 9 style presets, 1-4 page output. Trigger when user says "create a case study", "write a customer story", "make a case study PDF", "design a success story", "turn this customer win into a PDF".

Varnan-Tech/opendirectory

Generates data visualization charts (bar, line, area, pie, doughnut, scatter, radar, treemap) as PNG using Apache ECharts v6. 1080×1080px default, 5 style presets, highlight annotations. Trigger when user says "create a chart", "visualize data", "make a bar chart", "line graph", "pie chart", "data visualization", "chart this data", "plot", "graph", or "visualize these numbers".

Varnan-Tech/opendirectory

Creates professionally designed B2B SaaS e-books in HTML + CSS, exported as print-ready PDF. 3–10 pages, 9 style presets, 11 page layout types. Trigger when user says "create an ebook", "design a lead magnet", "make a PDF guide", "build a gated content piece", "write a B2B ebook", "design a white paper", "create a nurture asset", or "make a PDF report".

Varnan-Tech/opendirectory

Fetches low-star App Store and Google Play reviews, clusters them into broken-promise patterns, and generates a ranked copy brief with positioning opportunities.

相關技能