Heat oil in a pan over medium heat. Add chopped onion and garlic, cook until soft and lightly golden.
Add shredded chicken, green chilies, red chili powder, black pepper, and salt. Cook for 3 to 4 minutes until well combined and slightly dry, not wet.
Stir in the yogurt and cheese if using. Mix well and let the filling cool completely before assembling.
Preheat the oven to 200C (400F) and line a baking tray with parchment paper.
Roll out the puff pastry sheets and cut into squares or rectangles depending on your preferred shape.
Place a spoonful of cooled filling in the center of each piece.
Fold the pastry over the filling to form a triangle, square pocket, or hand pie shape, pressing the edges firmly to seal.
Use a fork to crimp the edges for a tighter seal and decorative finish.
Brush the tops with beaten egg for a golden finish.
Bake for 20 to 25 minutes, until puffed and golden brown.
Let cool slightly before serving warm.