Every time I try to bake cream puffs the shells deflate before I can fill them with the cream.

I have tried poking a hole in the shell with a toothpick in the last few minutes of baking. I have also tried leaving the shells in an "off" oven with the door open to slow the cooling process but have not had success.

For the initial phase I go with 400℉ for 15 minutes. The high heat provides a rapid rise with a hollow center.

For the second phase I reduce the heat to 350℉ for 30-40 minutes. This phase allows the shells to firm up and dries out the center. At this point you should cut one of them in half and see how moist the center is. It's important that the center of the dough be as dry as possible here, having an undercooked center is what causes the dough to deflate. A little bit of moisture is ok.

For the final phase, turn the oven off and let them cool with the door ajar for 10-15 minutes. With the door fully open the rapid cooling can also trigger deflation.

hobodave is on the right track with his multi-temperature cooking suggestion: you really need that burst of high heat right away in order to get sufficient rise out of the dough (your aim is to create steam inside each pastry while the dough is still soft). In fact, I go over 400°F: try 425-450, depending on your oven, and aim to have the heat increasing during the first stage of baking. Then you need to cut the heat, or they'll burn rather than crisp.

However, I don't bother with a final slow-cooking phase: for one, it limits the use of your oven! If you're trying to produce more than a single batch of cream puffs, this is unacceptable... But also, it has not (in my experience) produced reliable results.

Instead, leave them to cook until they're a deep golden brown, and them immediately remove them from the oven, place them on cooling racks, and take a bamboo skewer (or thin pencil, or equivalent - a toothpick is far, far too small) and poke a hole in the very top of each pastry, making sure you penetrate to the center. This allows the steam to escape without softening the pastry, and is crucial to maintaining the shape and texture. As a bonus, you can pipe in filling through the same hole...

For the first batch, pay close attention to how they're cooking. You'll want to reduce heat as soon as they've risen and start to set, and remove them from the oven before they scorch. Exact times will vary based on your oven and on the size of your cream puffs.

Finally, don't make them too big - I aim for maybe a tablespoon of dough per cream puff at most. Remember, when properly cooked they puff up and are hollow inside - you just need enough dough for the shell! If you're ending up with webby, doughy centers, you're just wasting dough (and making them harder to fill later on).

i notice if i don't bake them long enough they will deflate but i bake them for around 25-30 mins on 180 degrees on the top shelf than will take them out and put on a wired rack straight away under the fan i don't know how everyone else does it but everyone has their own method but this one always works for me without fail