Preheat the oven to 350 degrees and line a large baking sheet with aluminum foil or parchment paper.
In a large bowl, add all the ingredients together (except red pepper flakes). Heat pesto in the microwave for about 1 minute. Pour over the mixture; mix the ingredients together with your hands or a large spoon.
Pour chicken mixture onto the prepared baking sheet. Cover with foil and bake for 40 minutes. Remove foil and cook an additional 10 minutes; turn the chicken thighs over. Cook for 10 more minutes.
Sprinkle with red pepper flakes (optional).
Serve right in the pan, with your favorite side (rice, pasta, or quinoa).