The solution is to stop letting HR people with no technical knowledge hire technical people.
This is what results in the common practice of putting a know-nothing idiot with good social skills in charge of doing technical work they can't handle.
HR? They aren't the problem, at least not in my organization. Here, as happens in many places, the hiring is decentralized, with HR just processing the applications and other assorted paperwork. No, the real problem is people hiring based on who knows who. Now, granted, looking more closely at a candidate who is referred by someone else isn't necessarily a bad thing, since those references often prove useful when evaluating their personality and work ethic. No, what I'm talking about is someone getting hired because they're buddies with the departmental manager or, even worse, somehow related to him/her. Then there are the cases where someone is putting pressure on the manager to hire someone, even though everyone knows that the applicant doesn't know a damn thing. It happens more times than I can count, and the outcome is usually either bad or sometimes disastrous. At that point, the employee is whisked off to some other position that his connected friend or relative can find for him, or the argument will be made that he was doing a fine job but had too many responsibilities on him, at which point he'll be promoted into a managerial position, and one or two people--the people who should have been in his original position in the first place--will be placed under him. He'll be a shitty manager, his underlings will do all the work, and, if things work out, he'll get all the credit, and, if things don't, he'll just fire and replace his underlings until he finds some who can make him look good.