Your writing should not leave anyone feeling ashamed of being: male, female, western, non-western, sickly, hale, powerful, powerless. It should use characters as characters and not as broad groups that are then used to shame other groups. Fiction is not agit prop.
I'll use the last line as the directive: "Do not write agitprop."
(Note: I am explicitly not talking here about someone who is speaking their mind directly in the form of a nonfiction piece — a blog post, an essay, an open letter, a conversation with a friend. There, you are not only permitted but encouraged to be as vociferous and opinionated as you can, because that way you leave no ambiguity about your position. I am confining myself here to discussing the art of fiction.)
But immediately we fall into a trap. One man's agitprop is often another man's speaking-out against being silenced by complacency or marginalization. So to just say "don't write that stuff" is to some ears tantamount to saying "Don't speak up for yourself or your brethren."
I cannot deny that I have seen firsthand the way the SF community can pretend (not always intentionally) how problems of marginalization do not exist. I don't have the luxury of pretending those problems are imaginary. The last thing I want is to sound like I'm coming out against people giving themselves a voice where before they felt they had none.
From what I can tell, most of the use of SF as agitprop (or literature as agitprop generally) comes from two places. The first is as a reaction to life conditions, which everyone knows about. We write about what we know, and if we have been injured — deliberately or unthinkingly — we write about that, as well we should. The second is as a reaction to writing that is itself a kind of normative agitprop — i.e., writing which unthinkingly reinforces the status quo without questioning it or at least showing some awareness of it being a status quo, etc.
To see the status quo for what it is should be a function of the writer's overall job as an observer and interpreter. If they don't see these things in some form, they're not looking closely enough.
This is why, for instance, so much military-themed SF falls flat with me. To draw parallels, most of it seems inspired more by Patton or The Green Berets than it is La grande illusion, All Quiet on the Western Front, Overlord, Paths of Glory, Army of Shadows, etc. It's easier to talk about war (in space or elsewhere) in terms of easily-assimilated ready-made concepts like heroism (we win because we're morally superior) and technological positivism (we win because we have bigger guns) rather than tougher questions of how we can talk intelligibly about war, even a war we might not be able to avoid fighting (yes, it is naïve to assume real enemies do not exist, etc.), without assuming that having a moral mandate for the fight will simply absolve us and render all further discussion moot. I do not doubt for a second that there are times when we must fight; I also do not doubt for a second that even those instances should go without scrutiny and skepticism; and I further do not doubt that such scrutiny and skepticism should not be used to turn the whole discussion into a matter of stumping for a pet argument or making the other guy look like a fool for taking his position.
From what I see here, then, it's only possible to not write agitprop when a) you know what it is, b) you know why it's bad to do so, and c) you have some idea of what a proper counterexample looks like. I've touched on b) and c), but I've still missed supplying a good discussion of a), so here goes. And something I mentioned at the end of the last 'graf seems like a good lead-in to that.
Agitprop as fiction exists most when it talks about issues as a form of — for lack of a better way to put it — audience-shaming. This is work that seeks not to enlighten or entertain, but simply to incriminate — to make its audience feel guilty. In the case of war, for instance, it could be for picking up a gun; it could be for not picking up a a gun (Johnny Got His Gun). Either way, the deeper meanings of either side are obliterated in favor of simply making us feel bad for not siding with the author. The author may well be completely in the right, and a great deal of the time, they are. But the work they produce should be held to its own standard outside of the position it stakes out. A bad story with noble intentions is still a bad story.
The people who thrive most on and celebrate most the art of audience-shaming are, from what I've seen, other writers who themselves engage in such actions and are looking for evidence that they're doing the right thing. They are less interested in looking at the issue than they are in scoring points through the use of the issue. Not all of them seem conscious of this, either.
This sort of thing manifests most visibly as plain old second-rate storytelling. An SF story that looks critically at the power imbalances that technology creates, for instance, does not need a singular scapegoat. It does not need a Disney-style load-bearing villain which, when knocked out of position, causes all the evil in the story to evaporate. It would need to be honest enough to recognize that the people on both sides of the imbalance are being injured by the imbalance — not to minimize the suffering of the victims, but to show that the ignorant also hurt themselves when they hurt others. This is not to say that the way they hurt themselves somehow outweighs the way they hurt others, or anything of that nature — only that a wiser story would see the full picture and attest to that as well, without trivializing anyone's individual suffering or displacing sympathy. Consider it a direction to to work towards, rather than a goal that must be achieved for the story to have the full order of merit. (I leave it entirely as an exercise to the author how to pull that off, because it isn't going to be remotely possible to do that the same way in any two different stories.)
This is a thorny subject, in big part because I agree completely with the idea that some things are just plain wrong, and that it does no one any good to use moral equivocation to dodge such issues. Some things need to be denounced, not just once but in each of its social incarnations. But there is more than one way to denounce something, and more than one possible context for that denunciation. Denouncing something in the context of a story happens differently from the way we denounce it face-to-face, in the heat of a living moment. On paper, we can afford to be subtle; in real life, it often does not pay to bite our tongues.
The opposite of agitprop should not be another kind of agitprop — especially not something that unintentionally becomes agitprop. The opposite of agitprop is humane and insightful fiction, wherever we may find it. It may come from a side, and it might even take a side, but it refuses to fall into the trap of being nothing but the taking of a side, lest it be confined by the very same things that confine its antagonists.
Literary critic Dale Peck once said (I paraphrase) that within every story there is a utopian vision that if realized would make the story unnecessary. The difference between fiction and agitprop is that the latter doesn't know this. It thinks the vision is the story. Put the story first and let the vision speak for itself.