The conventional Skyrme interaction is generalized by adding zero-range charge-symmetry-breaking and charge-independence-breaking terms, and the corresponding energy density functional is derived. It is shown that the extended model accounts for experimental values of mirror and triplet displacement energies (MDEs and TDEs) in sd-shell isospin triplets with, on average, about 100~keV precision using only two additional adjustable coupling constants. Moreover, the model is able to reproduce, for the first time, the A=4n versus A=4n+2 staggering of the TDEs.