WARNING: This post contains major spoilers for Shadow and Bone and minor spoilers for The Bone Season.
Writing a good villain isn't something that's easy to accomplish. People are complex, and if your villain is a person, then chances are that your villain is complex, too. Complex is hard (and subjective), so I can't give easy advice for how to accomplish it.
But I can give one simple piece of advice for not writing a bad villain:
Give your readers the option of siding with the antagonist.
I was recently reading a Goodreads review of The Bone Season (a book I will review sometime in August), where the reviewer compared the plot to Shadow and Bone. I didn't disagree with this comparison.
But one place where Shadow and Bone succeeded whereas the other book failed was in its villain. Shadow and Bone is by no means a perfect book, and the Darkling isn't a perfect villain (falling in love with a girl younger than you by at least a century? seriously?) but he is very compelling. Why?
3) There is actually a good reason behind his actions. He wants to protect the Grisha from an outside world that's hostile to them. (Personally, I agreed more with the Darkling's actions than I did with Alina's.)
Emphasis on that last point. Not only do you want your readers to understand your villain's actions, but you want to give said readers a chance to decide for themselves whether or not they agree with your characters--not only is that a sign that you respect their intelligence, but by thinking about the book, readers are more likely to remember it.
(Or if you're looking for an even better example than Shadow and Bone, I highly recommend Watchmen--the graphic novel, not the movie.)
Now let's talk about the villains in The Bone Season. I didn't actually finish the book, so maybe the head of the Rephaim (I don't care enough to look up her name) has some sort of underlying depth that I completely missed. But all I saw were extremely heavy-handed ways to show how mua-ha-ha evil she was (ie, enslaving humans and replacing their names with numbers, needlessly killing an innocent human, etc.) This was not only ridiculous, but insulting. I felt like I was being forced to take the protagonist's side because there was no other alternative. (The same can be said for the evil king in the Throne of Glass series.)
So yes, there is your basic primer for not writing a bad villain.
*This is why other people find him compelling. I would probably agree if I were fifteen, but I've already seen so many hot villains over the course of my life that this trope has almost lost effect.
Yes, I know this type of post has been written to death. But if crappy books like The Bone Season are getting mid-six-figure deals, then some people clearly haven't gotten the message.