To perform the dragon flags exercise, lie down on a bench or bar, raise both legs off the ground without bending your knees, and bring them as close to your chest as possible.