Make the Dough:
In a large bowl, combine flour and salt. Add egg, sour cream, and softened butter. Mix until a dough forms. Add water 1 tbsp at a time if dough is too dry. Knead for 5–7 minutes until smooth and elastic. Cover and let rest for 20–30 minutes.
Prepare the Filling:
In a medium bowl, mix mashed potatoes, cheddar cheese, sautéed onion (if using), salt, and pepper. Adjust seasoning to taste.
Roll Out Dough:
On a floured surface, roll dough to about 1/8-inch thick. Using a round cutter (about 3 inches), cut circles.
Fill Pierogies:
Place about 1–2 tsp of filling in the center of each circle. Fold dough over to create a half-moon shape. Press edges together and crimp with a fork to seal.
Boil Pierogies:
Bring a large pot of salted water to a boil. Add pierogies in batches. Cook until they float to the top, about 3–5 minutes. Remove with a slotted spoon.
Optional Sautéing:
In a skillet, melt butter over medium heat. Add boiled pierogies and sauté until golden brown on both sides for extra flavor and texture.
Serve:
Serve hot with sour cream, caramelized onions, or your favorite toppings.