Preheat the oven to 400°F (200°C) and line a baking sheet with parchment paper. This ensures even baking and prevents sticking. Lay out thawed puff pastry sheets and gently roll them to even out the surface without making them too thin.
Use a sharp knife or pizza cutter to divide each pastry sheet into equal squares, about 4 inches wide. Uniform sizes help stacks cook evenly and create neat layers. Arrange the squares on your work surface so assembly becomes easier.
Place slices of ham on half of the pastry squares, then sprinkle shredded cheese on top. Season lightly with salt and pepper if desired. Cover each filled square with another pastry piece, gently pressing edges to seal.
Beat the egg with a small splash of water and brush it over the tops of each stack. This step helps create a glossy, golden crust. If you like, sprinkle herbs or a little extra cheese on top for decoration.
Place stacks in the oven and bake for 20–25 minutes until puffed and golden brown. Allow them to cool slightly before serving so the cheese sets a bit. Serve warm for the best texture and flavor.