Bring a large pot of salted water to a boil over high heat. Add the pasta to the water and cook to al dente according to package directions. Before draining the cooked pasta, reserve about 1/4 cup of the cooking water from the pot. Drain the cooked pasta well and reserve.
While the pasta is cooking, place a large high-sided skillet over moderate heat with the olive oil. Add the shallot and garlic to the skillet and cook until tender and aromatic, about 2 minutes. Add the greens and beans to the skillet along with the reserved 1/4 cup of pasta cooking water, season with salt and pepper and place a lid on the skillet. Cook the greens, stirring occasionally, until wilted and heated through, about 5 minutes.
When the pasta and greens are both ready, toss them together along with the lemon zest, lemon juice, and basil. Serve the pasta garnished with shaved parmesan cheese, if desired.