Defend (Minutemen)

Defend (displayed as Defend (Location Name)) is a Minutemen radiant quest in Fallout 4. There are three variations of the quest using the same script, with the only difference being the attacking party (raiders, super mutants, or Gunners).

Detailed walkthrough
After joining the Minutemen, this quest can be periodically obtained when talking to Preston Garvey or listening to Radio Freedom. The Sole Survivor is informed that an allied settlement is in danger of a raider, super mutant, or Gunner attack, and is asked to help the settlement with their defenses. Alternatively, the quest may be obtained directly from a settler at an owned settlement even if the Sole Survivor has not joined the Minutemen (though this occurs very infrequently). The quest has an (undisclosed) 14 day time limit, so the Sole Survivor must act quickly.

To proceed with the quest the Sole Survivor must travel to the settlement and talk to their leader, who will give the details: a group of enemies came through earlier and caused a lot of damage, and they're afraid a bigger group is on its way. They will ask the Sole Survivor to help build up the settlement's defenses to protect against the coming attack.

To complete the objective, the Sole Survivor must use the settlement workshop to build defensive buildings until the settlement has a defense rating of at least 10 (the Pip-Boy will indicate the percentage toward this goal as they build). After reaching the required rating a group of attackers will spawn and begin attacking the settlement. The Sole Survivor can help eliminate the attackers or let the settlement's defenses handle it. Either way, if the settlement takes too much damage or the leader of the settlement is killed, the quest will fail.

With the threat neutralized, the Sole Survivor can talk to the settler from before to receive thanks and a reward of ~100 caps. If the quest was given by Preston Garvey, the Sole Survivor must report back to him to turn in the quest; it will be completed immediately upon receiving the reward otherwise.

Bugs
In certain locations, NPCs might spawn in inaccessible locations (for instance, Roger Warwick at Warwick homestead might spawn inside the water cistern). This bug is shared with the other settlement quests.
 * The Warwick homestead example can be resolved by building stairs into the cistern and a bell outside of it. Using the bell and waiting for an in-game hour (using the Wait option) will cause the NPCs to spawn near the bell.