Many apparent plot holes are knowledge errors. Create three columns for any complicated reveal: what is objectively true, what each important character knows, and what each character believes. Add the chapter in which knowledge changes. This catches characters responding to facts they never learned, withholding information without a motive, or failing to use knowledge that would obviously alter their plan.
The same method protects mysteries. The reader may know less than the detective, but the withheld step must still exist. A fair reveal allows the audience to understand afterward how the conclusion was reached. If the explanation requires evidence that appears only during the reveal, the gap has been concealed rather than solved.
After repairing a hole, follow the change forward. Adding an earlier clue may cause the protagonist to recognize the villain too soon. Giving a character a new skill may remove danger from another sequence. Every repair changes the story’s state, so recheck later choices instead of treating the patch as isolated.