Install
openclaw skills install @jhauga/fix-broken-linksScan web files for broken hyperlinks and weak SEO anchor text, then interactively replace, strip, or skip each dead URL. Use when asked to find or fix broken links, check for dead links or 404s, audit hyperlinks, validate URLs, or flag generic anchor text ("click here", "read more") in HTML, Markdown, JS/TS, JSON, CSS, SQL, or template files.
openclaw skills install @jhauga/fix-broken-linksScans web files for broken hyperlinks and reports them. For each broken URL the
skill tries common spelling variations, optionally hands the link to the GitHub
Copilot CLI for suggested replacements, and presents an interactive fix menu.
Generic anchor text (click here, read more, etc.) is flagged as an SEO issue.
click here, here, read more) flagged for SEOcurl — HTTP status checks (the script exits quietly if absent)grep, sed — link extraction (standard on any POSIX system)scripts/link-fix.sh; on Windows use Git Bash or WSL, or run the
PowerShell 7+ port scripts/link-fix.ps1jq — optional; lets the bash script parse a JSON payload piped on stdingit — optional; used to discover changed files when no paths are passed (falls
back to a full repo scan)copilot (GitHub Copilot CLI) — optional; powers agent-suggested replacements.
Without it, only verified spelling variations are offered.The script has two modes:
git (or scans the
repo) and simply lists the broken links — no replacement lookups and no prompts.Links are found by scanning each file for http(s):// URLs, so the same logic
covers every format that embeds absolute URLs.
| Platform | Command |
|---|---|
| POSIX / Git Bash / WSL | bash scripts/link-fix.sh <files...> |
| Windows PowerShell 7+ | pwsh scripts/link-fix.ps1 <files...> |
Pass one or more web files to get the full repair flow (lookup + interactive menu):
bash scripts/link-fix.sh docs/guide.md index.html
pwsh scripts/link-fix.ps1 docs/guide.md index.html
Run with no arguments to report broken links in changed files only (no prompts):
bash scripts/link-fix.sh
For each broken URL the interactive menu offers:
| Key | Action |
|---|---|
r | Replace with the suggested URL (a working variation, or an agent-proposed alternative) |
1–9 | Replace with a numbered alternative |
d | Strip the link wrapper, keeping the visible text as plain text |
c | Enter a custom replacement URL |
s | Skip |
| Source | Examples matched |
|---|---|
| HTML | <a href>, <img src>, <script src>, <link href>, <iframe src> |
| Markdown | [text](url), [text][ref], bare <url> |
| JS / TS / Vue / Svelte | fetch(), XMLHttpRequest.open(), jQuery, axios, href:/url: props |
| JSON / JSONL | any string value that is an absolute URL |
| CSS | url(...) |
| SQL | URL literals in query strings |
| Templates | Jinja2, ERB, EJS, Handlebars, Pug |
The d (remove) action understands HTML <a> wrappers and Markdown [text](url)
links specifically, keeping the visible text. Other source types support
r (replace) and c (custom) via literal URL substitution.
http(s) URL, covering HTML,
Markdown, JS/TS, JSON, CSS, SQL, and templates at once Checking 2 link(s) in docs/guide.md ...
BROKEN (404) https://example.com/old-page
------------------------------------------------------------
SEO anchor issues (consider descriptive link text)
docs/guide.md: <a href="https://example.com/old-page">click here</a>
============================================================
fix-broken-links report
============================================================
[1] docs/guide.md
URL : https://example.com/old-page
HTTP: 404
r Replace -> https://example.com/docs/install
1 Replace -> https://example.com/docs/getting-started
d Remove link, keep text
c Custom replacement URL
s Skip
> r
replaced
1 file(s) updated:
docs/guide.md
With no file arguments (or when a file carries no checkable links) the script stops after the broken-link list — the menu above is skipped.
fix-broken-links/
├── SKILL.md This file
└── scripts/
├── link-fix.sh Bash implementation
└── link-fix.ps1 PowerShell 7+ port
http:// and https:// URLs; relative paths require a running servercopilot suggestions are enabled, broken URLs are sent to the Copilot service as prompt inputd (remove) action targets HTML and Markdown link syntax; bare URLs in code are best handled with r or c| Issue | Solution |
|---|---|
curl not found | Install curl; the script exits quietly without it |
| No replacement suggestions offered | Install the copilot CLI, or use c to enter a custom URL |
| PowerShell script blocked | Run with pwsh -File scripts/link-fix.ps1 or adjust the execution policy |
| Bash script not executable | Run via bash scripts/link-fix.sh or chmod +x scripts/link-fix.sh |