At some point, we may include a fully commented example of a module in this document. For now, please look at the modules directory of the Linux-PAM sources.