There are really just 2 steps to writing Tsunderes well.
Step 1. Read/watch Ranma 1/2, because Akane Tendo is literally the OG original Tsundere who started the whole trope, and also one of the best examples.
Step 2. Understand that Akane is just done like that for the comedy, and then try to dig a little deeper as to the motivations for being a "tsundere" type in a more serious setting. What part of IRL romance is this trope representative of? Because, in order for it to be as big a thing as it is, it HAS to be hitting on something that is real and strikes a chord with people.
The answer to step 2 is that the tsudere trope represents a girl who is 1. young, 2. expected to be in a relationship with a guy her same age. 3. because girls mature faster than boys, she is disappointed with how immature said guy is. 4. because she's supposed to be in a relationship with this looser, she gets mad and wants to whip him into shape and force him to start acting in a more mature and capable manner.
That in mind, going back to the Akane Tendo example, her crush on Dr. Tofu is actually a pretty important point in the tsundere character as well. Dr. Tofu represents the kind of guy (minus the comedic short-falls he has) that the tsundere wishes she could be with, and also the kind of guy she's trying to mold her love interest into.
(Also, you are really not alone in failing to do tsundere right. A lot of people just do a surface take on the behaviors in the trope and fail to consider the motivations. That failure to consider the motivations and only playing out the behaviors is the thing that makes it all go so wrong.)
EDIT: Gotta add, the #1 most common disasterous error people make while writing Tsundere characters is they miss the part where the guy who's supposed to be the Tsundere's love interest is supposed to be immature and incompitent. Tsunderes simply CANNOT exist in a setting where the guy is smart, capable, and mature. Said guys instantly transform Tsunderes into flirty school girls honestly crushing on them, instantly eliminating all Tsundere-like aspects of them. Any girl who manages to keep those Tsundere behaviors with a smart, capable, and mature man is just a psychopath. The behavior of the male side is every single bit as important as the female side in order to make the Tsundere mechanic work.