if they are the most stable, it must mean they have a full outer shell. the first shell can only hold 2 so if it only has 2 electrons then it is pretty stable. all other shells after that can hold 8 so if it has 10,18,26,34,42 and etc electrons, it will be stable as well.
hope this helps!