Preheat the oven to 400°F.
Pat both sides of the chicken breast dry with a paper towel and pound them down to an even thickness. If the chicken breast is really large(7 ounces or more), slice them in half lengthwise to get a 4-5 ounce portion. Season both sides with salt and pepper.
Add 1 tablespoon of olive oil or butter to the bottom of a large, oven-safe skillet (like a cast iron skillet) or dutch oven over medium-high heat. See notes to make it in a casserole dish.
When it’s hot, add the chicken breast and sear both sides for about 2 minutes, until the outside starts to crisp and brown. The chicken doesn’t need to be cooked fully. Remove it to a clean plate or cutting board.
Turn the heat down to medium and add the remaining 3 tablespoons of oil or butter, scraping any brown bits off the bottom from the chicken. Add the sliced onion and cook for 5 minutes, until softened. Pour in a few tablespoons of white wine or chicken broth, and continue to stir until the alcohol evaporates. Continue cooking the onion for another 10 minutes, adding the wine incrementally as needed, until all of the wine is gone and the onions start to turn a golden color. Add the garlic, thyme and red chili flakes and cook for another 5-10 minutes, stirring frequently, until the onions are deeply caramelized.
Quickly mix the cornstarch with the chicken broth in a separate bowl to dissolve it. Pour it over the onion and simmer slightly until the broth and onions thickened slightly and the onions have a jam-like consistency.
Remove the pan from the heat and add the chicken breast back to the pan. Nestle the chicken into the onions and use the spatula or tongs to place caramelized onions on top of the chicken.
Sprinkle each chicken breast generously with shredded cheese and bake in the preheated oven for 6-8 minutes, or until the chicken reaches an internal temperature of just below 165°F and the cheese is melted and bubbling. The time will vary depending on how large your chicken breast is. Switch the oven to broil for 1-2 minutes to brown the cheese if desired.
Garnish with more fresh thyme or chopped parsley and serve the chicken with extra sauce and onions.