#### Step 1: Cook the Pasta
Bring a large pot of salted water to a boil.
Add the pasta and cook according to package instructions until al dente.
Reserve 1/2 cup of pasta water, then drain the pasta and set aside.
#### Step 2: Prepare the Sauce
Heat olive oil in a skillet over medium heat.
Sauté garlic and onion until fragrant and softened, about 2-3 minutes.
Stir in the diced tomatoes and tomato paste. Cook for 8-10 minutes, allowing the tomatoes to break down and thicken.
Add sugar (if using), basil, oregano, salt, black pepper, and red pepper flakes. Stir well and simmer for another 5 minutes.
#### Step 3: Combine Pasta and Sauce
Add the cooked pasta to the skillet with the sauce. Toss to coat evenly.
If the sauce is too thick, add reserved pasta water a little at a time until desired consistency is reached.
#### Step 4: Serve
Divide the pasta into bowls or plates.
Top with grated Parmesan cheese and garnish with fresh parsley or basil leaves.