Preheat the oven to 425°F.
Add the tomatoes, shallot, garlic, 2 tablespoons of the olive oil, oregano, red pepper flakes, ½ teaspoon of the sea salt, and freshly ground black pepper to a large oven-safe skillet or baking dish. Toss until well coated.
Transfer the skillet to the oven and roast for 15–18 minutes, or until the tomatoes are softened, blistered, and beginning to burst.
About 5 minutes before the tomatoes are done roasting, prepare the cod. Pat the cod fillets very dry with a paper towel. Drizzle with the remaining 1 tablespoon olive oil and season with the garlic powder, remaining ¼ teaspoon sea salt, and freshly ground black pepper.
Remove the skillet from the oven. Use the back of a spoon to gently smash some of the tomatoes to release their juices and create a jammy sauce. Stir in the white beans, Castelvetrano olives, capers, and lemon zest.
Nestle the seasoned cod fillets into the tomato and white bean mixture, leaving the tops of the fillets exposed. Spoon some of the tomato juices over the cod.
Return the skillet to the oven and bake for 8–12 minutes, depending on the thickness of the fillets, until the cod is opaque, flakes easily with a fork, and reaches an internal temperature of 145°F.
Squeeze the lemon juice over the skillet, then top with the crumbled feta and fresh basil and/or parsley. Finish with additional freshly ground black pepper and red pepper flakes, if desired.
Serve warm with lemon wedges and toasted sourdough for soaking up the garlicky, jammy tomato juices. Enjoy!