After losing scores of valuable employees (and trade secrets) to competitors, a growing number of employers is asking, or requiring, employees to sign noncompete agreements.

By signing a noncompete agreement, also known as a “covenant not to compete,” an employee promises not to work for a direct competitor for a specified period of time after he leaves the company. Here’s the lowdown on whether it’s worth asking your employees to sign one, and how to create an agreement that will pass muster with a judge.