The Legend of Zelda: Ocarina of Time Tips

Dead Hand Reveal Without Getting Caught
You need to have the Lens of Truth. Use it when he goes underground. Use it and lay a bomb by the black shadow-looking thing and he will come back up, making it safer to fight him.

Unfortunately, it's only possible to do this against the Shadow Temple Dead Hand, since the one in the Well is actually guarding the Lens and so you won't have it until afterwards.