I study the optimal taxation of labor and capital in a dynamic economy subject to government expenditure and technology shocks. Unlike representative-agent Ramsey models, workers are heterogenous and lump-sum taxation is not ruled out. I consider two tax scenarios: (a) linear taxation, with a lump-sum intercept and (b) nonlinear-Mirrleesian taxation. When taxes are linear, I derive a partial-equivalence result with Ramsey settings that provides a reinterpretation of such analyses. I find conditions for perfect tax smoothing of labor-income taxes and zero capital taxation. Implications that contrast with Ramsey are derived for public-debt management, for the nature of the time-inconsistency problem and for the viability of replicating complete markets without state-contingent bonds. Shifts in the distribution of skills provide a novel source for variations in tax rates. For the nonlinear tax scenario, I show that taxation based on income averages is optimal.