Synthetic differential geometry formalizes calculus in a way that precludes most monsters. Quite nicely, it allows you to use infinitesimal reasoning. The price to pay is the law of excluded middle. If you're a programmer, you're probably fine giving that up.
The wiki page has good references: https://en.m.wikipedia.org/wiki/Synthetic_differential_geome...