  We present a categorical theory of the composition methods in finite model
theory -- a key technique enabling modular reasoning about complex structures
by building them out of simpler components. The crucial results required by the
composition methods are Feferman-Vaught-Mostowski (FVM) type theorems, which
characterize how logical equivalence behaves under composition and
transformation of models.
  Our results are developed by extending the recently introduced game comonad
semantics for model comparison games. This level of abstraction allow us to
give conditions yielding FVM type results in a uniform way. Our theorems are
parametric in the classes of models, logics and operations involved.
Furthermore, they naturally account for the positive existential fragment, and
extensions with counting quantifiers of these logics. We also reveal surprising
connections between FVM type theorems, and classical concepts in the theory of
monads.
  We illustrate our methods by recovering many classical theorems of practical
interest, including a refinement of a previous result by Dawar, Severini, and
Zapata concerning the 3-variable counting logic and cospectrality. To highlight
the importance of our techniques being parametric in the logic of interest, we
prove a family of FVM theorems for products of structures, uniformly in the
logic in question, which cannot be done using specific game arguments.
