In a large pot, bring 3 quarts of salted water to boil. Once boiling, add pasta and stir.
While the pasta is cooking, slice the shallot, crush the garlic, slice the squash, zest and juice the lemon, slice the roasted red peppers, grate the pecorino, and measure out the wine. Have all these ready to go.
If using grilled corn on the cob, slice off the kernels – enough for about 1 cup.
If using frozen corn, thaw the corn and then toast it in a dry cast iron skillet until golden and set aside.
In a large skillet over medium-high heat, add the olive oil. When hot, add shallot and stir until it starts to wilt, about 1 minute.
Add the garlic cloves and stir until fragrant, about 1 minute, then add red pepper flakes.
Add the wine – stir and scrape the pan to release any browned bits. When the wine starts to bubble add the lemon juice. Cook for a couple of minutes until reduced.
Add squash and cook, stirring constantly, until squash becomes tender – about 2-3 minutes. Add salt & pepper.
Add roasted red pepper, lemon zest, and corn kernels. Stir until combined.
Add the cooked pasta, grated pecorino, and half of the torn basil leaves. Toss and stir until combined.
Serve topped with the remaining torn basil leaves and more grated pecorino, if desired.