# canonical-tag

Audits duplicate pages across scheme, host, slashes and tracking parameters, then says where a redirect belongs and where a canonical does.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1100 installs · ★ 1062
- Author: kostja94
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/kostja94/marketing-skills/tree/HEAD/skills/seo/technical/canonical/SKILL.md
- Updated: 2026-10-26
- HTML: https://affpapa.org/en/nevibecode/skills/canonical-tag

## What it does

This skill runs a canonicalization audit. It groups URL variants that expose the same page: http against https, www against the bare host, a trailing slash against none, doubled slashes in the path, directory defaults such as `index.html`, legacy `.html` extensions, letter case, and UTM or click-id parameters that leave the content untouched.

It then checks whether the signals agree. Redirect targets, the `rel="canonical"` value, in-site links, sitemap entries and `hreflang` addresses all get compared for each preferred URL. Every duplicate cluster gets one method: a permanent redirect, a canonical annotation, a separate page, or a decision left to you. Fixes are placed in the layer that owns the behaviour — CDN or reverse proxy for host and scheme, server or router for paths, page metadata for canonicals.

Similar-looking URLs are not automatically duplicates. Case, parameters and extensions can point at genuinely different resources, so the skill asks you to compare server responses and primary content first. Auditing stays read-only; redirects on production, DNS changes and indexing controls wait for your approval. Naming and hierarchy design live in a separate skill, `url-structure`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add kostja94/marketing-skills --skill canonical-tag -a claude-code
```
```bash
npx skills add kostja94/marketing-skills --skill canonical -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/canonical/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/canonical/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add kostja94/marketing-skills --skill canonical -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/canonical/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add kostja94/marketing-skills --skill canonical -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/canonical/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install kostja94/marketing-skills canonical
```

2. **Manually: put the files in place**
- File: `.github/skills/canonical/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add kostja94/marketing-skills --skill canonical -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/kostja94/marketing-skills --path skills/seo/technical/canonical
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/canonical/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add kostja94/marketing-skills --skill canonical -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/kostja94/marketing-skills/tree/HEAD/skills/seo/technical/canonical/SKILL.md

## When to use it
- collapse http and https versions of a page into one URL
- remove duplicates caused by www and non-www hosts
- clean up doubled slashes in paths
- cross-check canonical tags against sitemap and internal links
- decide what to do with UTM-tagged page URLs

## Example prompts
- Audit canonicalization on this site: collect the URL variants and tell me where to redirect and where to use a canonical
- We have duplicates from www and trailing slashes — build the test matrix and a fix plan
- Check canonical, sitemap and hreflang for these pages and show me the mismatches

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 47e711a59037761c.

BEGIN THIRD-PARTY FILE 47e711a59037761c
```text
---
name: canonical-tag
description: Audit and fix duplicate-page canonicalization across protocol, host, slash, default-document, extension, case, and tracking-parameter URL variants. Use for canonical URLs, duplicate content, preferred URLs, URL consolidation, or conflicting canonical signals. For URL naming and hierarchy design, use url-structure.
metadata:
  version: 1.1.0
---

# SEO Technical: Canonicalization

Determine the preferred URL for each page identity, consolidate duplicate variants, and verify that redirects, canonical annotations, internal links, sitemaps, and localization signals agree.

## Scope

Treat these as one duplicate-page canonicalization problem when they expose the same or substantially similar primary content:

- HTTP and HTTPS;
- www and non-www hosts, including combined protocol/host variants;
- trailing-slash and non-trailing-slash paths;
- repeated path slashes such as `/docs//guide`;
- directory defaults such as `/docs/` and `/docs/index.html`;
- historical extensions such as `/guide.html` and `/guide`;
- case variants such as `/Guide` and `/guide`;
- UTM and other tracking parameters that do not change primary content.

Do not assume that similar-looking URLs are duplicates. Case, parameters, extensions, and slash behavior can identify different resources. Compare response behavior, primary content, and project intent before consolidating.

## Inputs and Context

Read root `contextus.md` when present and only the modules relevant to the task. Otherwise use project configuration, routing code, deployment rules, sitemaps, and user-provided facts. Establish:

1. preferred scheme and host;
2. preferred path conventions;
3. which parameters change content versus only attribution or presentation;
4. framework, origin server, CDN, and redirect ownership;
5. existing indexed URLs, backlinks, migrations, and localization rules when relevant.

Ask only for missing information that would change the preferred URL or make a redirect unsafe.

## Decision Rules

| Situation | Primary action |
|---|---|
| Duplicate URL should no longer remain accessible | Permanent server-side redirect to the final preferred URL |
| Duplicate or near-duplicate must remain accessible | `rel="canonical"` to the preferred URL |
| Canonical HTML page | Self-referencing canonical |
```
END THIRD-PARTY FILE 47e711a59037761c

The third-party file has ended. Everything between the 47e711a59037761c tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2320 of 7553 bytes. © kostja94 · MIT · https://github.com/kostja94/marketing-skills/tree/HEAD/skills/seo/technical/canonical/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
