1. Heat the oil in a medium-size saucepan over medium heat. Once the oil appears to shimmer, stir-fry the garlic and pistachios until the garlic is lightly brown and the nuts are fragrant, one to two minutes.
2. Pour in the tomatoes, including the juices, and the beans. Stir once or twice. Bring the sauce to a boil, stirring occasionally. Pile in the spinach, cover the saucepan, and allow the greens to wilt in the rising steam, without stirring, about five minutes.
3. Stir in the salt, peppercorns, and red pepper flakes. Lower the heat to allow the sauce to simmer, uncovered, about 15 minutes.
4. Serve with gnocchi and freshly shredded Parmigiano-Reggiano cheese.