---
name: find-broken-links-and-missing-titles-with-claude-code
description: "Find broken links with Claude Code. Open Claude Code in an empty folder and paste the prompt below with your website address. It writes a small checker that reads your sitemap, visits each page, and."
---

# Find broken links with Claude Code

## When to use

Owners with a small business website who suspect it has broken pages or messy titles and do not want to pay for an audit tool to find out.

## Steps

1. Make an empty folder and open Claude Code in it in Manual mode (cd into the folder, then type claude --permission-mode manual).
2. Paste the prompt below with your website address. In Manual mode, Claude Code asks before it edits files or runs commands; approve after you read what it will do.
3. Open report.csv. Start with broken links (404) on your own site, then pages with no title, then duplicate titles.
4. Fix each one in your website builder: update or remove the broken link, and give each page its own short, descriptive title.
5. Run the check again and confirm the list is shorter. Rerun it once a month or after big changes.

## What to ask the user for

- YOUR WEBSITE ADDRESS

## Prompt

Fill the [BRACKETED] parts with the user, then follow this prompt:

```
My website is [YOUR WEBSITE ADDRESS]. Write a small script in this folder that checks it, then run it.

The script should:
1. Read the sitemap (try /sitemap.xml, then /sitemap_index.xml). If there is none, start from the home page and follow links on my own domain only, up to 200 pages.
2. Visit each page at most once, one at a time, with a short pause between requests.
3. On each page, record: the page address, its status code, its title, and every link on the page.
4. Check each link on my own domain and record any that do not load (status 400 or higher).
5. Write report.csv with: page, problem (broken link, missing title, duplicate title, page error), detail, and how to fix it in plain words.

Rules: only read public pages. Do not log in, submit forms or change anything. Do not check links to other websites unless I ask. When done, show me the count of each problem and the 10 worst pages.
```

## Guardrails

- Draft first and show the user. Never send, post, pay, book, cancel or delete without the user's explicit approval of that exact action.
- Use only facts the user gives you or that you can cite. If something is missing, ask instead of guessing.

## Common snags

- The site blocks the checker. Ask Claude Code to slow it down further, or check fewer pages.
- Hundreds of "duplicate title" rows from blog tag or archive pages. Ask it to group them so you fix the template once.
- A link works in your browser but shows as broken. Open it yourself before you change anything.
- With no sitemap, a broken link can show up twice in the report, once as a broken link and once as a page error. Count the broken addresses, not the rows.

## Tested

Ran with Claude Code in a cloud session, Nov 17, 2026, on a made-up 7-page site on a local server: the checker found the 2 broken links and the 2 missing titles. It passed with snags: with no sitemap it listed the 2 broken pages twice, and the same session built the site and the checker. A real website, Manual mode and fixing then rerunning were not tested.

The full receipt is on https://www.aisetupsthatwork.com/setups/find-broken-links-and-missing-titles-with-claude-code/

## Source

https://www.aisetupsthatwork.com/setups/find-broken-links-and-missing-titles-with-claude-code/ (AI Setups That Work)
