The shady hat is a unique pre-War hat that grants a +5 bonus to Sneak and a +1 bonus to Perception. The hat cannot be repaired by any other item in the game. Therefore, it must be repaired by merchants.
The shady hat can be obtained as a reward for doing one of the research jobs in Moira's The Wasteland Survival Guide quest. To get it, the player must place an observer unit in a mirelurk egg nest without killing any of the mirelurks in the area.