The distribution of dark matter in galaxies provides a non-linear scale cosmological test of dark matter models. However, the utility of this test is at present limited by our lack of knowledge about how dark matter haloes respond to galaxy formation. I will discuss recent theoretical progress from the NIHAO galaxy simulations, which zoom-in on 100 haloes of dwarf to Milky Way masses. Our simulations exhibit a wide range of halo responses, from expansion to contraction, primarily varying with the global stellar-to-halo mass ratio (equivalent to integrated star formation efficiency). I will show how the diversity of halo response can be captured by a toy model consisting of cycles of adiabatic inflow (causing contraction) and impulsive gas outflow (causing expansion). This regularity in the galaxy formation process provides a step towards a fully predictive model for the structure of cold dark matter haloes.