Cook the pasta according to the package directions. (If you start cooking the sauce at the same time as you start boiling your pot of water, they'll both finish around the same time.)
In a large saucepan over medium heat, add the olive oil, and diced onion. Saute until the onion is translucent, about 8 minutes.
Add the diced tomatoes and continue to simmer, stirring occasionally. Around this time, add the garlic too.
After about 5-10 minutes, the tomatoes will begin breaking down and releasing their juice. Continue simmering and stirring as the mixture becomes runnier - as the liquid condenses the sauce will get a bit thicker. Optionally add the wine or pasta water. Continue simmering until it reaches the desired consistency.
Add the salt, pepper, chili flakes, and basil and adjust to taste.
Just before you're about to serve dinner, turn off the heat and gently stir in the avocado. The idea is for the sauce to warm the avocado, but not let it get too mushy.
Portion out some pasta, ladle some sauce on top, and dig in!