How can I implement SyntaxInformation and Option defaults in my packages?

I have a couple of questions related to usage messages and syntax styling in developed packages. Mathematica has a powerful Code Assist functionality, and the fundamental question is how you should code your packages so your packages behave like native Mathematica functions. To examplify my question:

Plot[Sin[x], {x, 0, 2 \[Pi]}, LabelStyle -> Directive[Bold, Medium]]

When typing the functions, Mathematica automatically provides feedback and help:

The options displayed are those that are only valid for the Plot function. Similarly, when you have selected a valid options, valid alternatives are suggested by Mathematica:

How can I implement this functionality in my own packages?
And the second question, how can I prettify my usage messages to be displayed with mathematical typesetting? Mathematica provides nicely typeset usage messages:

Hi,

I would suggest to have a look at chapter 13.4 of the book Programming with Mathematica by Paul Wellin. It is an excellent book and you will learn how to achieve what you want to do.

You will also find some information here. David Reiss who is a very experienced member of this Community and who produces fantastic posts, has an excellent Tutorial on building packages.

There is also lots of stuff on the auto completion feature on StackExchange.

Hope this helps.

Cheers,

Marco

Thanks Marco. I am already reading Paul Wellin’s book and have found some useful tips there. The other links were also very informative, especially the blog on Stackowerflow. Thanks again!