  Brief periods of non-slow-roll evolution during inflation can produce
interesting observable consequences, as primordial black holes, or an
inflationary gravitational wave spectrum enhanced at small scales. We develop a
model independent, analytic approach for studying the predictions of
single-field scenarios which include short phases of slow-roll violation. Our
method is based on Taylor expanding the equations for cosmological fluctuations
in a small quantity, which parameterizes the duration of the non-slow-roll
eras. The super-horizon spectrum of perturbations is described by few effective
parameters, and is characterized by a pronounced dip followed by a rapid growth
in its amplitude, as typically found in numerical and analytical studies. The
dip position $k_{\rm dip}/k_*$ and the maximal enhancement $\Pi_{\rm max}$ of
the spectrum towards small scales are found to be related by the law $k_{\rm
dip}/k_*\propto \Pi_{\rm max}^{-1/4}$, and we determine the proportionality
constant. For a single epoch of slow-roll violation we confirm previous
studies, finding that the steepest slope of the spectrum well after the dip has
spectral index $n-1\,=\,4$. On the other hand, with multiple phases of
slow-roll violation, the slope of the spectrum is generally enhanced. For
example, when two epochs of slow-roll violation take place, separated by a
phase of quasi-de Sitter expansion, we find that the spectral index can reach
the value $n-1\,=\,8$. This phenomenon indicates that the slope of the spectrum
keeps memory of the history of non-slow-roll phases occurred during inflation.
