We report a new strategy for the synthesis of genes encoding repetitive, protein-based polymers of specified sequence, chain length, and architecture. In this stepwise approach, which we term "recursive directional ligation" (RDL), short gene segments are seamlessly combined in tandem using recombinant DNA techniques. The resulting larger genes can then be recursively combined until a gene of a desired length is obtained. This approach is modular and can be used to combine genes encoding different polypeptide sequences. We used this method to synthesize three different libraries of elastin-like polypeptides (ELPs); each library encodes a unique ELP sequence with systematically varied molecular weights. We also combined two of these sequences to produce a block copolymer. Because the thermal properties of ELPs depend on their sequence and chain length, the synthesis of these polypeptides provides an example of the importance of precise control over these parameters that is afforded by RDL.