We prefer untreated shrimp, but if your shrimp are treated with added salt or preservatives like sodium tripolyphosphate, skip brining in step 1 and increase the salt to 1/2 teaspoon in step 3. Serve with crusty bread.
1. Dissolve sugar and 1 tablespoon salt in 1 quart cold water in large container. Submerge shrimp in brine, cover, and refrigerate for 15 minutes. Remove shrimp from brine and pat dry with paper towels.
2. Heat 1 tablespoon oil in 12-inch skillet over medium heat until shimmering. Add shrimp shells and cook, stirring frequently, until they begin to turn spotty brown and skillet starts to brown, 5 to 6 minutes. Remove skillet from heat and carefully add 1 cup water. When bubbling subsides, return skillet to medium heat and simmer gently, stirring occasionally, for 5 minutes. Strain mixture through colander set over large bowl. Discard shells and reserve liquid (you should have about 1/4 cup). Wipe skillet clean with paper towels.
3. Heat 2 tablespoons oil, onion, garlic, anchovies, pepper flakes, 1/4 teaspoon salt, and 1/8 teaspoon pepper in now-empty skillet over medium-low heat. Cook, stirring occasionally, until onion is softened, about 5 minutes. Add 1 can drained beans, 1 can beans and their liquid, tomatoes, and shrimp stock and bring to simmer. Simmer, stirring occasionally, for 15 minutes.
4. Reduce heat to low, add shrimp, cover, and cook, stirring once during cooking, until shrimp are just opaque, 5 to 7 minutes. Remove skillet from heat and stir in basil and lemon zest and juice. Season with salt and pepper to taste. Transfer to serving dish, drizzle with remaining 1 tablespoon oil, and serve.