Outer shell electrons are called valence electrons. These electrons dictate whether a particular element readily forms compounds. Valence electrons can be gained, lost or shared in the formation of compounds.
Atoms want to fill their outer energy shells. In most cases, atoms would need eight electrons to fill their outer energy shells. Elements that have few electrons in their outer shells, such as the metals, are more likely to give up those electrons to other atoms to form a more stable arrangement. Elements such as the nonmetals have almost the full complement of electrons in their outer levels, so they tend to gain electrons during the formation of compounds.
Atoms can also share electrons with one another, meaning that the electrons spend part of the time orbiting around each atom of the compound. The noble gases, which already have eight valence electrons, do not readily form compounds.