Due to the unique optical control ability and nanoscale structural characteristics of metasurfaces, they can achieve precise control and customized design of light, showing obvious advantages in many practical applications. However, since the structural design and electromagnetic simulation of most metasurfaces need to be manually adjusted step by step and are highly dependent on experience, once the optimization target changes, the unit structure needs to be re-optimized, resulting in excessive design costs and time. In this paper, a shape topology optimization method based on adjointness is used to reverse design the shape of the metasurface structure, and a free shape continuous metasurface with a deflection angle of the 30 degree is proposed. Compared with the discrete metasurface used in traditional design methods, the free shape continuous metasurface optimized by topology has higher light transmittance. The free shape metasurface lens designed in this paper has the advantages of high transmission efficiency, fast design speed, and has potential application prospects in optical communications, micro-nano light field control and other fields.