To determine if cakes, muffins, and quick breads are done, we often use the toothpick test.
For the vast majority of baked goods, we want a toothpick inserted in the center to come out clean, indicating that the crumb is fully set and no excess moisture remains. This ensures that the item will slice neatly and hold together when cool. But when a moist texture is paramount, we deem the cake done when a few moist crumbs still cling to the toothpick. We also want moist crumbs on the toothpick in most chocolate baked goods, sometimes to preserve a very moist texture but also because they taste better: The longer chocolate is exposed to heat, the more its flavor compounds are driven off. But if the toothpick is wet, it’s always time for the item to go back into the oven.