In a large pot, bring 2-3 quarts of water plus ½ tablespoon of salt to a boil. Cook the spaghetti until al dente. Reserve about ¼ cup of pasta water for later use.
In a skillet, bring the garlic and oil to a boil over low heat. Cook for about 2-3 minutes or until the garlic is golden in color. Remove the garlic from the oil, set aside.
In the same skillet, stir in the anchovies, and capers. Stir for about 30 seconds on low heat. Add parsley, and red chili pepper flakes (optional) then stir for a few seconds. Add pasta, sliced garlic, shredded parmesan cheese, and a few tablespoons of pasta water if the pasta is too dry to your liking until the desired consistency is achieved. Toss to combine.
How to store: You can store the leftover cooked pasta in an airtight container. The leftover will last 3-5 days in the fridge or up to 2 months in the freezer.