Since fluorine has its valence electrons in the n=2 energy level, and since chlorine has its valence electrons in the n=3 energy level, one would initially expect that an electron rushing towards fluorine would release more energy, as it would land in the n=2 energy level, whereas in chlorine, the electron would land only in the n=3 energy level, and would then not release as much energy. Thus, one would expect fluorine to have a greater electron affinity than chlorine. However, why is it that chlorine has a higher electron affinity (349 kJ/mol) than fluorine (328.165 kJ/mol)?
Fluorine, though higher than chlorine in the periodic table, has a very small atomic size. This makes the fluoride anion so formed unstable (highly reactive) due to a very high charge/mass ratio. Also, fluorine has no d-orbitals, which limits its atomic size. As a result, fluorine has an electron affinity less than that of chlorine.
The electron being gained by fluorine would be taken in to a much smaller 2p orbital and requires more electron coupling energy than that of much larger 3p orbital of chlorine. Therefore, energy released during the electron gaining process of fluorine is less than that of chlorine.