テンプレート:Documentation/doc
Put documentation about a <template> in <template>/doc and then at the end of <template> put this:
<noinclude>{{Documentation}}</noinclude>
in a single line.
Template:Documentation will look if <template>/doc exists and if yes it will include <template>/doc in <template> page itself only when looking directly at the <template> page (not when you use actually use the <template> itself).