Cursor Skill

fixing-broken-links

Crawl all links in a file or project, test each for a valid HTTP response, report broken ones, and fix or remove them.

LLM Mart · 0 points · 22 views 1 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download spencerpauly-awesome-cursor-skills-resources_fixing-broken-links-99cd265.zip · 1 KB
Part of spencerpauly/awesome-cursor-skills — 65 skills

Install

skills CLI npx skills add https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/fixing-broken-links
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install spencerpauly-awesome-cursor-skills@llmmart
Git git clone https://github.com/spencerpauly/awesome-cursor-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole spencerpauly/awesome-cursor-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Fixing Broken Links

Scan a file (or set of files) for URLs, test every link, and fix any that are broken.

Workflow

1. Extract All Links

Read the target file(s) and collect every URL:

  • Markdown links: [text](url)
  • Bare URLs: https://...
  • HTML href and src attributes
  • Reference-style link definitions: [id]: url
  • Local relative paths: ./path/to/file, resources/foo/SKILL.md

2. Test Each Link

For external URLs:

  • Use curl -sL -o /dev/null -w "%{http_code}" --max-time 10 "<url>" to get the HTTP status code
  • Batch independent checks for speed (run multiple curl commands in parallel or in quick succession)
  • Classify results:
    • 200299 → OK
    • 301/302 → OK but note the redirect target
    • 403 → Might be valid (some sites block curl); try with a browser user-agent header
    • 404 → Broken
    • 429 → Rate limited; retry once after a short pause
    • 000 or timeout → Retry once; if still failing, mark as unreachable

For local file paths:

  • Check if the file exists on disk with [ -f "path" ]
  • If it's a relative path, resolve it from the file's directory

3. Fix Broken Links

For each broken link:

  1. Search the web for the correct/current URL (the resource may have moved)
  2. If found, replace the old URL with the new one
  3. If the resource no longer exists, note it and either:
    • Remove the link and leave the text
    • Comment it out with a note
    • Replace with an archived version (web.archive.org)

4. Report

Produce a summary table:

| URL | Status | Action |
|-----|--------|--------|
| https://example.com/page | 200 | OK |
| https://old.example.com/moved | 404 → 301 | Updated to https://new.example.com/page |
| ./docs/missing.md | MISSING | Removed link |

Tips

  • For large files with many links, batch curl calls to avoid slowdowns
  • Some sites (GitHub, npm) rate-limit aggressively — space out requests
  • Always re-read the file after making changes to confirm replacements didn't break formatting
  • For Markdown files, verify link syntax is preserved: [text](url) not [text]( url ) (no extra spaces)
Files (awesome-cursor-skills)
  • SKILL.md 2.3 KB
    ---
    name: fixing-broken-links
    description: Crawl all links in a file or project, test each for a valid HTTP response, report broken ones, and fix or remove them.
    user-invocable: true
    ---
    
    # Fixing Broken Links
    
    Scan a file (or set of files) for URLs, test every link, and fix any that are broken.
    
    ## Workflow
    
    ### 1. Extract All Links
    
    Read the target file(s) and collect every URL:
    - Markdown links: `[text](url)`
    - Bare URLs: `https://...`
    - HTML `href` and `src` attributes
    - Reference-style link definitions: `[id]: url`
    - Local relative paths: `./path/to/file`, `resources/foo/SKILL.md`
    
    ### 2. Test Each Link
    
    **For external URLs:**
    - Use `curl -sL -o /dev/null -w "%{http_code}" --max-time 10 "<url>"` to get the HTTP status code
    - Batch independent checks for speed (run multiple curl commands in parallel or in quick succession)
    - Classify results:
      - `200`–`299` → OK
      - `301`/`302` → OK but note the redirect target
      - `403` → Might be valid (some sites block curl); try with a browser user-agent header
      - `404` → Broken
      - `429` → Rate limited; retry once after a short pause
      - `000` or timeout → Retry once; if still failing, mark as unreachable
    
    **For local file paths:**
    - Check if the file exists on disk with `[ -f "path" ]`
    - If it's a relative path, resolve it from the file's directory
    
    ### 3. Fix Broken Links
    
    For each broken link:
    1. Search the web for the correct/current URL (the resource may have moved)
    2. If found, replace the old URL with the new one
    3. If the resource no longer exists, note it and either:
       - Remove the link and leave the text
       - Comment it out with a note
       - Replace with an archived version (web.archive.org)
    
    ### 4. Report
    
    Produce a summary table:
    
    ```
    | URL | Status | Action |
    |-----|--------|--------|
    | https://example.com/page | 200 | OK |
    | https://old.example.com/moved | 404 → 301 | Updated to https://new.example.com/page |
    | ./docs/missing.md | MISSING | Removed link |
    ```
    
    ## Tips
    
    - For large files with many links, batch curl calls to avoid slowdowns
    - Some sites (GitHub, npm) rate-limit aggressively — space out requests
    - Always re-read the file after making changes to confirm replacements didn't break formatting
    - For Markdown files, verify link syntax is preserved: `[text](url)` not `[text]( url )` (no extra spaces)
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related