
Bring a large pot of salted water to a boil. Cook the penne according to the package directions until al dente. Reserve 1/4 cup of the pasta water, then drain the pasta.

While the pasta cooks, stir the ricotta, olive oil, lemon juice, lemon zest, chopped basil, red pepper flakes, salt, and black pepper together in a medium bowl until smooth and well combined.

Melt the butter in a large skillet over medium heat. Add the chopped shallot and cook for 2 to 3 minutes until softened and translucent. If using raw shrimp, add them now and cook for 1 to 2 minutes per side until just opaque. If using pre-cooked shrimp, warm them briefly at the end to avoid overcooking.



Return the drained pasta to the warm pot or a large skillet over low heat. Add the ricotta mixture and reserved pasta water, tossing until the sauce lightly coats the pasta. Fold in the shrimp and shallot mixture, then cook for 1 minute more until heated through. Serve immediately.