check-links
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCheck Links Skill
检查链接Skill
Finds broken across your vault by extracting link targets and verifying that each target file exists. Read-only — never modifies files.
[[wiki-links]]通过提取链接目标并验证每个目标文件是否存在,查找你的知识库(vault)中所有失效的。只读模式——绝不会修改文件。
[[wiki链接]]Usage
使用方法
/check-linksOr ask:
- "Check for broken links in my vault"
- "Find dead wiki-links"
- "Are there any broken links?"
/check-links或者提问:
- "检查我的知识库中的失效链接"
- "查找失效的wiki链接"
- "有没有失效的链接?"
How to Execute
执行步骤
Step 1: Extract all wiki-links
步骤1:提取所有wiki链接
Use Grep to find all patterns in markdown files:
[[...]]Grep:
pattern: "\\[\\[([^\\]|]+)"
glob: "*.md"
output_mode: content
-n: trueThis captures the link target (before any alias). Exclude and directories from results.
|.claude/.obsidian/使用Grep在markdown文件中查找所有模式:
[[...]]Grep:
pattern: "\\[\\[([^\\]|]+)"
glob: "*.md"
output_mode: content
-n: true这会捕获链接目标(在任何别名之前的部分)。从结果中排除和目录。
|.claude/.obsidian/Step 2: Build unique target list
步骤2:构建唯一目标列表
From the grep results, extract the unique link targets. For each match like or , the target is .
[[My Note]][[My Note|display text]]My NoteStrip:
- Heading anchors: → target is
[[Note#heading]]Note - Block references: → target is
[[Note^block-id]]Note - Aliases: → target is
[[Note|alias]]Note
从Grep结果中提取唯一的链接目标。对于像或这样的匹配项,目标是。
[[My Note]][[My Note|显示文本]]My Note去除:
- 标题锚点:→ 目标为
[[Note#heading]]Note - 块引用:→ 目标为
[[Note^block-id]]Note - 别名:→ 目标为
[[Note|别名]]Note
Step 3: Verify each target exists
步骤3:验证每个目标是否存在
For each unique target, use Glob to check if a matching file exists:
Glob:
pattern: "**/<target>.md"A link is broken if no file matches. A link is valid if at least one file matches.
对于每个唯一目标,使用Glob检查是否存在匹配的文件:
Glob:
pattern: "**/<target>.md"如果没有匹配的文件,则链接失效。如果至少有一个文件匹配,则链接有效。
Step 4: Report results
步骤4:生成结果报告
Group broken links by source file:
markdown
undefined按源文件分组显示失效链接:
markdown
undefinedBroken Links Report
失效链接报告
Daily Notes/2024-01-15.md
Daily Notes/2024-01-15.md
- [[Projet Alpha]] — no matching file found
- [[Old Goal]] — no matching file found
- [[Projet Alpha]] — 未找到匹配文件
- [[Old Goal]] — 未找到匹配文件
Projects/Project Beta.md
Projects/Project Beta.md
- [[Meeting Notes Jan]] — no matching file found
Summary: 3 broken links across 2 files (out of 45 total links checked)
undefined- [[Meeting Notes Jan]] — 未找到匹配文件
摘要: 2个文件中存在3个失效链接(共检查45个链接)
undefinedStep 5: Suggest fixes
步骤5:建议修复方案
For each broken link, try to find a close match:
- Use Glob with a partial pattern:
**/*<partial-target>*.md - If a similar filename exists, suggest it:
- [[Projet Alpha]] — Did you mean [[Project Alpha]]? - If no close match, just report "no matching file found"
对于每个失效链接,尝试查找近似匹配项:
- 使用带部分模式的Glob:
**/*<partial-target>*.md - 如果存在相似文件名,建议替换:
- [[Projet Alpha]] — 你是不是想找 [[Project Alpha]]? - 如果没有近似匹配项,仅报告“未找到匹配文件”
Edge Cases
边缘情况
- Embedded images () — skip these, they reference attachments
![[image.png]] - External links () — skip these, they are not wiki-links
[text](https://...) - Template placeholders () — skip anything with
[[{{date}}]]in the target{{ - Empty links () — report as malformed, not broken
[[]]
- 嵌入图片 () — 跳过这些,它们引用的是附件
![[image.png]] - 外部链接 () — 跳过这些,它们不是wiki链接
[text](https://...) - 模板占位符 () — 跳过目标中包含
[[{{date}}]]的链接{{ - 空链接 () — 报告为格式错误,而非失效
[[]]
No Broken Links
无失效链接
If all links are valid:
✅ All wiki-links verified — no broken links found across X files (Y links checked)如果所有链接都有效:
✅ 所有wiki链接已验证——在X个文件中未找到失效链接(共检查Y个链接)Tips
小贴士
- Run periodically to catch link rot
/check-links - After renaming files, run this to find links that need updating
- Combine with to find notes that reference deleted content
/search
- 定期运行以避免链接失效
/check-links - 重命名文件后,运行此工具查找需要更新的链接
- 与结合使用,查找引用已删除内容的笔记
/search