360 Secure SkillHub
360 安全技能中心

broken-link-checker

该 Skill 递归扫描指定目录中的 Markdown 文件,提取 Markdown 链接和裸 URL,通过 curl 检查 HTTP 状态码,按文件和行号报告断链及超时,并给出处理建议。

分类:效率
147258xuan
147258xuan
热度 2.64
最近更新 2026-11-13 18:44:10

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add 147258xuan/broken-link-checker
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
broken-link-checker
description
Scan documentation for broken links using curl. Use when validating markdown docs, checking for dead URLs, or before releasing documentation.

Broken Link Checker Skill

Checks for broken or invalid links in documentation and markdown files.

Usage

# Check current directory
node skills/broken-link-checker/index.js

# Check specific directory
node skills/broken-link-checker/index.js /path/to/docs

Features

  • Recursively scans all markdown files in a directory
  • Extracts both markdown-style links [text](url) and raw URLs
  • Uses curl to check HTTP status codes
  • Skips anchor links, relative paths, and non-HTTP URLs
  • Reports file location and line number for each broken link
  • Configurable timeout and retry logic

Output

=== Broken Link Checker ===
Target: /path/to/project
Time: 2026-06-07T09:26:39.852Z

Summary:
  Files scanned: 12
  Links found: 47
  Links checked: 38
  Broken links: 2
  Skipped: 9

Broken Links:
  docs/api.md:15
    URL: https://example.com/api/v2/users
    Status: 404
  README.md:42
    URL: https://old-docs.example.com/guides
    Status: ERROR: connect ETIMEDOUT

Recommendations:
  - Found 2 broken link(s) - fix or remove them

API

checkBrokenLinks(targetDir, options)

Returns check results object:

{
  timestamp: '2026-06-07T09:26:39.852Z',
  target: '/path/to/project',
  summary: {
    files_scanned: 12,
    links_found: 47,
    links_checked: 38,
    broken_links: 2,
    skipped_external: 9
  },
  files: [...],
  broken: [...],
  recommendations: [...]
}

When to Use

  • Before releasing documentation
  • During documentation reviews
  • In CI/CD pipelines for docs
  • Periodic link health checks
  • After migrating documentation to new URLs