One of the main rules of D&D combat is to never let your arcane spellcasters get caught up in melee combat. Which makes it somewhat odd that Armor of Agathys isn’t just designed for exactly that situation, but entirely depends on it.
The spell is exclusive to the Warlock list, and the basic gist is that it coats the caster in a thick layer of ice. This has the dual benefit of providing temporary hit points and damaging anybody who lands a melee hit for as long as at least some of the hit points remain.
Both the damage and hit points work out at five per spell level, which looks utterly pathetic on paper but is roughly the equivalent of a d8. Early on in a campaign it will be laughably easy to break and is unlikely to apply its damage more than once, but it’s not too hard to imagine a situation where a 20 hit point Armor of Agathys may last for two or three hits.
Dealing 40-60 damage isn’t that bad for a fourth-level slot, especially as it applies automatically and comes with a decent pool of temporary hit points, but this doesn’t actually make it a good spell.
For one thing, the nature of D&D is that your foes will be scaling up just as quickly as your character does. By the time you’re able to put up a decent shield, there’s a good chance that you’ll be running into foes that can smash through it with relative ease.
And once it’s gone, you suddenly find yourself either a) stood right next to an angry foe who now has a rather frosty grudge and is probably strong enough to grind you into a fine paste, or b) standing across the room from a smug-looking archer who completely negated one of the major benefits of your spell.
There are plenty of good defensive spells out there, but they tend to fall into one of two categories. The first of these are reactive abilities like Shield and Expeditious Retreat, which you can prepare as an insurance and use when the situation turns sour. The second are the long-term buffs like Mage Armor and Barkskin, which you can cast at the start of the day and happily leave ticking away in the background while you adventure.
The fact that Armor of Agathys takes a full action to cast means that it’s not exactly something you’re going to be falling back on once you’ve already been engaged in melee. At the same time, as it only lasts one hour you can’t really cast it in advance unless you’re very sure of what’s in the next room and are supremely confident that it’s something you don’t mind running up to with your icy torso offered up for the stabbing.
It doesn’t require concentration so there is the potential for some cheesy multiclass shenanigans with raging Barbarians or Druids in the shape of polar bears, but even then it’s not wildly useful.
There are a couple of slightly more reasonable applications out there, of course. Pact of the Blade Warlocks may find some use for it as a way to effectively use their spell slots without having to take a break from stabbing people, and it could certainly be put to hilarious effect if you run into Goblins at higher levels and feel like tricking a mob of them into freezing themselves to death.
However, in both these cases there are probably more efficient ways to use a valuable spell slot. While it may lack the comedic effect a Fireball is probably better at cleaning out hordes of Goblins, while Blade-locks could make use of Hex and other more utility-focused abilities.
Armor of Agathys is a fairly cool spell, but unfortunately it isn’t a particularly effective one.
Warlocks get a fairly limited selection of spells to choose from. Armor of Agathys probably shouldn’t be too high on the list of priorities.
Armor of Agathys
Casting Time: 1 action
Components: V, S, M (a cup of water)
Duration: 1 hour
A protective magical force surrounds you, manifesting as a spectral frost that covers you and your gear. You gain 5 temporary hit points for the duration. If a creature hits you with a melee attack while you have these hit points, the creature takes 5 cold damage.
At Higher Levels: When you cast this spell using a spell slot of 2nd level or higher, both the temporary hit points and the cold damage increase by 5 for each slot level above 1st.