Bring a large pot of salted water to a boil. Cook the pasta according to package instructions until al dente. Reserve ½ cup of pasta water, then drain and set aside.
While the pasta cooks, add pistachios, basil, garlic, and Parmesan cheese to a food processor. Pulse until finely chopped.
With the processor running, slowly drizzle in the olive oil until the pesto is smooth and creamy. Season with salt and black pepper to taste. Set aside.
Heat a drizzle of olive oil in a large skillet over medium-high heat. Season the shrimp with salt and pepper.
Add shrimp to the skillet and cook for 1–2 minutes per side, just until pink and opaque. Remove from heat.
Add the cooked pasta to a large bowl or back into the pot. Toss with pistachio pesto, adding reserved pasta water a little at a time until the sauce coats the pasta evenly.
Gently fold in the cooked shrimp. Add lemon juice if using.
Serve immediately, topped with extra Parmesan cheese and red pepper flakes if desired.