Source inspection (Shingo definition) and mistake proofing.
This is exactly what one does in lean. The Ford Motor Company, as I recall, said "Don't take it, don't make it, don't pass it along" with "it" referring to poor quality, and this is described in Shingo's book on Zero Quality Control.
https://www.amazon.com/Zero-Quality-Control-Inspection-Poka-Yoke/dp/0915299070
"Don't take it" is achieved through source inspection. "Inspection" should ideally be automated because inspection by people is labor intensive and usually not 100% effective. The general rule is that it is about 80% effective.
"Don't make it" is achieved through poka-yoke or error proofing. This is automatic and, by definition, does not rely on worker vigilance. As an example, the jig or fixture prevents the part from being inserted backward.
"Don't pass it along" is achieved by outgoing inspection, which again should be totally automated. Shingo gave an example in which drill bits sometimes broke, and the part left the drill press without a hole in it. They installed a rod (which worked in concert with the drill) that was supposed to go through the part that just came out of the drill press. If it didn't, it meant there was no hole and the press would stop (autonomation or jidoka) so the workers could replace the drill bit. Although it didn't stop the generation of one defective part, the part never reached the downstream customer and was then re-drilled to make it into a good part.
While non-value-adding, this kind of "inspection" is still mandatory to protect the internal or external customer, and may in fact be part of the control plan for the process. Another way of saying this is that inspection is
value-assisting, a useful term for activities that, while they do not add value directly to the product, are still useful because we would soon notice their absence if they were not useful. Non-value-adding, i.e. total waste, is characteristic of waiting and waste motion that do absolutely nothing to add value or assist in the addition of value.