This dissertation discusses the design of optimal _scal rules in a dynamic setting in which national governments with quasi-hyperbolic preferences are subject to privately observed idiosyncratic shocks. In this context, fiscal rules aim at striking a balance between exibility to react to shocks, and commitment to avoid excessive government spending. Chapter 1 derives and compares optimal rules in two di_erent environments: one in which a supranational authority is allowed to transfer resources across countries (i.e., a fiscal union) and one in which transfers are forbidden. I find that optimal fiscal rules can be implemented as de_cit limits and are complemented with a combination of grants and loans in a fiscal union. All instruments ar...