Generic library rules (#571)