01 - Combine flour, salt, and cubed butter in a large bowl until mixture resembles breadcrumbs. Gradually add cold water, mixing until dough forms. Shape into a disk, wrap in plastic, and refrigerate for 20 minutes.
02 - Melt butter in a skillet over medium heat. Add sliced onions and cook gently for 8 to 10 minutes until soft and translucent without browning. Remove from heat and let cool slightly.
03 - In a bowl, combine cooked onions, grated cheddar, cream cheese, mustard, black pepper, salt, and chopped herbs if using. Mix thoroughly.
04 - Set oven to 400°F (200°C). Line a baking sheet with parchment paper.
05 - On a lightly floured surface, roll pastry to about 1/8 inch (3 mm) thickness. Cut into four 7-inch (18 cm) diameter circles.
06 - Place cheese and onion mixture on one half of each circle, leaving a 1 cm border. Brush edges with beaten egg.
07 - Fold pastry over filling to create a half-moon shape. Press edges firmly and crimp with a fork. Transfer to prepared baking sheet.
08 - Brush pasties with remaining beaten egg. Make a small slit on top of each to release steam during baking.
09 - Bake in preheated oven for 30 to 35 minutes until pastry is golden brown and crisp.
10 - Allow pasties to cool slightly before serving. Serve warm or at room temperature.