What it does
Hashes the actual file content of media library uploads (not just filename or title) to find true duplicates that accumulated from repeated uploads or theme/plugin defaults, then checks which posts and pages reference each copy before proposing a single canonical attachment to keep. This recovers wasted storage and avoids the indexing/SEO confusion of near-identical image URLs.
Install
This skill isn't packaged in an installable registry. It's a plain SKILL.md file you can copy directly. Copy it from the SKILL.md tab and save it at the path for your assistant:
Use it in your AI assistant
Claude Code
.claude/skills/media-library-deduplicator/ (or ~/.claude/skills/media-library-deduplicator/ for all projects)
GitHub Copilot (VS Code)
.github/skills/media-library-deduplicator/
OpenAI Codex
.codex/skills/media-library-deduplicator/
Cursor
.cursor/skills/media-library-deduplicator/ (or ~/.cursor/skills/media-library-deduplicator/ globally)
Compatibility
Any WordPress site. Requires the agent to read file contents or checksums, not just media library metadata.
The complete SKILL.md for this skill:
---
name: media-library-deduplicator
description: Use when a user wants duplicate media cleaned up, mentions a bloated media library, wasted storage, or the same image showing up multiple times under different filenames.
---
# Media Library Deduplicator
## When to use
The media library has grown large over time (often from repeated uploads, migrations, or plugin defaults) and the user wants true duplicates identified and consolidated.
## Procedure
1. Pull the full media library listing and compute a content hash (not filename) for each image file.
2. Group attachments by matching hash to find exact duplicates, and separately flag near-duplicates (same image, different crop or resize) for manual review.
3. For each duplicate group, check every post, page, and widget that references any copy, so nothing breaks when references are consolidated.
4. Propose a single canonical attachment per group, ideally the one referenced most or with the best existing metadata (alt text, caption).
5. Update references to point at the canonical copy, then leave the now-unused duplicates flagged for the user's final delete decision rather than deleting automatically.
6. Skip images that look similar but hash differently, those are not true duplicates and merging them risks losing distinct assets.
## Guardrails
- Never delete an attachment automatically, even an apparent duplicate, without the user confirming it's no longer needed elsewhere.
- Re-check references after consolidation to confirm no post is left pointing at a deleted attachment ID.