Make the dough: In a bowl, mix flour and salt. Add egg, oil, and warm water. Knead until smooth and elastic (about 5–7 minutes). Cover and let it rest for 20–30 minutes.
Prepare the filling: Fry the chopped onion in butter until golden. Mix with mashed potatoes and cheese. Season with salt and pepper.
Shape the pierogi: Roll out the dough thinly (about 2–3 mm). Cut out circles using a glass. Place a spoonful of filling in the center. Fold in half and seal the edges tightly.
Cook: Boil salted water in a large pot. Drop pierogi in batches. Cook until they float, then for 2–3 more minutes. Remove with a slotted spoon.
Optional: Fry cooked pierogi in butter with onions for extra flavor.