Scripture isn't just a set of nice stories. (Many of them are pretty gory, actually.) No, they were written to teach us in righteousness and skillful living.
For everything that was written in the past was written to teach us, so that through the endurance taught in the Scriptures and the encouragement they provide we might have hope. (NIV)