I've tried most coding agents, and they tend to share the same problem: during implementation, once an issue comes up, such as a function failing to do what it was meant to, the approach gets replaced, or an implementation detail just needs adjusting, the logic and data definitions added for the old approach rarely get withdrawn on their own.
The agent simply starts a new implementation, writes another function, creates another class, and so on. Old and new approaches pile up until the code becomes a mess, and a human still has to go back and work out which functions, logic, and fields are no longer needed.
An agent responsible for implementation and fixes could be given a rule like the following:
After changing an implementation approach or fixing an issue, review the code logic and data definitions touched by the change, and make sure each one still has a reason to remain. Remove unused functions, redundant logic, and data fields that are no longer needed.
When using a skill such as git-commit, the agent can automatically run this review before every commit, making sure unused functions, redundant logic, and data fields that are no longer needed are cleaned up promptly.
