This paper describes a novel method for the synthesis of mechanisms from their qualitative behavioural specifications. The technique has been implemented in the context of automated design of mechanisms in Technics Lego. We introduce a new kinematic abstraction called a unity machine which is a machine with a single degree of freedom. Unity machines are the mechanical analogues of functions in programming languages. Unity machines are the key abstraction that allow for compositional synthesis of mechanisms from a basis set, guided by functional specifications. Geometric constraints accumulated during unity machine synthesis are satisfied by a qualitative kinematics analyzer based on Kramer's [Kramer] geometric engine. This allows us to cleanly integrate detailed dimensional synthesis by feature-oriented refinement with the abstract unity machine synthesis. Three steps in the design process---unity machine construction, qualitative kinematic analysis, and refinement---are illustrated in the context of the design of an autonomous tripod walker.