Bring a large pot of water to a rolling boil and generously salt it, then add the spaghetti and cook until al dente following package timing.
While the pasta cooks, warm a large skillet over medium to medium-low heat and add the olive oil.
Add the thinly sliced garlic to the oil and stir constantly, cooking just until the garlic turns golden but not browned.
Stir in the red pepper flakes, then remove the skillet from the heat to avoid overcooking the garlic.
When the pasta is done, reserve at least 1/2 cup of the cooking water and drain the pasta.
Transfer the drained pasta to the skillet, add at least 1/2 cup of the reserved pasta water, and toss until the noodles are evenly coated; add more pasta water if needed to loosen the sauce.
If using, stir in the chopped parsley and grated Parmesan, toss lightly to combine, and serve immediately.