Start from the rule the letter serves
ABA Model Rule 1.5 provides in paragraph (b) that the scope of the representation and the basis or rate of the fee and expenses for which the client will be responsible shall be communicated to the client, preferably in writing, before or within a reasonable time after commencing the representation, with an exception for a regularly represented client charged on the same basis or rate. Changes in the basis or rate must also be communicated.
States adopt their own versions of the Model Rules, and firms often go further than the minimum. I would ask the firm's general counsel or risk partner to define which clauses are required for each matter type before any drafting is automated. That definition becomes the template configuration.