The advent of explicit Dirac-Born-Infeld inflationary models within string theory has drawn renewed interest to the cosmological role of unusual scalar field dynamics, usually referred to as $k$-inflation. In this situation, the standard method used to determine the behavior of cosmological perturbations breaks down. We present a generic method, based on the uniform approximation, to analytically derive the power spectra of scalar and tensor perturbations. For this purpose, a simple hierarchy of parameters, related to the sound speed of the cosmological fluctuations and its successive derivatives, is introduced in a $k$-inflation analogue of the Hubble flow functions. The scalar spectral index and its running are obtained up to next-to-next-to-leading order for all $k$-inflationary models. This result relies on the existence of a well-motivated initial state, which is not trivial in the present context: having the wavelength of the Fourier mode smaller than the sonic horizon is indeed not enough and some conditions on the dynamics of the sound speed are also required. Our method is then applied to various models encountered in the literature. After deriving a generic slow-roll trajectory valid for any Dirac-Born-Infeld model, simple formulae for the cosmological observables are obtained. In particular, the running, as the spectral index, for the so-called UV and IR brane inflationary models is found to be uniquely determined by the 't Hooft coupling. Finally, the accuracy of these cosmological predictions is assessed by comparing the analytical approximations with exact numerical integrations.