Earlier quoted context omitted.
The simple answer is testing. When you go to school you get a test that certifies you have a basic knowledge. It may not cover every aspect but will teach you where to find the answers you don’t know.
Oh? School for what? Maybe general contracting? A while back I looked briefly into what it would take to be an electrician, and it seemed like there was quite a lot to know. I wonder how soon you get to the stage where you could wire up a shed like this with full confidence that you've done everything to code. From there, how many other subjects do you have to get right? I learned how to swing a hammer as a kid but I…
Also, when applying for a home-owner permit, my city requires you pass a short test showing you know the basics of the code (not nearly as in-depth as certification exams).