To counter it, you should scout it. If you see a Twilight Council before other tech, as well as 2 gasses, he's probably going DTs. Blink Stalkers are an option, too, though, so it's best to scout the Dark Shrine if possible. Observers are the best detection against DTs, in my opinion. Oracles take more skill to use but if you can kill enough workers, the DT player is pretty much done for. A Forge + Cannon is the cheapest detection you can get but it can be killed easier (don't do Forge/Cannon blindly, btw).
Now, even if you hold off the DTs, you still have to watch out for Chargelot/Archon. Depending on the nature of the DT build (which you can judge by how early it hits and how many DTs there are, as well as his Probe and Gateway count) he could transition into 1-base Zealot/Archon, 2-base Zealot/Archon, or add a different tech and a 3rd base.
If you went the Oracle route and killed like 6 workers or more, you should be able to just make Stargate and Gateway units and proceed to win (here's a little hint: Oracles kill Archons for supply, Void Rays kill Stalkers when you press the Prismatic Alignment button), so long as you keep a lead on workers.
If you went the Obs route and want to stay on Robo, you'll need to get Zealots, Immortals, and Colossi. If you can get 3+ Colossi along with Gateway units, you can have the army advantage over Chargelot/Archon. Blink Stalkers are good if you can micro them. Make sure you don't get behind on economy.
If you went the Cannon route, you'll probably want to get a Robo or Stargate. You don't want to have to make a ton of Cannons (due to them being a good target) and if you want to attack you'll need mobile detection.
There is another strategy to take the win that works if the opponent is dedicated to DTs right into Chargelot/Archon without any other tech or upgrades. It's easiest if you go the Cannon route, sort of easy if you go the Obs route, and a bit harder if you go the Oracle route, and that is to make DTs of your own. DTs + detection beats DTs without detection any day.
Also, the MSC + Photon Overcharge is nice when defending against DTs and Chargelot/Archon, and nice to help secure an expo.
In general, you need to kill any proxy Pylons you can find... it buys you time vs most early rushes, including DTs.
Edited by NinjaDuckBob on 5/9/2013 2:44 PM PDT