snap-trimmer

Shrinks snap packages by editing snapcraft.yaml and verifying rebuilds with soname checks.

7|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/rascheel/scheel-skills --skill snap-trimmer-rascheel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: snap-trimmer
Source: https://github.com/rascheel/scheel-skills/tree/main/snap-trimmer
Command: npx skills add https://github.com/rascheel/scheel-skills --skill snap-trimmer-rascheel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Snap packages often ship unused libraries, duplicated files, and build scratch that inflate their size, and manually repacking a .snap is error-prone and unsafe. This Skill reduces snap size exclusively through snapcraft.yaml edits, then rebuilds and verifies the result. ## Core Features & Use Cases - Removal-candidate analysis: Unpacks a prebuilt .snap and reports lint-flagged unused libraries, duplicates against base and content snaps, internal duplicate libs, classic cruft, and over-copied build scratch. - Safe yaml editing patterns: Applies a copy-paste pattern library for cleanup parts, prime exclusions, stage-package trimming, and license-file relocation, with hard rules that never delete license files or extension-injected files. - Rebuild verification: Compares old and new snaps for size delta, file-list diffs, lint changes, and DT_NEEDED soname regressions, then smoke-tests the trimmed snap in a disposable LXD container. - Use Case: A developer's snap is 500 MB because the gnome extension's libraries are staged locally; the Skill dedupes against gnome-46-2404, prunes docs while keeping copyright files, rebuilds, and confirms no library regressions. ## Quick Start Ask the agent to analyze the newest .snap in this repository and shrink it by editing snapcraft.yaml, then rebuild and verify the result.

Frequently Asked Questions about snap-trimmer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce the size of a snap package?

Analyze the built .snap to find unused libraries, duplicates against the base or content snaps, and cruft like man pages and docs, then remove them through snapcraft.yaml edits such as stage-package trimming, prime exclusions, or a cleanup part. Rebuild and verify with size and soname checks.

How do I fix snapcraft lint unused library warnings?

First check whether the flagged library is loaded via dlopen, since plugin-style paths like gstreamer, Qt plugins, or DRI drivers are falsely flagged and should be kept. For true positives, drop the owning stage-package or add a targeted prime exclusion, or silence the warning with a lint ignore entry.

Can I trim a classic confinement snap?

Yes, classic snaps are fully supported. The smoke test script reads confinement from meta/snap.yaml and installs with --classic in an LXD container, and lint output flagging nearly every staged library is a known classic-confinement signal worth investigating.

Why does snapcraft lint fail with a symbol lookup error?

A symbol lookup error mentioning __tunable_is_initialized means the lint host environment is broken due to a glibc mismatch with the mounted core snap, not a problem with your snap. Refresh core24 and snapd, run lint in a clean LXD instance, or fall back to the static soname-resolution check.

Is it safe to delete files directly from a .snap to shrink it?

No, the .snap artifact should never be edited or repacked directly. All size reductions must go through snapcraft.yaml edits followed by a rebuild, which keeps changes reviewable, revertible, and verifiable with lint and dependency checks.