Transformation systems are important for program manipulations such as optimization, instrumentation, and refactoring. Even though not always stated explicitly, these transformations are always driven by invariants, such as maintaining invariants for optimization, checking invariants for verification, and so on. This dissertation describes a system that allows coordinated transformations driven by invariants to be specified declaratively, as invariant rules, and applied automatically. We specially describe our implementation for applying invariant rules to Python and C programs, alias and type analyses developed for applying invariant rules, and a method for composing and optimizing invariant rules. We also describe successful applications of the system in generating efficient implementations from clear and modular specifications, in instrumenting programs for runtime invariant checking, query-based debugging, and profiling, and in code refactoring.