In a 10-inch (25 cm) cast iron skillet set over medium heat, add the olive oil, garlic, and onion, and cook until the onion is softened, 5 to 7 minutes.
Preheat the oven to 400°F (200°C).
Add the grated sweet potato, season with salt and pepper, and continue to cook until the sweet potato is tender, 8 to 10 minutes.
Add the spinach and stir until wilted, about 1 minute, then fold in the leftover creamed corn, herbs, and cayenne, if using.
Season again to taste and stir until warmed through, about 1 minute.
Use the back of a wooden spoon to create four small indentations for the eggs and add each egg, being careful not to break the yolks.
Sprinkle with Parmesan cheese and place in the oven.
Bake until the egg whites are just set and the top begins to turn golden, about 15 minutes.
Sprinkled with flaky salt, additional herbs, and additional Parmesan cheese.