Communitygithub.com

Varnan-Tech/opendirectory

當使用者要求從程式碼掃描生成或更新專案的 CLAUDE 或 AGENTS 上下文檔案時使用。會撰寫一份聚焦於 100 行以內的檔案,僅包含 Claude Code 所需的非顯而易見建置指令、慣例與注意事項。

opendirectory 是什麼?

這項技能可自動為 Claude Code 等 AI 代理生成精簡的 CLAUDE.md 上下文檔案,確保檔案長度小於 100 行,僅記錄無法從程式碼本身推斷的資訊,例如建置指令、非預設的程式碼風格、測試設定與常見陷阱。它支援建立、更新與稽核三種模式:稽核模式會根據清晰度、完整性與行數等標準,為專案中所有 CLAUDE.md 檔案評分(A-F);建立或更新模式則會掃描專案結構、提取建置與測試指令、偵測自動產生檔案、環境變數與匯入別名等關鍵資訊,再透過 Gemini API 產生草稿,並在寫入前要求使用者確認。這項工具特別適合維護大型或多儲存庫專案的團隊,可確保 AI 代理取得一致且最新的上下文,避免重複或過時的提示內容。

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

在你喜歡的 AI 中提問

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

說明文件

CLAUDE.md 產生器

讀取程式碼庫。撰寫一份恰如其分、只告訴 Claude 所需資訊的 CLAUDE.md。


關鍵規則: 好的 CLAUDE.md 應少於 100 行。只包含 Claude 無法從閱讀程式碼本身推斷出的資訊。請勿自動寫入檔案:務必先顯示草稿,等待使用者核准。

程式碼片段規則: 絕對不要在 CLAUDE.md 中包含行內程式碼範例。請改用 file.ts:42 的引用方式。CLAUDE.md 中的程式碼會浪費 token 且容易過期。


步驟 1:偵測模式

判斷要執行哪一種模式:

create:無 CLAUDE.md 存在。從頭撰寫一份。 update:CLAUDE.md 已存在。在不丟棄自訂內容的前提下改進它。 audit:為專案中所有 CLAUDE.md 檔案評分(A-F)並產出品質報告。如果使用者說「稽核」、「檢查」、「審查」或「評分」我的 CLAUDE.md,則執行稽核模式。

# 找出所有 CLAUDE.md 的位置
find . -name "CLAUDE.md" -not -path "*/node_modules/*" -not -path "*/.git/*" 2>/dev/null
ls ~/.claude/CLAUDE.md 2>/dev/null && echo "找到全域 CLAUDE.md"
ls .claude.local.md 2>/dev/null && echo "找到 .claude.local.md"

如果找到多個 CLAUDE.md:列出它們。詢問:「在 [位置] 找到 CLAUDE.md。我應該全部更新,還是只更新 [根目錄]?」


步驟 2:稽核模式(若為建立/更新則跳至步驟 3)

針對每個找到的 CLAUDE.md,使用下列評分標準評分(A-F):

標準檢查項目
指令建置/測試/lint 指令是否存在且可執行?
架構是否說明了非顯而易見的結構?
非顯而易見的模式是否記錄了注意事項、自動產生檔案、環境變數順序?
簡潔性少於 100 行?沒有明顯的填充內容?
時效性指令是否仍與目前的 package.json/Makefile 相符?
可操作性新貢獻者是否能在不發問的情況下依此操作?

分數:90-100 = A,70-89 = B,50-69 = C,30-49 = D,0-29 = F

以表格呈現:

## CLAUDE.md 稽核報告

| 檔案 | 分數 | 等級 | 主要問題 |
|------|-------|-------|-----------|
| ./CLAUDE.md | 72 | B | 缺少注意事項區段,測試指令過時 |
| ./packages/api/CLAUDE.md | 45 | D | 無指令,340 行(太長),過時的架構筆記 |

**總體:B (72/100)**

發現的問題:
- ./packages/api/CLAUDE.md:340 行:遠超過 100 行目標
- ./packages/api/CLAUDE.md:測試指令參考 `jest`,但 package.json 使用 `vitest`
- ./CLAUDE.md:缺少注意事項區段:最有價值的區段遺失了

報告結束後,詢問:「要我修復其中任何一個嗎?(全部 / 僅根目錄 / 指定)」

如果使用者說「是」,針對他們想要修復的每個檔案,繼續執行步驟 3。


步驟 3:掃描專案結構

# 專案類型和套件管理器
ls package.json yarn.lock pnpm-lock.yaml bun.lockb requirements.txt pyproject.toml Cargo.toml go.mod 2>/dev/null

# 頂層目錄結構
find . -maxdepth 2 -type d \
  | grep -v node_modules | grep -v .git | grep -v __pycache__ \
  | grep -v ".next" | grep -v dist | grep -v build | sort

步驟 4:提取建置和測試指令

# npm/yarn/pnpm/bun 腳本
cat package.json 2>/dev/null \
  | python3 -c "
import sys, json
d = json.load(sys.stdin)
for name, cmd in d.get('scripts', {}).items():
    print(f'{name}: {cmd}')
"

# Python、Go、Rust Makefile
cat Makefile 2>/dev/null | grep -E "^[a-z].*:" | head -20

# Go
cat go.mod 2>/dev/null | head -5

# Rust
cat Cargo.toml 2>/dev/null | grep -E "^\[" | head -10

識別出下列項目的確切指令:建置、測試(全部)、測試(單一檔案/名稱)、開發伺服器、lint/型別檢查。注意執行它們所需的任何環境變數。


步驟 5:尋找程式碼風格與注意事項

# 匯入別名(最常被忽略)
python3 -c "
import json, sys
try:
    d = json.load(open('tsconfig.json'))
    paths = d.get('compilerOptions', {}).get('paths', {})
    if paths: print('匯入別名:', json.dumps(paths, indent=2))
except: pass
" 2>/dev/null

# 所需的環境變數
cat .env.example 2>/dev/null | grep -v "^#" | grep -v "^$" | head -20

# 自動產生的檔案(禁止編輯)
find . -path "*/node_modules" -prune -o -name "*.ts" -print \
  | xargs grep -l "DO NOT EDIT\|@generated\|Generated by" 2>/dev/null | head -5

# 測試設定需求
cat jest.config.js jest.config.ts vitest.config.ts 2>/dev/null | head -30

# 資料庫/遷移設定
ls migrations/ prisma/ drizzle/ db/ 2>/dev/null

構成注意事項的項目(包含這些,跳過其他所有項目):

  • 自動產生的檔案(禁止編輯)
  • 測試執行前所需的環境變數
  • 非預設的匯入別名對應
  • 需要執行中服務的測試指令
  • 已知的刻意怪癖(因應措施,非錯誤)

步驟 6:使用 Gemini 產生 CLAUDE.md 草稿

彙整所有發現,產生草稿:

cat > /tmp/claude-md-request.json << 'ENDJSON'
{
  "system_instruction": {
    "parts": [{
      "text": "為一個軟體專案撰寫 CLAUDE.md 檔案。規則:(1) 總行數少於 100。 (2) 只包含 Claude 無法從閱讀程式碼推斷的內容。 (3) 無行內程式碼範例:改用 file.ts:42 的引用方式。 (4) 區段:指令、程式碼風格(僅非預設項目)、測試(僅需設定時)、注意事項(必要:最易出錯之處)。若某區段沒有任何非顯而易見的內容可寫,則跳過。 (5) 所有指令放在程式碼區塊中。 (6) 建議順序:簡短專案概述(1-2 句,僅在非顯而易見時)、指令、架構(僅非顯而易見的結構)、程式碼風格、測試、注意事項。 (7) 不要使用 em dash。 (8) 只輸出 CLAUDE.md 內容,無註解。"
    }]
  },
  "contents": [{
    "parts": [{
      "text": "PROJECT_ANALYSIS_HERE"
    }]
  }],
  "generationConfig": {
    "temperature": 0.3,
    "maxOutputTokens": 2048
  }
}
ENDJSON

curl -s -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @/tmp/claude-md-request.json \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['candidates'][0]['content']['parts'][0]['text'])"

將 PROJECT_ANALYSIS_HERE 替換為步驟 3-5 的發現。

對於大型專案(50 個以上檔案): 在 CLAUDE.md 底部加入 @path 指標,而非行內細節:

## 延伸參考
詳見 @docs/ai-context/architecture.md 取得完整的模組對應。
詳見 @docs/ai-context/testing.md 取得整合測試設定細節。

將無法容納於 100 行內的詳細資訊,寫入 docs/ai-context/ 的參考檔案中。


步驟 7:自我品質確認

在呈現草稿前,檢查:

  • 少於 100 行(計數:echo "$CONTENT" | wc -l)
  • 無行內程式碼範例(僅有 file.ts:42 引用或 shell 指令)
  • 所有指令放在程式碼區塊中,且可直接執行
  • 注意事項區段存在,且至少包含一個真實條目
  • 沒有僅包含從檔案中即可明顯看出之內容的區段
  • 沒有 em dash
  • 沒有行銷用語或填充詞句(「此專案使用 React 來...」)
  • 若存在匯入別名,則已記錄
  • 若存在自動產生的檔案,則已標示「禁止編輯」

如有任何檢查未通過,請先修正再呈現。


步驟 8:呈現草稿並等待核准

未經使用者核准,絕不寫入檔案。

將草稿呈現在程式碼區塊中:

## CLAUDE.md 草稿([N] 行)

[完整草稿內容於此]

---
是否寫入 CLAUDE.md?(yes / edit first / cancel)

如果使用者說 yes:寫入檔案,然後確認:「CLAUDE.md 已寫入([N] 行)。區段:[列出所有 ## 標頭]。」

如果使用者說 edit first:套用他們的編輯,重新顯示草稿。

如果使用者說 cancel:停止。


不要包含的內容

  • 語言/框架版本(「這是一個 TypeScript 專案」)
  • 框架如何運作(Claude 已經知道 React、FastAPI 等)
  • 所有依賴項的清單
  • lint 工具已強制執行的風格規則(縮排大小、引號風格)
  • 與 README.md 重複的內容
  • 行內程式碼範例或多行程式碼片段
  • 任何使用相同技術棧的專案都會相同的內容

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 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

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.

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.

相關技能