  We derive the cosmological matching conditions for the homogeneous and
isotropic background and for linear perturbations in Horndeski's most general
second-order scalar-tensor theory. In general relativity, the matching is done
in such a way that the extrinsic curvature is continuous across the transition
hypersurface. This procedure is generalized so as to incorporate the mixing of
scalar and gravity kinetic terms in the field equations of Horndeski's theory.
Our matching conditions have a wide range of applications including the
galilean genesis and the bounce scenarios, in which stable, null energy
condition violating solutions play a central role. We demonstrate how our
matching conditions are used in the galilean genesis scenario. In doing so, we
extend the previous genesis models and provide a unified description of the
theory admitting the solution that starts expanding from the Minkowski
spacetime.
