Since this is for Anatomically Correct, I'm going to assume a technological basis rather than magical. Clarke's Third Law remains true, and so does its inverse, so implementing the concept is "left as an exercise for the reader"; pick whichever version works for you.
Starting from the extremities, a skeleton clearly has no musculature - and yet the bones move. The only logical conclusion would be a system of motors embedded in the joints. A skeleton body must therefore be entirely mechanical and driven electrically. Evolution doesn't even come into it; skeletons are designed and built.
This fits fairly well with skeletons' well-documented tendency to come apart when hit, and then connect themselves back together. Instead of damaging the motors, quick-release bindings (similar to those used for ski bindings) allow the joints to disconnect. And naturally it's easy to clip the joints back together, if you know how the quick-release binding works.
Self-contained power supplies in each bone
If this is driven by motors, we need power for the motors. The skeleton could have one big battery, but that would be an obvious target for enemies and a single point of failure for the body, as well as having the problem of how to get that power around. Conveniently though, bones have volume; and for bones which need to be stronger and would need more powerful motors for movement, the bones are bigger. So each bone has its own power supply, driving the motor(s) attached to that bone, and we don't need any cables.
Of course this means the "bones" cannot actually be made of bone. Most likely they'll be some kind of strong metal tube surrounding the battery. A light grey powder-coated finish (especially if not cleaned regularly) could very well look like bone to a casual observer. They don't have to have the exact same number of bones as a human - perhaps the spinal column might be a single continuous strut, for example. No-one's going to look too closely when a dozen of these things are trying to rip your head off, after all.
If we want to hypothesise a reason why they might stay in the dark, perhaps the coating has a good lifespan in the dark (keeping the skeletons intact for centuries or millenia) but reacts badly to light. We have plenty of examples of synthetic plastics which last a very long time in the dark but break down under UV.
Wireless control network
So how do we make each motor move? Simple: the skeleton runs a wireless network connecting all its parts together on the IoT principle. This means we don't need wires between the bones, which clearly is a good thing.
This also explains how a disconnected limb can "fight" on its own, or "crawl" back to the main body. So long as it is within range of the wireless network, it remains under control of the skeleton, and being self-powered it can function relatively independently if it has to.
Cameras for vision
The "eyes" of course are cameras which can see in IR and visible light. They include LEDs to provide illumination in complete darkness, the same as a security camera or many webcams. This explains why they often are shown with glowing eyes as the optical system switches between IR and visible illumination depending on what gives best resolution.
"Brain" control system with simple AI
We have to figure out how this is being controlled. The control system naturally lives in the skull, because it's the only part of the body with significant internal volume. It also gives us the trope of needing a headshot to kill them.
The control system needs to be some kind of electronics. With electronics, the skeleton can power down for long periods until something wakes it up. (I considered the "disembodied head" concept, but there's too much handwavey pseudo-science in that.)
If we want our skeletons to be human-level intelligence, perhaps we have a consciousness upload system, which of course requires some very advanced technology. Most fantasy shows skeletons as relatively unintelligent though, able to respond to basic stimuli but not capable of complex thought and reasoning. So it seems much more likely that a Boston Dynamics type of AI control would be running this. Since BigDog and its like are basically there already, this would be perfectly possible with current technology.
Wave attacks from "disposable" skeletons
With the skeleton then being a fully mass-manufactured robot, this would also explain why "necromancers" keep skeletons in storage by the thousand and simply swamp attackers with wave attacks. They cost resources to make, sure, but they can be stored powered-down indefinitely so you can build up your stock over time, and you don't need to worry about what happens to them in combat. And your "casualties" can be repaired relatively easily, because every component part of the skeleton can simply be replaced and the skeleton sent back out into battle again.
But why would a "necromancer" go to all this trouble?
For anyone paranoid enough, the biggest risk is always other people. If you have money and/or power, paranoia has to be a way of life to some extent, because kidnapping is a risk - and the more money and/or power you have, the bigger the risk. And with political power too, assassination is also a risk. Even bodyguards don't help, because as Indira Gandhi found out, your own bodyguards may actually be the risk. No, the only way to be truly safe is to have your bodyguards being utterly incorruptible - and the only way to achieve that is for them to not be human in the first place.
This also fits with skeletons generally being animated and commanded by a solitary "necromancer" who avoids contact with other people. You need to be a sufficiently talented engineer to design and build this, sufficiently rich to afford parts, and sufficiently socially isolated that no-one notices your experiments until you already have your skeleton army built. Not necessarily a mad scientist - more just a rich but reclusive young geek who's sold their dotcom for a few tens of millions and headed off to the hills, away from interactions with people who scare them.
So, you build your skeletons. As a walking bag of bones, they're about as scary as it gets. That gets them an edge in a fight - and of course unless you're lucky (or skilled) enough to take out the head, they just get up and carry on when you chop bits off them. That's enough to deter pretty much anyone.
A long-term "sleep mode" also make them the perfect guard. They could even be left on guard in plain sight, with people thinking they're just a macabre decoration - until they attack. And if they're not needed for a longer period, a disassembled box of "bones" would take up remarkably little space.
But suppose the "necromancer" didn't want to be quite so overt about the nature of his bodyguards. The Terminator approach of putting skin over them is going to be fairly convincing, so long as no-one looks too closely. Kyle Reese even says that early models had rubber skin. If all the castle guards are on the other side of a portcullis (or security door if we're in more modern times), people likely would never notice. Most aspects of security theatre (uniforms, masks and so on) are even designed to dehumanise guards to make them appear more intimidating, going back to antiquity with scary helmet designs. Actual robots would simply appear to be normal people with good training.