photo-cleanup
Skill51 starsChanged 3 months agoMITView on GitHub
Detect and remove screenshots, duplicates, and low-quality photos from an Immich library. Use when the user says "clean up my photos", "remove screenshots", "find duplicates", "deduplicate", "photo cleanup", "library cleanup", "how many screenshots do I have", "free up space", "remove junk photos", or any variation of cleaning, deduplicating, or optimizing a photo library.
In this repository12 other files it gives its agents.
- album-managerSkill
- album-reportSkill
- auto-album-curatorSkill
- duplicate-reportSkill
- library-health-reportSkill
- metadata-fixerSkill
- people-reportSkill
- photo-searchSkill
- rotate-photosSkill
- storage-optimizerSkill
- timeline-gapsSkill
- travel-mapSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
If ping succeeds → proceed with the skill normally.
- Very specific: line 19
If ping fails or the MCP tools are not available → STOP.
- Distinctive: line 36
NEVER delete photos automatically: Always:
- Very specific: line 40
Use delete_assets(asset_ids, force=False) to send photos to trash (recoverable).
- Distinctive: line 65
Low confidence: Only one signal matches → needs human review
- Very specific: line 76
Immich ML duplicates: Use get_duplicates tool as a fast first pass, which returns groups of visually similar assets detected by Immich's ML …
- Distinctive: line 114
After the quick scan, clean up category by category:
- Distinctive: line 126
Keep the highest quality version
- Very specific: line 139
When something is trashed, record_action(asset_ids, "trashed", reason) so the audit trail survives a restore.
- Distinctive: line 156
Screen capture folders: ALL screenshots by definition
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Photo Cleanup
⚠️ Connection Required: ALWAYS CHECK FIRST
Before doing ANYTHING else in this skill, call ping on the Immich MCP server.
- If
pingsucceeds → proceed with the skill normally. - If
pingfails 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.
Intelligent photo library cleanup for Immich. Identifies and helps remove screenshots, duplicates, and low-quality images while protecting valuable photos.
Safety First
NEVER delete photos automatically. Always:
- Identify candidates for removal
- Present findings with counts and examples to the user
- Get explicit approval before any deletion
- Use
delete_assets(asset_ids, force=False)to send photos to trash (recoverable). Userestore_assetsorrestore_trashto undo. Only useforce=Truefor permanent deletion when the user explicitly requests it.
Cleanup Categories
1. Screenshot Detection
Screenshots are the #1 source of library bloat. Surface candidates with search_smart(query="screenshot") (CLIP) plus filename patterns (Screenshot*, Screen Shot*, Captura*) in search_metadata/list_assets results. Dimensions are NOT searchable. Then score each candidate by combining multiple signals (dimensions and EXIF come from get_asset_info, per asset):
| Signal | Weight | How to detect |
| Screen resolution | High | get_asset_info dimensions match known screen sizes exactly |
| No GPS data | Medium | EXIF GPS fields empty |
| No lens info | Medium | No focal length, aperture, or lens model |
| Filename pattern | Low | Contains "Screenshot", "Screen Shot", "Captura" |
| No camera make/model | Medium | Missing or generic device info |
Screen resolutions to flag (exact pixel matches):
iPhone screens: 750x1334, 1125x2436, 1170x2532, 1242x2688, 1284x2778, 1290x2796 Mac screens: 1920x1080, 2560x1440, 2560x1600, 2880x1800, 3024x1964, 3456x2234 Common Android: 1080x1920, 1080x2340, 1080x2400, 1440x2560, 1440x3200
A photo matching 2+ signals is a strong screenshot candidate. Report confidence level:
- High confidence: Screen resolution + no GPS + no lens → almost certainly screenshot
- Medium confidence: Screen resolution only, or no GPS + no lens but non-standard resolution
- Low confidence: Only one signal matches → needs human review
2. Duplicate Detection
Sources of duplicates:
- Same photo in Google Fotos AND Apple Fotos (most common)
- Multiple exports of the same original (different formats: HEIC, JPEG, PNG)
- Burst photos that look identical
- Edited versions alongside originals
Detection strategy:
- Immich ML duplicates: Use
get_duplicatestool as a fast first pass, which returns groups of visually similar assets detected by Immich's ML engine. Resolve withresolve_duplicates. - Exact duplicates: Same file hash (SHA-256) → safe to remove the copy
- Format duplicates: Same timestamp + same dimensions, different format → keep highest quality (HEIC > JPEG > PNG)
- Near-duplicates: Same timestamp + similar dimensions + high CLIP similarity → present to user
- Burst groups: Sequential timestamps (< 2 seconds apart) + same location → let user pick best
For 4 and 5, deleting is not the only option. create_stack(asset_ids=[...]) groups the shots behind the best one (the first id becomes the cover), so the library shows a single item and nothing is lost. Offer it before the trash: a stack is reversible with delete_stack, a deletion is not.
3. Low-Quality Photo Detection
| Issue | Detection | Action |
| Very dark | Average brightness < 20 (if available) | Flag for review |
| Very blurry | Motion blur EXIF hints, very low sharpness | Flag for review |
| Tiny resolution | Under 640x480 | Flag for review |
| Corrupt/partial | File size anomalies, unreadable EXIF | Flag for review |
Important: Some intentionally dark or blurry photos are artistic. Always flag, never auto-remove.
Cleanup Workflow
Quick Scan (recommended first step)
- Get library statistics: total photos, videos, storage
- Estimate screenshots: run
search_smart(query="screenshot")and scan filenames (Screenshot*,Captura*) insearch_metadata/list_assetsresults - Estimate duplicates: search for same-timestamp clusters
- Report summary:
📊 Library: {total} assets ({size})
📱 Probable screenshots: ~{count} ({percentage}%)
🔄 Probable duplicates: ~{count} ({percentage}%)
📉 Low quality candidates: ~{count} ({percentage}%)
💾 Estimated space recoverable: {size}Targeted Cleanup
After the quick scan, clean up category by category:
- Screenshots first (highest confidence, biggest impact)
search_smart(query="screenshot")(CLIP) to surface visual screenshots- Scan filenames from
search_metadata/list_assetsforScreenshot*,Screen Shot*,Captura*patterns - Confirm borderline candidates with
get_asset_info: no GPS + no lens info + dimensions matching known screen sizes - Present list grouped by confidence level
- User approves →
delete_assets(asset_ids, force=False)(moves to trash, recoverable)
- Duplicates second (requires more care)
- Find exact hash duplicates first (safest)
- Then find format duplicates (same photo, different format)
- Keep the highest quality version
- User approves →
delete_assets(asset_ids, force=False)to trash copies. For ML duplicates, useget_duplicates+resolve_duplicatesfirst.
- Low quality last (most subjective)
- Present candidates with thumbnails if possible
- User decides per-photo or in batches
Remember what was decided (notes)
The plugin keeps its own memory on each asset (review_assets, get_assets_notes), invisible in Immich and separate from tags. Use it so a second pass (days later, another session) does not redo the work:
- Before analysing a batch, call
get_assets_notes(asset_ids)and skip the assets that already have alast_verdict, unless the user asks to re-review them. Say how many were skipped. - After each decision, call
review_assets(asset_ids, verdict, reason)withkeep,delete_candidate,duplicate_oforneeds_checkand a short concrete reason ("near-identical to IMG_6367, that one has the bystander"). Tag the delete candidates as well (a tag is what the user sees and selects in Immich; the note is the why). - When something is trashed,
record_action(asset_ids, "trashed", reason)so the audit trail survives a restore.
Progress Reporting
For large cleanups, report progress every 500 assets processed:
🧹 Scanning... {processed} / {total} ({percentage}%)
Found so far: {screenshots} screenshots, {duplicates} duplicatesCleanup by Source
Since Immich imports from specific folders, cleanup can target specific sources:
- Google Photos imports: Oldest photos, most likely to have duplicates with Apple Photos
- Apple Photos imports: Higher quality (HEIC), but overlaps with Google
- Manual imports: Manually organized, least likely to need cleanup
- Screen capture folders: ALL screenshots by definition
What NOT to Clean
- Photos with faces detected (Immich's face recognition): may be valuable memories
- Photos in existing albums: someone already curated these
- Favorited photos: explicitly marked as wanted
- Videos: different cleanup criteria, handle separately
- Photos with GPS in known "home" locations: daily life photos may seem like junk but are memories
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

