How do you create a custom Composer Plugin?

I found some documentation on Composer Plugins, but there wasn't much there.

 Composer Plugins 

Is there any documentation or examples that you can point me to?

Thanks.