A library may be defined as code that is meant to be reused. Use a constuct that already exists. If that is not possible, see rule 1.
Encapsulation is also important, with the layering of complexity done at lower levels.
The interface should be completely specified. Performance characteristics should be clearly stated. In addition, building on a users existing knowledge will assist in reusability. A library may be a combination of several types. The leaves are instantiated but not the nodes.