I'm talking about using Rituals to create a magical trap of whatever type
Ok, imagine this:
Arcane ritual, "Flagstone Flip" on casting, it affects a stonework floor, 1 square.
Anyone who goes over that square, triggers it, who isn't attuned/exluded from triggering it.
Attck = Int vs Reflex
1d6+int modifier damage, & knocked prone.
Lasts until triggered.
Also, it can be made permanent by use of a focus item, or the like, and resets every 10 minutes.
Now, why's that good?
a) nice defence that BOTH enemies and the party can use.
b) You can use it against enemies...cast it once or several times in an area, lure the enemy into it, etc.
c) It's logical (within D&D). If an NPC can have a trap the NPC should too.
Preparing the battleground is a good idea, as old Sun Tzu I'm sure would note
Having magical traps created by rituals solves also the "
How the HELL did he have all these traps if he's a wizard, not a mechanical genius?" problems, also, you can have more than the usual "
10' x 10' pit trap", or a pit trap that WON'T drop you in it by mistake!
See that's one thing I always, always have in my games, unless the NPC is a lunatic:
he must have a method of avoiding the trap!
who the hell wants to go through a room chocked full of death traps that some gnome with a maniacal bent, has made, eh?

Would YOU trust it? Hell no!! Odds are too high it'd trigger by accident and you'd become a shiskebab with a steel-bladed hedgehog rammed up umentionable places !

.
That's why you'd either have to use magical traps, or "left/right choice" design (by that I mean, say having 2 corridors parallel, one full of traps, other safe, intruders have to make a choice, but you know which is completely safe)
I like making traps that make SENSE, ya know?

Who the hell would put a poison gas trap in their wife's jewel box, eh?! That's just asking for divorce, lol
Alarm traps, ones that knock folk out, paralyze them (Wyvern Watch), trip them, and so on are usually much better where there's risk of setting it off accidentally.
Additionally, a book full of magicial trap rituals = great treasure horde item!!
You can also imagine a hunt/chase, where the hunted takes time to "cast" some traps to slow down or ambush the pursuers.
You lose time, but it maybe worth it, and have a breather while you do so.