Learning jQuery has an excellent posting on recommended practices when creating a custom plugin. If you are moving beyond a simple plugin, this post is a great guide.