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