Preheat your oven to 350°F so it's ready when the chicken goes in. Lightly coat your oven-safe skillet with cooking spray or a bit of olive oil. This keeps the onions from sticking and makes cleanup much easier later.
Add the chopped onion to the skillet over medium heat and cook until soft and translucent, about 3 minutes. Stir in the garlic and cook just until fragrant, roughly 45 seconds. Don't let the garlic brown, or it can turn bitter.
Add the drained spinach to the skillet and stir it into the onions until well combined. Then mix in the sour cream, dill, and red pepper flakes. Stir until everything looks creamy and evenly distributed.
Season the chicken thighs with salt and pepper on both sides. Place them directly on top of the spinach mixture, pressing them in slightly so they're partially nestled into the dip. This lets the chicken soak up flavor as it bakes.
Transfer the skillet to the oven and bake for about 20 minutes. You're looking for the chicken to reach an internal temperature of 160°F on an instant-read thermometer, with juices running clear when pierced.
Pull the skillet out and sprinkle the mozzarella and Parmesan generously over the chicken and spinach. Switch your oven to broil and cook for about 5 minutes, watching closely until the cheese turns golden and bubbly.
Let the dish rest for a couple of minutes once it's out from under the broiler. This helps the juices settle back into the chicken instead of running out when you slice it. Then it's ready to plate up.