We examine how firms adjust their production and technology in response to exogenous trade shocks. We develop a model in which revenue TFP can be distinguished from quantity TFP, and where skill upgrading is explicitly embedded into the firm‘s technology choice. Within our framework, firms respond to export and import shocks by adjusting their trade-off between quantity and quality, as well as the skill composition of their workforce. Ultimately, these decisions impact firms‘ quantity and revenue TFP, marginal costs, prices, and markups. We quantify the model using detailed firm and product data from Brazil and show how export and import shocks, instrumented using exogenous changes in exchange rates, GDP, and tariffs, affect a wide array of firm margins. Our results indicate both skill and quality upgrading in response to export shocks, while import shocks foster technology upgrading and productivity improvements.