I personally don't like the idea of labelling anyone as having a "difficult" personality, just because they have a different set of responses and motivations to those of their line manager or the corporate culture that require more effort to work with constructively. Especially when they are smarter than you.
The main challenges I have found with the "hero(ine) programmer" tend to be grouped three areas:
The first is the key person risk that they represent. Their combined skills set is likely to be irreplacable, and their desire for high productivity levels means that they can become frustrated with mentoring or training junior staff. This creates an issue of scalability, where the team cannot easily grow.
The second challenge is simply their skill level. When they stroll in and solve a technical issue in seconds that a junior staff member has been struggling with for days the impact on the junior staff can be shattering. They can feel they will never be able to catch up.
Finally, there is the issue of communication. The same drive that makes then highly productive can - but not always - result in a blunt and directive communication style, which can often create issues in the wider company.
These are broad generalisations, and may not fit every "hero" or "heroine" - more critically from time to time all of your team may exhibit these to a greater or lesser extent.
The main things I'd suggest are:
- no perks! If the "hero" needs something like flexibility in working hours, apply it to the whole team. This is easy for me because in NZ if I don't treat all staff equally then I can find myself on the wrong end of a legal employee dispute.
- fight the power: Work hard to protect your whole team from "organisational rain" and defend key areas like working hours or dress code as far as you can with senior management in the name of productivity and flight risk. When you can't win a battle, let them know, and apologise. Be honest and open, but let them know its a deal breaker.
- address communication issues immediately! if they overstep a mark, or you find yourself on the end of a thirty minute discussion from HR about how they upset the office sustainability commitee, then let them know as soon as is practical. Not in a conforntational or hostile way, but just let them know they upset someone, and part of your day has been lost to repairing the situation. Suggest alternative commication styles that could allow them to be more efficient and effective.
- ask for their help Consult with them on the key areas, especially regarding development of staff, reduction of key man risk, and process. Invite them to suggest solutions to these things. Include them in recruitment processes.
I suspect that all highly productive and innovative teams require a few people with hero tendancies; while it is an excellent idea to recruit in part for team fit over genius, managing smart and creative people is a balancing act.
I have had to manage the exit of one staff member where their actions were so disruptive to the rest of the team that their personal productivity wasn't worth it, but I've managed to retain a few, and stop them head-butting all the time.