In terms of personal preference, I pretty much enjoy them in the order in which they were released.
1. Curse of the Black Pearl
2. Dead Man's Chest and At World's End (they're kind of tied for me)
3. On Stranger Tides
4. Dead Men Tell No Tales
In terms of my opinion on the writing, I'd rank them about the same. Ultimately, the original trilogy was, on the whole, incredibly genius and well-written (with the second, and especially the third, being underrated and unduly hated by movie critics and general audiences alike; I guess it's just us fans that really give these movies a chance). However, At World's End is still a bit messy in some places. I wouldn't necessarily go so far as to call it "convoluted" as I've often heard people describe it, just sometimes hard to follow (I still have difficulty keeping track of all the deals and double-crossings going on throughout the film). And that is saying something because I am usually able to follow just about any story really well, and I feel like the complexity of the Pirates trilogy is one of its strengths in the first place.
On Stranger Tides is fun. I love the darker, more mysterious atmosphere of the film and I can appreciate the departure from the over-arcing story of the original three. It's kind of a breath of fresh air in that sense. But it's still a pretty poor follow-up to At World's End (we never find out what happened to the EITC, we never find out what the Brethren Court's success does for all these freedom-fighting pirates in the long run, etc.). The involvement of Ponce de Leon's 14th Century silver chalices also makes no sense in an ancient, pagan supernatural ritual. Even worse, they tried too hard to copy Tim Power's original "On Stranger Tides" book, when it really should have just served as light inspiration. It seems so incredibly obvious to me that the Fountain of Youth would be the perfect follow-up to where we leave Elizabeth, Will, and Jack in the third film. Elizabeth would no doubt be interested in finding a way to somehow remain with Will forever and work with the fate which they were given, and Jack still seems to desire a chance at immortality. I get that Keira Knightley wasn't particularly interested in another film, but Elizabeth really should have been in the movie, and for a lot of it at that. And they needed to continue exploring Jack's journey of wrestling between his selfish pursuit of freedom (be it through the Black Pearl, an absence of debts, or immortality) and his selfless desire to do the right thing (specifically through outsmarting everybody else). I liked Angelica, but I didn't really feel like her and Jack's story was really the best that the writers could offer us in terms of Jack's continued journey. He didn't really grow much at all by the end of the film, despite being raised to main-character status.
Dead Men Tell No Tales was a fun adventure (a really fun adventure, honestly) but it screwed up lots of continuity and didn't do Jack much justice. Jack was my least favorite part of the film. Loved Henry, Carina and Salazar. Enough said there.
Ultimately, as fun as the fourth and fifth films were, they were unnecessary. They could have been more relevant (i.e. they could have been more tied to the other three), but they weren't, so the creators should have stopped at At World's End. But I also don't hate the last two movies either. I still love them, flaws and all. I love this franchise. It's pretty great, no matter what the majority of people may say.