In this work we establish a simple yet effective strategy, based on optimal transport theory, for enabling a group of robots to accomplish complex tasks, such as shape formation and assembly. We demonstrate the feasibility of this approach and rigorously prove collision avoidance and convergence properties of the proposed algorithms.