In a large skillet, combine the oil and garlic.
Place the skillet over low heat and cook until the garlic has softened, for 15 to 20 minutes; the garlic should not take on any color.
Meanwhile, bring a large pot of salted water to a boil.
Cook the cavatappi in the boiling water according to the package directions until al dente. Reserve ½ cup of the cooking water, drain the pasta, and return it to the pot.
If using, add red pepper flakes to the garlic-infused oil, to taste, and cook for 30 seconds.
Increase the heat to medium-high, add the spinach and a pinch of salt.
Sauté, stirring often until completely wilted, about 3 minutes.
Transfer the sautéed spinach and all pan juices to a blender.
Add the pecorino and process until smooth and season with salt, to taste, if necessary.
Add the spinach pesto to the pasta, and stir to coat, adding some reserved pasta water, as needed, until a creamy consistency is reached; serve immediately with a sprinkling of pecorino.