In The Sims and The Sims 2, bookshelves contain an indefinite number of skill and non-skill books.
The Sims 3
In The Sims 3, bookshelves hold books, but books must be purchased individually. The interface allows the player to move books into and out of the bookshelf. Unlike in The Sims and The Sims 2, where Sims can get the same books from different shelves, in The Sims 3, different bookshelves will have different books in them. (eg. Bookshelf 1 has a cookbook in it but not Bookshelf 2. The Sim cannot get a cookbook from Bookshelf 2, unless the cookbook is placed in Bookshelf 2.)
Bookshelves placed on residential lots automatically contain low level skill books. Bookshelves placed on librarycommunity lots automatically contain a variety of books.
The Book Corral has an environment score of 7. It is an essential component of any world because when placed in a library is fills up with skill books, allowing townies and NPCs to improve their skills autonomously.
Penningway Bookshelf has an environment score of 14. It is an essential component of any world because when placed in a library is fills up with skill books, allowing townies and NPCs to improve their skills autonomously.