# Internal-Link & Metadata Fixes
Crawl a site's pages, spot broken or missing internal links and weak metadata (titles, meta descriptions), and produce a prioritized change list for a human to apply.

## When to use
- After a site crawl surfaces orphaned pages, broken internal links, or thin/duplicate metadata.
- Before a content or SEO (search engine optimization) audit deliverable is due.
- When a stakeholder asks for a list of quick-win metadata fixes ahead of a publishing cycle.
- When a new page needs to be linked in from relevant existing pages.

## Tools
- `browser-navigate`: opens each crawled page or sitemap URL to inspect its current state.
- `browser-extract`: pulls page title, meta description, header tags, and internal link targets from the loaded page.
- `write-file`: saves the prioritized change list (page, current metadata, proposed fix, link additions) as a CSV or markdown file.
- `send-message`: hands the finished change list to a human for review and manual application, since edits cannot be pushed live by this skill.

## Playbook
1. Get the target page list or sitemap URL set from the task input.
2. For each URL, load it with `browser-navigate`.
3. Use `browser-extract` to capture the page title, meta description, H1, and all internal link hrefs and anchor text.
4. Flag pages with missing or duplicate titles, meta descriptions over/under recommended length, or missing H1 tags.
5. Cross-reference extracted internal links across pages to find orphaned pages (no inbound links) and broken links (targets that returned an error when visited via `browser-navigate`).
6. For orphaned pages, identify 2-3 topically related pages that should link to them, and draft the anchor text and placement suggestion.
7. Compile all findings — current metadata, proposed metadata, and proposed link additions — into a single structured change list.
8. Write the change list to a file with `write-file`, using clear columns: page URL, issue type, current value, proposed value.
9. Notify the requester via `send-message` that the change list is ready, summarizing the count of metadata fixes and link additions, and note that a human must apply the changes since this skill cannot edit the live site.

## Failure modes
- 401/403 when loading a page -> the page may be gated or blocked; note it in the change list and escalate via `send-message` rather than guessing.
- Empty extraction result -> verify the URL loaded correctly and that the page structure matches expectations before retrying `browser-extract`.
- Rate limit or repeated navigation failures -> back off between requests and record the interruption in memory so the crawl can resume later.
- Page structure changed since the crawl was planned -> fall back to browser-search to locate the current page before continuing.

## Done when
- A change list file exists (via `write-file`) covering every flagged page with current and proposed metadata plus link suggestions.
- The requester has been notified via `send-message` with a summary count of fixes and a clear note that human action is required to publish them.