This depends on the recipe you are following, but as a general rule don’t overcook your cookies as that will make them go hard. It is better to slightly undercook them, as long as the middle of the cookie is hot when you take it out. Furthermore, to prevent them from overcooking make sure refrigerate the dough balls 30 minutes prior to cooking them in the oven.