Cook the ravioli according to package instructions. Drain and set aside, reserving a little pasta water.
In a large skillet, heat the olive oil over medium heat. Add the minced garlic and sauté for about 1 minute until fragrant.
Add the chopped spinach to the skillet and cook until wilted, about 2-3 minutes.
In a bowl, combine the ricotta cheese, Parmesan cheese, salt, black pepper, and red pepper flakes (if using). Mix until well combined.
Reduce the heat to low and add the ricotta mixture to the skillet with the spinach. Stir gently to combine.
Pour in the heavy cream and a splash of reserved pasta water to create a creamy sauce. Stir until heated through, about 2 minutes.
Add the cooked ravioli to the skillet and toss gently to coat in the sauce. If the sauce is too thick, add more pasta water as needed.
Serve immediately, garnished with fresh basil leaves if desired.