Preheat the oven to 375°F (190°C). Lightly grease a 13x9-inch baking dish and set aside.
Cook the jumbo pasta shells according to package directions until al dente; drain and set aside to cool so they can be filled.
Steam the fresh spinach just until wilted, then squeeze out excess moisture using paper towels and chop finely.
In a large mixing bowl, combine the ricotta and egg until smooth. Stir in the chopped basil, oregano or thyme, minced garlic, 2 cups of the shredded mozzarella, and the shredded Parmesan.
Fold the chopped, drained spinach into the cheese mixture. Season with salt and freshly ground black pepper to taste.
Spread about 1/3 cup of marinara sauce in an even layer on the bottom of the prepared baking dish.
Spoon roughly 2 tablespoons of the cheese and spinach mixture into each cooked shell, then arrange the stuffed shells in the baking dish with the open side up.
If using, stir red pepper flakes into the remaining marinara to taste. Pour the remaining marinara evenly over the shells, then sprinkle the top with the remaining 1 cup mozzarella.
Cover the dish with aluminum foil and bake in the preheated oven for 30 minutes, until heated through and the cheese is melted. Remove foil for the last 5 minutes if you prefer a browned top.
Let the casserole rest a few minutes before serving warm.