/immich-photo-manager:duplicate-reportfrom Photo Manager for Immich
Runs a full duplicate analysis on an Immich photo library using perceptual hashing. Finds cross-source duplicates (e.g. Apple Photos vs Google Photos exports) and generates a detailed report with removal recommendations.
Ships in Photo Manager for Immich. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Before doing ANYTHING else in this skill, call ping on the Immich MCP server.
ping succeeds → proceed with the skill normally.ping fails or the MCP tools are not available → STOP. Do not continue. Tell the user:❌ Immich is not connected. This plugin needs a running Immich MCP server to work.
Run /setup-immich-photo-manager to configure your Immich connection. You'll need:
- Your Immich server URL (e.g.,
http://192.168.1.100:2283)- An Immich API key (how to create one)
- The MCP server configured (see /setup-immich-photo-manager)
Nothing in this plugin will work until the connection is configured.
Do NOT skip this check. Do NOT try to run any other tool first. Always ping, always block if it fails.
Generate a full duplicate analysis of an Immich photo library. Uses perceptual hashing to find visually identical photos even when they have different checksums (common when photos are exported from Apple Photos and Google Photos).
When users import the same photo library from multiple sources (Apple Photos export, Google Takeout, manual folder copies), the files are often re-encoded by each platform. This means:
Perceptual hashing (pHash) computes a fingerprint based on the visual content of the image, not the binary data. Two re-encoded copies of the same photo produce the same perceptual hash.
The user's machine needs:
pip3 install Pillow imagehash pillow-heif --break-system-packages
Pillow: image loadingimagehash: perceptual hashingpillow-heif: HEIC/HEIF support (critical for Apple Photos)Before running the full perceptual hash scan, check Immich's built-in ML duplicate detection:
result = get_duplicates()
This returns groups of visually similar assets detected by Immich's ML engine. Present the count and let the user resolve obvious duplicates immediately using resolve_duplicates.
This is fast (no disk scan needed) but may miss re-encoded copies across import sources. For the full cross-source analysis, proceed to Step 1.
Note:
resolve_duplicateshandles Immich ML duplicates natively. Perceptual hashing (Steps 1 to 3 below) catches cross-source re-encoded duplicates that ML may miss.
Query Immich to identify distinct import sources from asset paths:
SELECT
CASE
WHEN "originalPath" LIKE '%Apple Fotos%' OR "originalPath" LIKE '%Apple Photos%' THEN 'Apple Photos'
WHEN "originalPath" LIKE '%Google Fotos%' OR "originalPath" LIKE '%Google Photos%' THEN 'Google Photos'
ELSE split_part("originalPath", '/', 5) -- or whatever level gives the source folder
END as source,
count(*) as total
FROM asset WHERE "deletedAt" IS NULL
GROUP BY source ORDER BY total DESC;
Present the sources to the user and ask which ones to compare.
For each source directory, scan all image files and compute 256-bit perceptual hashes:
from pillow_heif import register_heif_opener
register_heif_opener()
from PIL import Image
import imagehash
def compute_phash(filepath):
with Image.open(filepath) as img:
if img.mode != 'RGB':
img = img.convert('RGB')
return str(imagehash.phash(img, hash_size=16))
Key parameters:
hash_size=16 → 256-bit hash (high accuracy, very few false positives)ThreadPoolExecutor (NOT ProcessPoolExecutor, native HEIF libs deadlock on fork)Expected performance: ~500 files/30 seconds on Apple Silicon, ~200 files/30 seconds on Intel.
Compare hash sets between sources:
common = set(source_a_hashes.keys()) & set(source_b_hashes.keys())
a_only = set(source_a_hashes.keys()) - set(source_b_hashes.keys())
b_only = set(source_b_hashes.keys()) - set(source_a_hashes.keys())
For internal duplicates within a single source:
internal_dupes = sum(len(v) - 1 for v in hashes.values() if len(v) > 1)
Present findings in a structured report:
DUPLICATE ANALYSIS REPORT
Library: [total] assets ([photos] photos + [videos] videos)
Sources analyzed: [Source A] ([count] files), [Source B] ([count] files)
CROSS-SOURCE DUPLICATES
[Source A] <-> [Source B] visual matches: [count] ([pct]% overlap)
UNIQUE TO EACH SOURCE
[Source A]-only photos: [count]
[Source B]-only photos: [count]
INTERNAL DUPLICATES
Within [Source A]: [count]
Within [Source B]: [count]
TOTAL REMOVABLE
Cross-source duplicates: [count]
Internal duplicates: [count]
TOTAL: [count] files
RECOMMENDATION
Keep: [Source with better metadata/folder structure]
Remove: [Other source] copies where match exists
Review: [count] [other]-only photos are NOT duplicates, keep them
NEVER auto-remove. Always:
delete_assets(asset_ids=[...], force=False), safer and recoverable via restore_assets or restore_trash
b. Physical file removal from disk (os.remove()) only after user confirms trash is correct
c. For permanent deletion (user explicitly requests): delete_assets(asset_ids=[...], force=True), irreversibleBatch Immich deletions in groups of 100 assets per call. For ML-detected duplicates, prefer resolve_duplicates which handles them natively in Immich.
For near-duplicates the user hesitates over (a burst, three tries at the same shot), offer create_stack(asset_ids=[...]) as the middle option: the shots stay in the library but show as one item, with the first id passed as the cover. It is reversible with delete_stack, so it is the safe answer when "which one is best?" has no clear winner.
Before removal, remember the decision on every asset touched: review_assets(kept_ids, "keep", "best of the group: <why>") and review_assets(trashed_ids, "duplicate_of", "duplicate of <kept filename>"). A later run starts with get_assets_notes(asset_ids) and skips what already carries a verdict, so a 500-asset album is not re-analysed from scratch.
After removal, query Immich statistics to confirm the new count and present before/after comparison.
The fast pass over the API is get_duplicates, which returns Immich's own ML-detected groups with their similarity scores, plus search_large_assets to see which of them are worth the space. Fast, but it misses re-encoded copies across sources.
The queries below go one level deeper (exact checksums, filename overlap between import paths). The plugin never provides database access, so they only apply to a user who already has psql on their own Immich.
-- Exact checksum duplicates
SELECT checksum, count(*) FROM asset
WHERE "deletedAt" IS NULL
GROUP BY checksum HAVING count(*) > 1;
-- Filename overlap between sources
SELECT count(*) FROM (
SELECT "originalFileName" FROM asset WHERE "originalPath" LIKE '%Source A%'
INTERSECT
SELECT "originalFileName" FROM asset WHERE "originalPath" LIKE '%Source B%'
) t;
Scans actual files on disk. Catches re-encoded duplicates. Requires filesystem access and Python dependencies. Takes 10-20 minutes for ~40K photos on Apple Silicon.
Shows which source dominates each year, and helps users see where their photos came from over time:
SELECT year, source_a_count, source_b_count,
CASE WHEN source_a_count > source_b_count THEN 'Source A' ELSE 'Source B' END as dominant
FROM (
SELECT extract(year from "localDateTime") as year,
count(*) FILTER (WHERE "originalPath" LIKE '%Source A%') as source_a_count,
count(*) FILTER (WHERE "originalPath" LIKE '%Source B%') as source_b_count
FROM asset WHERE "deletedAt" IS NULL
GROUP BY year
) t ORDER BY year;
pillow-heif, Apple Photos libraries will have massive error rates (50%+ of files).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub drolosoft/immich-photo-manager --plugin immich-photo-manager13 skills in this plugin
/album-managerCreate, curate, and publish Immich albums organized by geography, theme, or custom criteria. Use when the user says "create an album", "organize my photos by location", "make a gallery album", "curate photos from Italy", "publish album", "geographic albums", "album from my trip to X", "share this album", or any variation of creating, managing, or publishing photo albums in Immich. Also triggers on "what albums do I have", "list albums", "album stats", "show me photos from", "generate gallery for", "show me the album".
/album-reportTurn an album or a selection into a PDF report: metadata per photo, frames per video, and Claude's own description of what is in each one. Use when the user says "PDF of the album", "album report", "export to PDF", "make a document with these photos", "catalog the album", "identify what is in each video and put it in a PDF", or any variation of wanting a printable report of a set of photos and videos.
/auto-album-curatorMonitor your Immich library for new photos that match existing albums and suggest additions. Keeps albums fresh by finding new photos that belong in existing collections based on GPS location, visual similarity (CLIP), and date patterns. Use when the user says "update my albums", "refresh albums", "new photos for albums", "curate albums", "auto-curate", "keep albums fresh", "album suggestions", "what new photos belong in my albums", "smart album update", or any variation of wanting to keep their albums up to date with recent imports.
/library-health-reportRun a full health check on an Immich photo library: asset counts, storage usage, metadata completeness, orphaned files, and quality indicators. Use when the user says "library health", "health report", "library status", "library audit", "how healthy is my library", "photo stats", "library overview", "what's in my library", "library report", or any variation of wanting a full overview of their photo library's state.
/metadata-fixerScan for and fix broken or missing photo metadata: dates, GPS coordinates, timezone offsets, and camera info. Detects suspicious patterns (midnight/noon timestamps, missing GPS on geotagged trips) and proposes corrections using folder structure, neighboring photos, and EXIF inference. Use when the user says "fix metadata", "fix dates", "wrong dates", "missing GPS", "metadata repair", "exif fix", "photos have wrong time", "noon dates", "midnight timestamps", "fix my photo dates", "metadata fixer", or any variation of wanting to repair photo metadata.
/people-reportGenerate a report on people in your Immich photo library: unique faces detected, photos per person, unnamed faces, people appearing together, and face recognition quality. Use when the user says "people report", "faces report", "who's in my library", "unnamed faces", "face recognition", "how many people", "people stats", "who appears most", "tag my faces", "face cleanup", "person report", or any variation of wanting to understand the people in their photo library.
Other plugins' skills for the same job