Study: Begin[] and BeginPackage[]
The URL below has several resources, one of which is a public lIbrary (there are also private controlled ones).
http://www.wolfram.com/resources/?source=nav
(http://library.wolfram.com/ is the public library, it is at bottom of page, has no icon. it is an older library that required (requires) communication with WR employees, using older "web technology", is less used but still has important past posts, such as code from certain Mathematica functions that are no longer shipped with new versions)
Mathematica has an excellent Package system, more stable/mature than "linux alternatives". But to know this it must be studied.
https://sourceforge.net is a site that has a few "GPL'ed" (free) Packages and projects for Mathematica.