Place the potatoes in a large pot and just cover with cold water. Boil the whole potatoes until they are soft, about 45 minutes. While still warm, peel the potatoes and pass them through a food mill onto a clean pasta board.
Make a well in the center of the potatoes and sprinkle with the flour. Place the egg and salt in the center of the well and, using a fork, stir the egg into the flour and potatoes. Bring the dough together, kneading gently until a ball is formed, and continue to knead for another 4 minutes, until the dough is dry to the touch. Cut a tennis-ball sized hunk of dough off the main ball and roll it into a dowel about 3/4-inch thick. Cut across the dowel to form pellets about 1 inch long. Flick each pellet down the tines of a fork to form the traditional gnocchi shape. Repeat with the remaining dough.
In a 14 to 16-inch frying pan, combine the pepper flakes, tomato sauce, and 1 teaspoon salt. Bring to a boil, reduce the heat, and simmer 15 minutes, or until the sauce is as thick as good porridge. (At this point the sauce could be refrigerated for up to 2 days).
When you are ready to serve the gnocchi, bring 6 quarts of water to a boil and add 2 tablespoons salt.
Drop the gnocchi into the boiling water and cook until floating aggressively, 4 to 5 minutes. Carefully transfer the gnocchi to the pan with the sauce, using a slotted spoon. Turn the heat to medium and toss gently for about 30 seconds. Tear the basil leaves into a few pieces and add to the sauce along with the mozzarella cubes. Toss together for 30 seconds longer. Pour into a heated bowl and serve immediately.
BASIC TOMATO SAUCE: In a 3-quart saucepan, heat the olive oil over medium heat. Add the onion and garlic and cook until soft and light golden brown, about 8 to 10 minutes. Add the thyme and carrot and cook 5 minutes more, until the carrot is quite soft. Add the tomatoes and juice and bring to a boil, stirring often. Lower the heat and simmer for 30 minutes until as thick as hot cereal. Season with salt and serve. This sauce holds 1 week in the refrigerator or up to 6 months in the freezer.