In amorphous materials, groups of particles can rearrange locally into a new stable configuration. Such elementary excitations are key as they determine the response to external stresses , as well as to thermal and quantum fluctuations . Yet, understanding what controls their geometry remains a challenge. We build a scaling description of the geometry and energy of low-energy excitations in terms of the distance to an instability, as predicted for instance at the dynamical transition in mean field approaches of supercooled liquids . We successfully test our predictions in ultrastable computer glasses, with a gapped and ungapped (regular) spectrum. Our approach explains why excitations become less extended, with a higher energy and displacement scale upon cooling.