This paper frames the process of designing a level in a game as a series of model transformations. The transformations correspond to the application of particular design principles, such as the use of locks and keys to transform a linear mission into a branching space. It shows that by using rewrite systems, these transformations can be formalized and automated. The resulting automated process is highly controllable: it is a perfect match for a mixed-initiative approach to level generation where human and computer collaborate in designing levels. An experimental prototype that implements these ideas is presented.