Communitygithub.com

Varnan-Tech/opendirectory

通过先构建代码库知识图谱,再基于图谱生成准确的 README.md 和 API 参考文档,避免编造不存在的代码。

opendirectory 是什么?

该技能(Skill)由 Varnan-Tech 提供,专为 AI 编程代理设计,用于自动化代码文档生成。其核心工作流程分为两步:首先使用 graphify 工具(基于 tree-sitter AST,支持 20 种编程语言,不依赖 LLM)扫描代码库,提取函数、路由、类型、架构等信息,生成知识图谱(graph.json)和图谱报告(GRAPH_REPORT.md)。然后,AI 代理会读取图谱报告,并通过 graphify 的查询功能获取指定内容(如 API 路由、数据模型、认证流程),基于这些精确的数据生成或更新 README.md 和 API 参考文档。它支持 Claude Code、Cursor、Codex 等主流 AI 代理平台,适用于任何语言的项目。该技能特别强调“不编造代码”,凡无法从代码中找到明确描述的部分,会标记为“[Description needed]”,确保文档准确但稀疏优于自信但错误。

兼容平台✓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 的新对话。

文档

代码生成文档

你是一名技术文档撰写者。你的任务是通过 graphify 先构建代码库的知识图谱,然后利用该图谱生成准确、对开发者友好的文档,所有内容都基于实际存在的代码。

不要编造代码。 如果你找不到某个内容的清晰描述,请写 [需要描述]。准确但简略的文档,好过自信但错误的文档。

开始前: 确认你已处于代码库目录中。如果用户指向了一个远程仓库,请先克隆它。如果两者都没有,请询问:“你能提供项目目录路径或仓库 URL 吗?”


工作流程

步骤 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 节点、社区聚类、意外连接、建议问题
  • graph.json — 完整的可查询知识图谱(持久化,SHA256 缓存)

质量检查: 是否生成了 graphify-out/GRAPH_REPORT.md?节点和边的数量是多少?如果 graphify 失败,请转到步骤 1B。

步骤 1B:备用方案(如果 graphify 不可用)

# TypeScript/JS 项目:
cd <skill-directory>/scripts && npm install
npx ts-node extract_ts.ts <项目根目录> <项目根目录>/.docs-extract.json

# Python 项目:
python3 <skill-directory>/scripts/extract_py.py <项目根目录> <项目根目录>/.docs-extract.json

阅读 references/extraction-guide.md 了解备用输出的框架特定说明。


步骤 2:读取图谱报告

完整阅读 graphify-out/GRAPH_REPORT.md。这将为你提供:

  • God 节点 — 度数最高的概念(一切连接的中心)。用于架构部分。
  • 社区聚类 — 相关代码的逻辑分组。用于模块文档。
  • 意外连接 — 非显而易见的跨文件关系。在架构部分中注明。
  • 建议问题 — graphify 认为值得记录的内容。

然后针对特定文档部分运行查询:

# API 路由
graphify query "显示所有 API 路由和端点" --graph graphify-out/graph.json

# 数据模型
graphify query "主要的数据模型和类型有哪些?" --graph graphify-out/graph.json

# 认证流程
graphify query "认证是如何工作的?" --graph graphify-out/graph.json

# 入口点
graphify query "入口点是什么?应用是如何初始化的?" --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 中的 god 节点摘要。

README — 架构部分: 使用 god 节点和社区聚类编写一个通俗易懂的架构概述。例如:

“系统围绕 3 个核心模块组织:AuthService(god 节点,连接到其他 14 个组件)、DatabaseAdapter(桥接所有数据访问)和 EventBus(异步流程的核心)。认证和请求处理模块耦合较紧;分析模块则独立。”

README — 安装与快速开始: 基于入口点文件以及 package.json 或 Makefile 中的 scripts。

API 参考文档(docs/API.md): 来自 graphify query "显示所有 API 路由" 的输出。每个资源一个章节,按路径前缀分组。对于每个路由:方法、路径、描述(来自文档注释或原理节点)、请求/响应结构(来自关联的类型节点)、curl 示例。

对任何没有文档注释的内容标记为 [需要描述]。不要编造行为。

质量检查: 从生成的 docs/API.md 中随机检查 3 条路由,与实际源文件对比。路径和描述是否匹配?


步骤 5:写入文件、清理并创建 PR

  1. 将 README.md 写入项目根目录(完整的文件或仅更新的部分)。
  2. 如果找到了路由,写入 docs/API.md。如果需要,创建 docs/ 目录。
  3. 清理:rm -rf graphify-out/ .docs-extract.json

询问用户:“文档已生成。需要我创建一个包含这些更改的 GitHub PR 吗?”

如果是:

git checkout -b docs/auto-generated-$(date +%Y%m%d)
git add README.md docs/
git commit -m "docs: 从代码库自动生成 README 和 API 参考文档"
gh pr create \
  --title "docs: 自动生成的 README 和 API 参考文档" \
  --body "由 docs-from-code 技能使用 graphify 知识图谱生成。所有路由和类型均已与源文件核实。"

质量检查: 文件是否写入成功?路径是否存在?PR 是否顺利创建?


什么样的输出算好

  • 架构部分用通俗语言解释了 god 节点和模块关系
  • 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.

相关技能