We use ∼ 100 cosmological galaxy formation 'zoom-in' simulations using the smoothed particle hydrodynamics code gasoline to study the effect of baryonic processes on the mass profiles of cold dark matter haloes. The haloes in our study range from dwarf (M 200 ∼ 10 10 M ⊙ ) to Milky Way (M 200 ∼ 10 12 M ⊙ ) masses. Our simulations exhibit a wide range of halo responses, primarily varying with mass, from expansion to contraction, with up to factor ∼ 10 changes in the enclosed dark matter mass at 1 per cent of the virial radius. Confirming previous studies, the halo response is correlated with the integrated efficiency of star formation:In addition, we report a new correlation with the compactness of the stellar system: ǫ R ≡ r 1/2 /R 200 . We provide an analytic formula depending on ǫ SF and ǫ R for the response of cold dark matter haloes to baryonic processes. An observationally testable prediction is that, at fixed mass, larger galaxies experience more halo expansion, while the smaller galaxies more halo contraction. This diversity of dark halo response is captured by a toy model consisting of cycles of adiabatic inflow (causing contraction) and impulsive gas outflow (causing expansion). For net outflow, or equal inflow and outflow fractions, f , the overall effect is expansion, with more expansion with larger f . For net inflow, contraction occurs for small f (large radii), while expansion occurs for large f (small radii), recovering the phenomenology seen in our simulations. These regularities in the galaxy formation process provide a step towards a fully predictive model for the structure of cold dark matter haloes.