Build your own library

Do we have any step-by-step tutorials to create a library? Want to reuse the code in different projects.