Use a linter that can auto fix some of the problems and have an automatic formatter. Ruff can do both. It will decrease your cleanup workload.
Don't get too hanged up on typing. Pythons duck typing is a feature not a bug. It's ok to have loose types.
On duplicate code, in general you should see at least two examples of a pattern before trying to abstract it. Make sure the duplication/similarity is semantic and not incidental, if you abstract away incidental duplication, you will very quickly find yourself in a situation where the cases diverge and your abstraction will get in your way.
In general coding agents are technical debt printers. But you can still pay it off.
Don't get too hanged up on typing. Pythons duck typing is a feature not a bug. It's ok to have loose types.
On duplicate code, in general you should see at least two examples of a pattern before trying to abstract it. Make sure the duplication/similarity is semantic and not incidental, if you abstract away incidental duplication, you will very quickly find yourself in a situation where the cases diverge and your abstraction will get in your way.
In general coding agents are technical debt printers. But you can still pay it off.