In the modern world, technological and scientific innovation relies heavily on teamwork. The ``lone genius'' is mostly a story of the past, as innovating teams have become larger, more diverse, and more geographically dispersed. This paper builds a framework that links idea production and matching in teams to aggregate innovation. With this framework, the paper quantifies the forces behind rising team size and shifts in team composition and produces a method for evaluating the relative importance of specific expertise for aggregate innovation. To do so, I build a matching-in-teams model which I combine with novel empirical measures of inventor expertise from the US Patent and Trademark Office (USPTO). In the model, inventors with heterogeneous expertise decide to form teams by weighing the output produced, governed by an idea production function, against the costs of communicating within the team. I build measures of inventor and team depth (expertise within the focal patent technology) and breadth (expertise outside the focal patent technology) to estimate the idea production function. I use geographical dispersion to quantify the costs of communicating within teams. I find that both changes in the returns to depth and breadth in addition to falling communication costs explain a large share of the increase in team size from 1980-2000, with changing returns to depth and breadth explaining over half of this increase. The higher returns to depth and breadth suggest increasing importance for fostering skills well-suited to teams. To quantify the overall impact of specific expertise, I ask how aggregate innovation responds to exogenous shifts in the distribution of inventor expertise in the economy. The results have natural implications for high-skilled immigration policies that shift a country's distribution of inventor expertise. I use these results to study the impact of the fall of the Soviet Union and the resulting influx of Russian immigrant inventors to the US on American innovation.