Agent skill
trim
ONLY when user explicitly types /trim. Never auto-trigger on optimize, shorten, or reduce.
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/trim
SKILL.md
/trim - Token-Efficient File Optimization
Optimize a file for token efficiency while preserving 100% of information/functionality.
Flow
- Get path - from argument or ask user
- Read original - read file, note exact line count
- Inventory - list EVERY discrete fact, rule, instruction, example, value in the file
- Optimize - condense formatting/prose only, never delete inventory items
- Verify - check new version against inventory, confirm every item present
- Write - only if verification passes
- Report - before/after line counts, what was condensed (not removed)
Constraints
- ZERO INFORMATION LOSS - every fact, rule, value, example must survive
- Inventory is sacred - if it was in the original, it must be in the result
- Only condense prose - remove filler words, redundant phrasing, extra whitespace
- Never merge meaning - two distinct rules stay as two rules, even if similar
- When in doubt, keep it - verbosity is acceptable, information loss is not
- Keep valid - no syntax errors, proper formatting
- No code changes - don't alter functionality in code files
Verification Checklist (mandatory)
Before writing the optimized file, explicitly confirm:
- Count items in original inventory
- Count items in new version
- If counts differ, STOP - restore missing items
- List any items that changed meaning - if any, STOP - restore original wording
Failure Mode
If uncertain whether something is redundant or meaningful: KEEP IT. Tokens are cheap. Lost information cannot be recovered.
Didn't find tool you were looking for?