So far Always Outnumbered, Never Outgunned, my current novel-in-progress, has become a personal first in several ways. Item: it's one of the first projects I can think of where I started by way of changing horses, so to speak; I ditched out on a project that was already most of the way towards getting in motion to work on this one. (No regrets.) Item: the book features a character of nonbinary gender — and one that's explicitly identified as such, not someone that could be that if the reader squints and holds the book at a certain angle.
Call it an experiment, I guess. With each new book there's room to play that much further over my head in some fashion, to go boldly where Me-Previous did not go before. Some of that feeds into why I avoid sequels; the last thing I want to do is give myself an excuse to repeat anything, including the attitudes that went into shaping a particular piece of work in the first place.
But it wasn't like I was trying to tick off a box, either. When I devised the character, the nonbinary aspect of the character was already present in the first moments; the conception was all of a piece, as it were. It was one of those spontaneous decisions that seemed to justify itself all the more the further I delved into the book. The whole point was that this person was part of a diverse (see also: fractious) group, so why not diversity in this form as well? Especially since it provided some material I could use in a thematic way later on, and without seeming too forced, either? (I hate being cagey, but I also hate spoilers.)
The tough part is the homework — reading up on what nonbinary folks have to say about themselves, figuring out the little details that matter (pronoun choices, for instance). But all of that has to go towards supporting the character as a person, and not just as a representative case of this particular attribute.
If I fall back on the notion that nonbinary gender is the most interesting thing about the character, then I've failed; the point is to respect that aspect of the character without making it into the only reason to pay attention to them at all. The character's gender identification feeds into other things about the character and informs those things; no point in trying to pretend it doesn't. But again, that's not the only reason I'm interested in this person; there's a range of other things going on with this person that I hope to communicate to the audience. The trick is not to let this one potentially striking attribute flatten everything else out — to let that serve the function of making the person interesting, or sympathetic, or intriguing, or anything else a good character needs to be.
Previous books of mine have had, I hope, a pretty diverse set of characters: young and old, male and female, straight and gay (and otherwise). All of it serves as practice for properly depicting whatever sort of diversity I want to include next. But the one kind of diversity I struggle most to include is diversity of mind — freedom of thought and speech apart from whatever I happen to believe myself. I've touched on this before, that it's a mistake to embody a viewpoint you don't subscribe to in the form of a strawman/target character, because it cheapens the ambitions of the work as a whole. That's hard to avoid, because you might well never notice you're doing it.
It's tough to write a good female character, or a good nonbinary character, for the same reason it's tough to write any good character. It's difficult to get entirely away from who and what you are, discard your assumptions, let new ones sweep in to take their place. With gender and sexuality — and I specifically mention those things discretely, because they're not interchangeable, although they do influence each other — we're often at the mercy of our own images of what those things are supposed to be, or our own presuppositions about them. Male writers sometimes don't so much write about a female character that reflects women as they might be encountered, so much as they write about a female character that is a projection of their own notions about women. Likewise women writing about men, straight people writing about gay people, and so on.
For a novel that'll really put you in someone else's shoes, check out my (new!) novel Welcome To The Fold, and showing your support for it by registering at Inkshares and adding the book to your "Follow" list! Failing that, you can always buy one of my existing books, available on Amazon Kindle and in dead-tree format.