I have played multiple adventures where skeletons line walls, but don't animate until some trigger happens. In some of these cases, I have allowed sufficiently paranoid characters to snipe the skeletons until the trigger condition is met.
Sometimes, the PCs will attack a skeleton, realize that it's not attacking back, and then decide the skeleton is not a threat. Shooting arrows at a skeleton is less effective than bashing it to pieces with a mace, so they'll get bored of sniping it with a bow.
Attacking the skeletons might draw wandering monsters, another disincentive for spending a good deal of time destroying every non-threat the PCs see. This is especially true if the dungeon contains skeletons which are just plain old dead bodies.
Another option is to have only the attacked skeleton respond. The PCs will finish off that skeleton, but might decide not to engage the remaining skeletons, thinking, "if I don't attack it, it won't attack me." Then, when they walk past, enter trigger.
Sometimes the PCs will kill all the skeletons before they have a chance to respond. Nothing wrong with that. They have a right to hit the win button every once in a while. The only problem here is if the "win button" is just a long, tedious series of the one archer character pew-pewing at skeletons for 10-15 rounds. This would be a good place to bring some of those wandering monsters in. Wandering monsters should always be employed when players spend too much time being boring.