Skip to content
OwnlyPlans

CLAUDE.md

Project rules for your AI tool. Put it in the empty project folder before step 1.

Part of Broken Link Checker (Python, nothing to install) by Admin

Download Open the item

Broken link checker

Rules

  • One file: linkcheck.py (tests in test_linkcheck.py). Python 3.10+.
  • Standard library only: urllib, html.parser, urllib.robotparser, concurrent.futures, json, html. No pip packages.
  • Crawl only pages on the start URL's host. Check outside links, never crawl them.
  • Respect robots.txt. Send our own User-Agent. Keep workers small (default 8) so we never hammer a site.
  • A link is ok for a final status of 200-399. Errors and timeouts are status 0 with a short reason. Never crash on one bad link.
  • Escape every value you put into HTML with html.escape.
  • Exit code: 1 if any link is broken, 0 if all links work.
  • If a site that opens in your browser shows CERTIFICATE_VERIFY_FAILED, fix the Python certificates (macOS: run "Install Certificates.command"; Windows: update Python from python.org). Never turn certificate checks off.

Commands

  • python linkcheck.py URL --list links on one page
  • python linkcheck.py URL crawl and report (--max-pages, --workers, --delay, --ignore PREFIX, --html, --json)
  • python -m unittest run the tests
Source, 16 lines
# Broken link checker

## Rules
- One file: `linkcheck.py` (tests in `test_linkcheck.py`). Python 3.10+.
- Standard library only: urllib, html.parser, urllib.robotparser, concurrent.futures, json, html. No pip packages.
- Crawl only pages on the start URL's host. Check outside links, never crawl them.
- Respect robots.txt. Send our own User-Agent. Keep workers small (default 8) so we never hammer a site.
- A link is ok for a final status of 200-399. Errors and timeouts are status 0 with a short reason. Never crash on one bad link.
- Escape every value you put into HTML with `html.escape`.
- Exit code: 1 if any link is broken, 0 if all links work.
- If a site that opens in your browser shows CERTIFICATE_VERIFY_FAILED, fix the Python certificates (macOS: run "Install Certificates.command"; Windows: update Python from python.org). Never turn certificate checks off.

## Commands
- `python linkcheck.py URL --list`  links on one page
- `python linkcheck.py URL`  crawl and report (`--max-pages`, `--workers`, `--delay`, `--ignore PREFIX`, `--html`, `--json`)
- `python -m unittest`  run the tests

Your AI tool
Starter prompt

		

Download the plan