To export any part of your work as an unitypackage, select what you want to share in your Project window, do mouse right-click, and select Export Package… option.

Then you will be able to decide if you want to include additional dependencies to your package or not.

Be careful! Including dependencies will always include ALL scripts from your whole project.
When you’re ready, just click on the Export button!

Created file is ready to be shader with anyone! To add it to project, one must double click on it, or execute Assets -> Import Package -> Custom Package from the main menu.