01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with cooking spray or butter.
02 - Heat olive oil in a large skillet over medium heat. Add the diced onion and cook until softened and translucent, about 3 minutes. Add the minced garlic and sauté for 1 additional minute until fragrant.
03 - Add the chopped spinach to the skillet and cook, stirring occasionally, until completely wilted, about 2 minutes. Remove the skillet from heat and set aside.
04 - In a large mixing bowl, combine the softened cream cheese and sour cream. Stir vigorously until smooth and well blended.
05 - Fold the shredded chicken, chopped artichoke hearts, spinach-onion mixture, half of the mozzarella cheese, Parmesan cheese, oregano, basil, salt, black pepper, and red pepper flakes (if using) into the cream base. Mix until everything is evenly distributed.
06 - Transfer the mixture to the prepared baking dish and spread it into an even layer. Sprinkle the remaining half of the mozzarella cheese evenly across the top.
07 - Bake uncovered for 30 minutes, or until the edges are bubbling and the cheese topping is melted and golden brown.
08 - Remove from the oven and let the casserole rest for 5 minutes to allow the filling to set before slicing and serving.