The relationships between diversity, productivity and scale determine much of the structure and robustness of complex biological and social systems. While arguments for the link between specialization and productivity are common, diversity has often been invoked as a hedging strategy, allowing systems to evolve in response to environmental change. Despite their general appeal, these arguments have not typically produced quantitative predictions for optimal levels of functional diversity consistent with observations. One important reason why these relationships have resisted formalization is the idiosyncratic nature of diversity measures, which depend on given classification schemes. Here, we address these issues by analyzing the statistics of professions in cities and show how their probability distribution takes a universal scale-invariant form, common to all cities, obtained in the limit of infinite resolution of given taxonomies. We propose a model that generates the form and parameters of this distribution via the introduction of new occupations at a rate leading to individual specialization subject to the preservation of access to overall function via their ego social networks. This perspective unifies ideas about the importance of network structure in ecology and of innovation as a recombinatory process with economic concepts of productivity gains obtained through the division and coordination of labor, stimulated by scale.