  Affine W-algebras are a somewhat complicated family of (topological)
associative algebras associated with a semisimple Lie algebra, quantizing
functions on the algebraic loop space of Kostant's slice. They have attracted a
great deal of attention in geometric representation theory because of
Feigin-Frenkel's duality theorem for them, which identifies W-algebras for a
Lie algebra and its Langlands dual through a subtle construction.
  The main result of this paper is an affine version of Skryabin's theorem,
describing the category of modules over the W-algebra in simpler categorical
terms. But unlike the classical story, it is essential to work with derived
categories in the affine setting.
  One novel feature is the use of geometric techniques to study W-algebras: the
theory of D-modules on the loop group and the geometry of the affine
Grassmannian are indispensable tools. These are used to give an infinite family
of affine analogues of the Bezrukavnikov-Braverman-Mirkovic theorem, providing
a geometric version of Rodier's compact approximation to the Whittaker model
from the arithmetic setting. We also use these methods to generalize Beraldo's
theorem identifying Whittaker invariants and Whittaker coinvariants, extending
his result from GL_n to a general reductive group. At integral level, these
methods seem to have deep intrinsic meaning in the local geometric Langlands
program.
  The theory developed here provides systematic proofs of many classical
results in the subject. In particular, we clarify the exactness properties of
the quantum Drinfeld-Sokolov functor.
