trim-code: A skill to shrink AI generated code

Posted . Visible to the public.

I've published a /trim-code Show archive.org snapshot skill that makes generated code leaner. It scrapes unnecessary slop out of AI-written code, reduces the number of concepts a reader has to understand, and introduces new invariants so there are fewer special cases to handle.

At the end you get a report on what was simplified automatically, and which further improvements are possible with your consent.

It only applies safe, local changes automatically, the kind that don't needlessly bloat the diff. The optional improvements increasingly reach into existing code to make it reusable for the current change, which means more code to review. It also lists candidates that change behavior a little, but in exchange offer large savings.

Installing

Try it with:

npx skills add triskweline/skills --global --skill trim-code

Screenshot

This is the report you get when it has auto-applied the safe trimmings and now shows you the other change candidates:

trim-code report
Profile picture of Henning Koch
Henning Koch
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2026-09-28 14:36)