Skewer vs x-ray: is the attack live yet?
Both describe a line that passes through one piece to reach another. They differ on whether anything is actually under attack this move.
The difference in one sentence
A skewer attacks the front piece immediately, forcing it to move and exposing what is behind it. An x-ray is a line that runs through an intervening piece to a target beyond it, without attacking the front piece at all -- it matters only once that piece leaves or is captured.
The practical distinction is whether the opponent has to do something. In a skewer they must react now. In an x-ray nothing is hanging, no reply is forced, and the entire value of the arrangement is that it changes the arithmetic of every exchange that happens on that line.
X-rays are most useful defensively, and that is the part that goes under-taught. A rook defending a square through an enemy piece is still defending it, which turns apparently winning captures into losing ones. A great many positions that look lost by a tempo are actually held by an x-ray nobody counted.
Terminology warning: some writers use 'x-ray' loosely to cover pins and skewers as well, treating it as the umbrella term for any attack through a piece. That usage exists but it is less useful, because it collapses the distinction that matters at the board.
One of each
Skewers
Position 1
Black to move. Find the best move.
Show the answer
40.f5 40...Rxg2+ 41.Kf4 41...Rxg7
The line wins a rook. The piece in front is attacked directly and worth more, so it must move and the piece behind it is lost.
The position comes from an endgame of a real game, rated 610 for difficulty. The answer reaches a winning advantage.
X-Ray
Position 2
White to move. Find the best move.
Show the answer
24...Rxe2 25.Rxe8+ Rxe8 26.Rxe8#
The line ends in checkmate. The line works through the piece in the middle, so the position turns on what happens the moment that piece is captured or forced to move.
The position comes from an endgame of a real game, rated 739 for difficulty. The answer reaches checkmate.
Questions people ask
What is the difference between an x-ray and a skewer?
A skewer is an immediate attack: the front piece is under fire now and has to move. An x-ray is latent: the front piece is not attacked, and the line only becomes relevant once it leaves or is captured.
Is an x-ray attack or defence?
Both, and the defensive use is arguably more valuable. Defensively, an x-ray means a piece is protected through another piece, so a capture that looks winning actually loses material.
Do pins and skewers count as x-rays?
Under a loose definition, yes -- some authors use x-ray for any attack through an intervening piece. The more useful convention reserves x-ray for the case where nothing is currently attacked.