How can I improve my melee skills in TF2?
You can always play in offline mode and hone your melee skills vs. the computer players there. While they wont mimic the true skills of people you meet online, it's better than nothing at all.
Additionally, learn the different speeds, ranges and hit timing of each weapon. You can swing the scout bat much faster than the heavy can punch, for example. The demoman's "Eyelander" sword has a much larger range than most weapons and can hit from what feels like a non-melee distance, compared to most other classes melee that requires you to be much closer. Also, each weapon has a slightly different "delay" between when you click and when the swing actually has the window to connect. It's minor, but worth getting a feel for.
Lastly, learn your limits. It's not wise to melee certain classes if avoidable. Pyros and heavies are dangerous targets to melee, and scouts tend to be too fast to hit reliably in melee range.
I agree with the other answers here: That practice is the best way to improve your melee skills.
As part of the 2010 Christmas update, a new game mode was released: Medieval Mode. This is a melee only mode, with the exception that the Sniper can use the Huntman and the Medic can use the Crusader's Crossbow because these are considered to be Medieval weapons. I have found this a great way to practice my (admittedly poor) melee skills.
Currently this game mode is only available on the DeGroot Keep map, which makes it really easy to find a medieval game to practice on:
- From the title screen, click Start Playing
- Ensure that the Simplified List option is unticked
- Enter
cp_degrootkeep
into the Map textbox
This will filter the server list to only show active games that are currently playing Medieval Mode.
Note: For the full range of allowable weapons in Medieval Mode, I recommend checking the Team Fortress wiki.
One useful tactic I've found is to keep your distance. You don't have to be "hugging" your enemy to hit them, and if you do it will make it harder for you to turn and smack them when they move around. Melee range might be short but it's not zero, and it's much easier to hit them when you have a bit of distance.
I have to confess I have trouble keeping the distance myself. I'd recommend practicing a bit offline - even by doing something as silly as hitting the wall - just to see how far you can be from the contact point.
Also, whenever I melee someone I tend to move backward a bit and then forward again in-between weapon swings, for the same reason - to be able to track them easier.