Heat olive oil and butter in a large skillet (12") over medium heat until butter foams. Add onions and salt, stirring to coat.
Cook, stirring frequently, until onions soften and release liquid, about 10 minutes.
Reduce heat to medium-low. Continue cooking, stirring every 3–5 minutes, until onions are deep golden brown and jammy, 25–30 minutes total. If onions start to stick or scorch, add 1–2 tablespoons water and reduce heat. Stir in sugar halfway through if using.
Add garlic and red chili flakes. Cook until fragrant, 30–60 seconds.
Add wine (or broth) and scrape up any browned bits from the pan. Simmer until liquid reduces to a glaze, 2–3 minutes.
Meanwhile, bring a large pot of salted water to a boil. Cook pasta according to package directions until al dente. Reserve ½ cup pasta water, then drain.
Meanwhile, cook pasta in salted water according to package instructions. Reserve ½ cup of pasta water, then drain.
Add drained pasta directly to skillet with caramelized onions. Toss well to coat.
Add pasta water 1–2 tablespoons at a time and toss. Add Parmesan and continue tossing until sauce is glossy and creamy.
Season with black pepper to taste. Garnish with parsley and serve immediately.
Notes
Don't rush the onions—true caramelization takes 25–30 minutes. Sweet onions (e.g., Vidalia, Walla Walla) caramelize even better. Also, caramelized onions can be made 3 days ahead and stored separately.
Keep heat low enough that onions sizzle gently, not aggressively
Use a wooden spoon to scrape browned bits as you stir
Pasta water's starch helps create a silky sauce—don't skip it
Finish with a splash of balsamic vinegar for extra depth
Add sautéed mushrooms, baby spinach, or arugula.
Make it vegan: skip butter and Parmesan, use all olive oil, add miso paste or nutritional yeast