agentleFS
AtmoskunAtmoskun/claude-skills/skills/link/SKILL.md

link

Skill0 starsChanged 9 months agoMITView on GitHub

自动链接器 - 扫描 Vault 笔记,自动添加 [[wikilinks]],发现孤立笔记,增强知识图谱连接度

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

/link - 自动链接器

扫描 Obsidian Vault 中的笔记,发现未链接的实体引用(ticker、公司名、概念),自动或半自动添加 [[wikilinks]],增强知识图谱的连接度。

Instructions for Claude

实体字典构建: 执行前先扫描 Vault 构建可链接实体字典:

  1. 所有 .md 文件的文件名(去掉扩展名)→ 可链接目标
  2. 研究/研究笔记/ 中的 TICKER(从文件名提取)
  3. 研究/财报分析/ 子目录名
  4. 写作/技术概念/ 中的概念名
  5. 导航/MOC/ 中的主题名

链接规则:

  • 只链接首次出现(每篇笔记中同一实体只链接第一次提及)
  • 不在 frontmatter 中添加链接
  • 不在代码块中添加链接
  • 不在已有链接中嵌套链接(如 [[NVDA]] 内部不再链接)
  • 不修改 URL 中的文本
  • 保守策略:只链接确切匹配,不做模糊匹配

操作模式:

  • 预览模式(默认):只报告发现,不修改文件
  • 交互模式 (--apply):逐个确认后修改
  • 自动模式 (--auto):自动应用所有高置信度链接

When to Use This Skill

  • 用户使用 /link 命令
  • 用户说"帮我添加链接"、"连接笔记"
  • 用户想提高 Vault 的知识图谱质量

Core Workflow

输入:文件夹名或 --all
       ↓
[1] 构建实体字典
    • 扫描所有文件名 → 实体列表
    • 提取 tickers, 公司名, 概念名
    • 构建别名映射(NVDA → [[NVDA_2026-02-05|NVDA]], 英伟达 → [[NVDA_2026-02-05|英伟达]])
       ↓
[2] 扫描目标文件
    • 读取每篇笔记正文
    • 查找未链接的实体提及
    • 记录:文件、行号、原文、建议链接
       ↓
[3] 输出报告(预览模式)
    • 按文件分组列出发现
    • 统计:可添加的链接数、孤立笔记数
       ↓
[4] 应用链接(--apply 或 --auto 模式)
    • 逐个或批量修改文件
    • 使用 Edit 工具精确替换
       ↓
[5] 报告结果
    • 已添加的链接数
    • 孤立笔记列表
    • 建议创建的新笔记

Quick Start

/link                           # 预览全 Vault 的链接机会(不修改文件)
/link 信息源/播客                # 只扫描播客文件夹
/link 周会                       # 只扫描周会文件夹
/link --apply                   # 交互模式,逐个确认
/link --auto                    # 自动应用高置信度链接
/link orphans                   # 只列出孤立笔记
/link stats                     # Vault 链接统计

输出格式

预览模式输出(终端)

🔗 Link Opportunities Report
============================

📂 信息源/播客/ (12 files with opportunities)

  The Hidden Economics Powering AI.md:
    Line 26: "...marked by a 99% cost reduction..."
      → NVDA (mentioned in context of GPU) → [[NVDA_2026-02-05|NVDA]]
    Line 30: "...Google five and a half times..."
      → GOOGL → [[会议实录 2026-01-03|GOOGL]] (周会中有讨论)


  #407.拆解华为算力真相与中芯困局.md:
    Line 15: "...华为..." → 无匹配笔记(建议创建)
    Line 22: "...中芯国际..." → 无匹配笔记(建议创建)

📂 周会/ (8 files with opportunities)

  会议实录 2026-01-03.md:
    Line 48: "TSM" → [[研究/研究笔记/TSM]] (如果存在)
    Line 52: "美光(Micron)" → 无匹配笔记

────────────────────────────
📊 Summary:
  Files scanned: 150
  Link opportunities found: 87
  High confidence: 45 (auto-applicable)
  Medium confidence: 30 (need review)
  Low confidence: 12 (skipped)

  Orphan notes: 15 (no incoming/outgoing links)
  Suggested new notes: 8 (frequently mentioned, no note exists)

孤立笔记报告

🏝️ Orphan Notes (15)
====================

| 笔记 | 文件夹 | 创建日期 | 建议操作 |
|------|--------|----------|---------|
| Docker.md | 写作/技术概念 | 2026-02-05 | 添加到相关技术笔记 |
| 2026-01-23 - Daily Checklist.md | 收件箱 | 2026-01-23 | 处理或归档 |
| ... | | | |

Vault 链接统计

📊 Vault Link Stats
===================

| 文件夹 | 文件数 | 有出链 | 有入链 | 平均链接数 | 孤立 |
|--------|--------|--------|--------|-----------|------|
| 研究/研究笔记 | 1 | 1 | 0 | 5 | 0 |
| 周会 | 42 | 0 | 3 | 0 | 39 |
| 信息源/播客 | 58 | 0 | 0 | 0 | 58 |
| 收件箱 | 88 | 5 | 0 | 0.1 | 83 |
| 写作/技术概念 | 1 | 1 | 2 | 3 | 0 |

Commands Reference

# 扫描
/link                          # 预览全 Vault(默认)
/link {folder}                 # 扫描指定文件夹
/link --all                    # 扫描全 Vault

# 应用
/link --apply                  # 交互模式(逐个确认)
/link --auto                   # 自动应用高置信度
/link {folder} --apply         # 对指定文件夹应用

# 分析
/link orphans                  # 列出孤立笔记
/link stats                    # Vault 链接统计
/link suggest                  # 建议创建的新笔记

别名映射

常见实体的别名映射(自动检测):

实体别名
NVDANvidia, NVIDIA, 英伟达
GOOGLGoogle, Alphabet, 谷歌
MSFTMicrosoft, 微软
UBERUber
TSMTSMC, 台积电
AAPLApple, 苹果

对于中文 ticker(如 600519.SH → 贵州茅台 → 茅台),也建立别名表。

与其他 Skills 的关系

Skill关系
/moclink 发现的关系可以补充 MOC
/podcast处理后的播客笔记需要 link
/learn技术概念已有良好的链接模式,可作为范例
/vault-healthlink stats 是 vault health 的一部分

注意事项

  • 使用 Grep 和 Read 工具,不使用 bash grep
  • 大 Vault 扫描可能需要较长时间,分批处理
  • 保守策略:宁可漏掉也不要错误链接
  • 不修改文件的其他内容,只添加 [[]] 括号
  • 处理后建议运行 /link stats 验证效果
  • 中英文混合内容都要处理

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.