Add the spaghetti, halved cherry tomatoes, sliced yellow onion, sliced garlic, olive oil, vegetable broth, salt, black pepper, and red pepper flakes (if using) to a wide deep skillet or Dutch oven. Arrange the spaghetti so it lies as flat as possible.