Resonance contribution in an amide:
Because chlorine is more electronegative as compared to oxygen, and oxygen is much more electronegative as compared to nitrogen, acid chlorides are more reactive as compared to acid anhydrides and esters, where as acid anhydrides and esters are much more reactive than amides.
The effect of electron-withdrawing of Y on the carbonyl carbon is an inductive effect. With amides, there is a significant resonance contribution that decreases the electrophilicity of the carbonyl carbon shown in figure.
Figure: Resonance contribution in an amide.
The nitrogen has a lone pair of electrons that can make a bond to the neighboring carbonyl carbon. Since this new bond is made, the weak π bond breaks and both of the electrons move onto oxygen to provide it a 3rd lone pair of electrons and a negative charge. Because the nitrogen's lone pair of electrons is being feed into the carbonyl group, the carbonyl carbon turns into less electrophilic and is less prone to attack through an incoming nucleophile. Theoretically, this resonance could as well take place in acid chlorides, acid anhydrides, and esters to provide resonance structures. Though, the process is much less significant because oxygen and chlorine are less nucleophilic as compared to nitrogen. In these types of structures, the positive charge ends up on oxygen or chlorine atom. These atoms are much more electronegative as compared to nitrogen and less capable to stabilize a positive charge. These resonance structures might take place to a small extent along with esters and acid anhydrides, but are far less likely in acid chlorides. This type of trend as well matches the trend in reactivity.