Nephi searched and pondered the scriptures, and he wrote out his impressions. What he wrote about the scriptures became scripture (see also Abraham 1:31).
There are negative examples in the Old Testament, such as those of Saul, David, and Solomon. They murdered and transgressed morally. At some point in their lives they stopped walking in the Spirit and gave way to the lusts of the flesh. Specifically, they must have stopped reading the scriptures and praying. They were weakened and succumbed to temptation. Nephi, on the other hand, is an impressive example of one who continued his walk in the Spirit; he knew what to do and did it: “My soul delighteth in the scriptures, and my heart pondereth them… . My soul delighteth in the things of the Lord; and my heart pondereth continually upon the things which I have seen and heard.”
Joseph Smith laid out the way to walk as clearly as anyone. He wrote: “We [Latter-day Saints] believe in being honest, true, chaste, benevolent, virtuous, and in doing good to all men… . If there is anything virtuous, lovely, or of good report or praiseworthy, we seek after these things” (Articles of Faith 1:13).