simplify-code
Make a working change easier to read without changing what it does.
Sometimes a feature works, but the diff is heavier than the problem. This skill looks for unnecessary wrappers, one-use abstractions, redundant checks, and dead code within the change. It keeps behavior fixed.
When I’d use it
Use it after the change has passing checks and the diff feels unnecessarily complicated. A small, plain diff can simply be left alone.
Before you start
Give it the scope or base commit and the checks that cover the changed behavior. Passing checks provide something concrete to preserve. Don’t use “simplify” as a hidden request to redesign the API.
Install it. Then give it a task.
Run this in your project’s terminal. Choose your coding agent in the installer, then start a new agent session if it needs one to discover the skill.
$ npx skills add akdevsaha-dev/factory-skills --skill simplify-codeOnce installed, send a prompt like the ones below to your agent. These are example requests to adapt to your own project, not terminal commands or recorded results.
If slash commands aren’t available in your agent, write “Use the simplify-code skill to…” and describe the same task.
New to skills? Start with the installation walkthroughWhat happens next
- Reads the change and the surrounding project patterns.
- Names simplification candidates and rejects anything that alters behavior or scope.
- Applies candidates one at a time and reruns affected checks.
- Stops when no remaining change makes the code clearer.
A few ways to ask
5 examplesCopy the one closest to your task. Replace names, paths, dates, and refs with ones that exist in your project.
Simplify a working feature
› /simplify-code simplify the current invoice export diff. Keep behavior and the public interface unchanged. Use the passing export tests as the baseline.Keep the scope tied to a feature you can review.
Review unnecessary layers
› /simplify-code inspect the change against main for wrappers or interfaces with only one implementation. Remove them only if that makes the code clearer and preserves behavior.One implementation is a signal to investigate, not an automatic reason to delete an interface.
Flatten difficult control flow
› Use simplify-code on the new retry handler. Keep the retry limit, timing, and error behavior identical; look for a clearer control flow.Spell out the behavior that must stay fixed.
Limit the area
› /simplify-code focus on the recently changed report formatting code. Leave unrelated files and public types alone.The default scope is a change, not a cleanup of the whole repository.
Know when to stop
› /simplify-code review the current diff. If it is already plain, say so rather than changing it for style.“No useful simplification” is a valid result.
What to look for in the result
A list of simplifications made, choices deliberately kept, and checks rerun. A candidate that breaks a check is reverted. Behavior or interface changes are suggestions for separate work.
A thing worth watching
Fewer lines aren’t always clearer. Avoid turning this into a rewrite, and get passing checks before asking the agent to preserve behavior.
Use it with
Build a workflow you can repeat.
Follow the step-by-step guide to working with agents.