Skip to main content

Best Practices

Template Design Best Practices

Template Structure

Design templates with clear structure and proper data fields: Template Data Fields:
  • Use descriptive field names (recipientName not name)
  • Group related data in objects (customerInfo.name, customerInfo.email)
  • Use arrays for repeating data (items[] for invoice line items)
  • Include validation rules for required fields
Template Layout:
  • Design for consistent branding across all documents
  • Use responsive layouts that work with varying data amounts
  • Include conditional sections for optional data
  • Test with both minimal and maximum data scenarios

HTML Optimization for PDFs

Document Structure

Always use proper HTML5 structure for consistent results:

CSS Best Practices

Typography for PDFs:
Page Break Control:
Responsive Tables:

Image Optimization

Responsive Images:
Image Guidelines:
  • Use compressed images (PNG for graphics, JPEG for photos)
  • Keep images under 2MB each
  • Embed small images as base64 data URLs
  • Use appropriate resolution (300 DPI for print quality)

MCP Integration Best Practices

Template Organization

Template Naming:
  • Use descriptive, memorable template names
  • Follow consistent naming conventions (company-certificate, monthly-invoice)
  • Avoid special characters and spaces in template names
  • Document template purposes and required data fields
AI Conversation Flow:
  • Train users on how to request documents clearly
  • Provide examples of good prompts for different document types
  • Set up template descriptions that help AI agents understand usage
  • Test conversation flows with different AI assistants

Data Collection Strategies

Structured Prompts:

API Usage Best Practices

Error Handling

Implement robust error handling with retry logic:

Security Best Practices

API Key Management

DO

  • Store keys in environment variables
  • Use different keys per environment
  • Rotate keys periodically
  • Monitor key usage patterns
  • Use server-side API calls only

DON'T

  • Commit keys to version control
  • Share keys via email/chat
  • Use same key across projects
  • Embed keys in client-side code
  • Store keys in plain text files
Environment Configuration: