Minecraft wiki entry for Traps, associated text: First dig a hole 2×2 wide and 3 deep. Seal off the top with matching blocks. Surround the hole with a 2 block high wall of wool, leaving a Steve-sized gap for your escape route. Do not fill it back in yet. In the spot where you left the gap, dig out an escape route leading directly away from the mine. Return to your wool pit.
Place two powered rails (keeping them unpowered) along the wall opposite of your escape route (you do NOT want the TNT carts in the way of your escape). Here's where things start to get tricky. You need to place at least two TNT carts on the same powered rail. The trap will not work otherwise. Placing the first will of course be easy. For subsequent carts, you will need to right click carefully on the side hitbox of the track that the first cart is on. The top will not work, as the first cart is in the way. You'll know it worked if the minecart's shadow gets noticeably darker, or know, if your hand empties. Once you find the right spot, feel free to place as many TNT carts as you care to sacrifice. More carts means a bigger, more powerful explosion, and significantly less chance of escaping the blast (though it's not much of a chance to begin with). Just make sure not to bump the carts.
Now is where things go from tricky to deadly. One wrong move will make you the victim of your own trap. This is when you hold Shift like your life depends on it, because it absolutely does. While holding Shift and not letting go, place the sculk sensor, either adjacent to or in front of your escape hole. Now, still holding Shift, sneak your way into your escape hole. This is where you finally close the gap in the Steve-sized wool wall hole, making sure there is no hole for the Sculk Sensor to hear you through. You should be safe by this point, but if you want to be extra careful, continue sneaking as you move away from your newly planted mine.