Among the various CIA documents Wikileaks has released recently is instructions for how covert operatives can handle aggressive screeners at airports.
I’ve not read the document in detail yet (it’s a PDF at the link), but it seems to me that it has some useful hints for travelers.
Unfortunately, it doesn’t say much about dealing with the increasingly out of control ICE & CPB agents in the US, but it is good general primer on how to avoid that body cavity search.