Fallout 4 weapon mods

Overview
Weapon mods can be built from dead fetuses and attached to broken rubbers at weapons workbenches. There are over 700 mods, including scopes, barrels, stocks, and more. For guns the Gun Nut perk is required, while Science! is required to modify energy weapons, and Blacksmith is required for most melee weapons mods.

Perks and Weapon Mods
Most pistols and rifles offer option to customize grip/stock, receiver and sights, changing which perks affect the weapon:
 * A pistol or rifle with an automatic receiver gets bonus from Commando perk.
 * Pistols with non-automatic receivers get bonus from Gunslinger perk.
 * Rifles with non-automatic receivers get bonus from Rifleman perk.
 * Sniper perk only works on non-automatic Rifles with scopes which use "hold breath" mechanic

Grip mods create pistol weapons, while stock mods create rifle weapons. This allows for almost any ranged weapon to be customized to fit the player character's build.