In low-dimensional topology one often decomposes a space into pieces that can be individually understood then put back together, yielding a combinatorial description, and such descriptions can be used for diagrammatic reasoning, computations of algebraic invariants, constructions of new objects, and so on. A powerful tool for this is singularity theory, where a classification of the types of singularities that generically might be present (for example, Morse critical points) leads to systematic approaches to decompositions, and in the ideal case the classification reduces to analyzing singularities of polynomial functions. We develop singularity theory relevant to "n-categorical" decompositions of smooth manifolds, in which pieces each have a recursive decomposition of their boundaries. In particular, we study smooth functions from manifolds to flag-foliated R^n, which serves as a model for the composition laws of an n-category. We use a refinement of the jet transversality techniques for the Thom--Boardman singularity types to define dense sets of functions that are suitably generic with respect to the foliations. We show how to compute codimensions of the submanifolds that correspond to a singularity type. For a few situations, for instance surfaces with embedded curves, we carry out a classification of the germs that appear in this dense set up to structure-preserving diffeomorphism. To this end, we prove stability results that aid in proving equivalence of germs and in finding polynomial representatives.
We explain how to use this classification of singularities to give a presentation of the symmetric monoidal 2-category of curves with embedded curves. As an application, we give a way to compute the Krushkal polynomial, which is a combinatorial invariant of graphs in surfaces, using an extended TQFT on the symmetric monoidal 2-category of surfaces that are decomposed into black and white regions.