A well-written puzzle is hard to define. Even a decent puzzle is hard to define. Instead, I'll say some signs of a poor puzzle.
Impossible to confirm
If there are unintended solutions that look just as good as the intended one when explained, you're no longer solving a puzzle, you're trying to guess what's in the mind of the asker. The right solution should be clearly correct if explained, and not just for sounding clever, but for fitting the given conditions better than any alternative. Moreover, no wrong solution should feel this way.
Just a cipher or encoding
"Codes" that are just a short string of numbers and letters aren't fun. You can't do anything better than throw random solution attempts and check if English comes out. There's so many to try and no way to tell which is right except trial and error.
Take the following fictional example (not a real message).
Maybe you Caesar shift each row by a different index. Maybe you split up the grid into 2x3 blocks and interpret them as Braille with vowels being dots. Maybe you convert each letter to ASCII and read down the columns to get numbers and ... There's way too many things to try. Composing multiple codes without intermediate confirmation makes it even worse.
If you're going to write a code, include some hints as to the mechanism used, either through direct clues, thematically in flavortext, or in some apparent feature of the ciphertext.
Loads of pointless backstory
If the entire backstory is "One day I was talking to my friend. [3 paragraphs omitted] He said he'd give me a cookie if I solve the following puzzle", then there's no need for it. Just post the puzzle.
If the backstory has a few clues for the puzzle, but has way more non-clue text, it will do more harm than good as solvers will latch onto red herrings.
Even worse is if the backstory contradicts the idea of the puzzle. Why and how did the victim write a puzzle cluing her murderer with her dying breath?
If the key to a puzzle is hidden in invisible characters or in the edit history, then someone will either find it or not. And someone who doesn't think to check will waste their time fruitlessly trying to make something of what they see, unaware that they have no chance at getting anywhere.
Loads of distraction
A puzzle that is only hard because it includes lots of irrelevant distracted content is a bad puzzle. It wastes the solvers' time, as they are likely to find loads of things they think are clues among the filler. Solvers don't want to search for a needle in a haystack -- or a needle in a stack of needles. If your puzzle is "too easy" without intentional red herrings, then it's not much of a puzzle.
(This doesn't apply to puzzles designed around this principle like spot-the-clue mysteries and word searches.)
If your puzzle is intentionally worded so that any reasonable solver would interpret it wrong, that's not a puzzle but an exercise in mindreading. An answer that's technically correct under some twisted interpretation of the conditions in not an answer, and just invites other misinterpretations that are arguable but equally bad.
Wordplay and circumspect hints are fine, as long as it's a type of puzzle where a solver would expect such.
Why did he do X?
Why did the man kill himself after eating seagull meat? Why did the teacher say "you're lying"? Why did the police officer arrest the woman in green?
I don't know why; I'm not them. I can think of lots of reasons it could have happened. You have a story for it, and I can make up a story too. You're really asking me to guess your story. Your story probably involves some clever trick, but cleverness isn't correctness.
For example, "plug in the result to [this URL] to get the answer."Or, "take the answer to the riddle and use it as a key to solve the cipher to get the solution." Why? Decoding a cipher with the key is a purely rote exercise. It's not fun. Or if you can solve it without the key, that makes the earlier steps moot.
A puzzle can take multiple steps, but they should feel cohesive and justified on their own. It's inevitable to have bits that the solver just needs to execute once they know what to do, but don't make the puzzler do work for the sake of doing work. If you need a follow-the-instruction step to "pad out" the puzzle, you should instead improve the puzzle so that it doesn't need it.