Prepare the spinach. If using fresh spinach, heat the olive oil in a pan over medium heat. Add the garlic and cook for 20–30 seconds. Add the spinach and cook for 2–4 minutes until wilted. If using frozen spinach, thaw it completely.
Remove excess moisture. Drain the spinach thoroughly and squeeze it dry with a clean kitchen towel or paper towels. Let it cool before mixing with the cheese.
Make the filling. Combine the spinach, crumbled feta, black pepper, and optional herbs in a bowl. Taste before adding salt because feta is already salty.
Cut the pastry. Unfold the thawed puff pastry on a lightly floured surface. Cut it into eight approximately equal squares or rectangles.
Fill the pastry. Place about 1–1½ tablespoons of filling in the center of each piece, leaving a clear border around the edges.
Fold and seal. Fold each piece into a triangle or rectangle. Press the edges together with your fingers and crimp with a fork. Keep the filling away from the edges to prevent leaks.
Apply the egg wash. Brush the tops lightly with beaten egg. Avoid allowing excess egg to pool underneath the pastries.
Preheat the air fryer. Preheat to 350°F (177°C) for 3–5 minutes.
Air fry. Place the pastries in a single layer with space between them. Cook at 350°F (177°C) for 10–15 minutes, checking from the 8–10-minute mark. Work in batches if necessary.
Check doneness. The pastry should be puffed, golden, and cooked through. The center should be hot; approximately 165°F (74°C) is a useful target for a thoroughly heated filling. Continue cooking in short increments if needed.
Finish if necessary. If the pastries are cooked through but still pale, increase the temperature to 375°F (191°C) for 1–3 minutes, watching closely.
Rest and serve. Carefully remove the pastries and let them rest for 2–3 minutes before serving.