Template System

Comprehensive guide to the MCP Confluence ADF template system for automated documentation generation.

Overview

The template system provides a structured approach to generating consistent, high-quality documentation using YAML-based templates that are processed by Claude AI to create rich Confluence content.

graph LR
    A[YAML Template] --> B[Template Engine]
    B --> C[Claude Processing]
    C --> D[Markdown Output]
    D --> E[ADF Conversion]
    E --> F[Confluence Page]
    
    style A fill:#e1f5fe
    style C fill:#f3e5f5
    style F fill:#e8f5e8

Template Architecture

Two-Phase Processing

The system uses a two-phase approach:

  1. Phase 1: YAML to Intermediate Template

    • Parse YAML structure and metadata

    • Generate intermediate Markdown with Claude instructions

    • Validate template structure and requirements

  2. Phase 2: Claude Processing to Final Content

    • Claude processes instruction comments

    • Generates contextual content based on user input

    • Maintains ADF-compatible formatting

Template Components

YAML Frontmatter

User Context Requirements

Structure Definition

Template Types and Use Cases

1. API Documentation Templates

  • Purpose: Document REST APIs, GraphQL APIs, and service interfaces

  • Includes: Authentication, endpoints, request/response examples, error codes

  • Best for: Developer-facing documentation

2. User Guide Templates

  • Purpose: Step-by-step guides for end users

  • Includes: Getting started, tutorials, troubleshooting

  • Best for: Customer-facing documentation

3. Technical Specification Templates

  • Purpose: Detailed technical specifications and architecture

  • Includes: System design, data models, integration patterns

  • Best for: Internal technical teams

4. Quick Start Templates

  • Purpose: Rapid onboarding and initial setup

  • Includes: Installation, basic configuration, first steps

  • Best for: New user onboarding

Template Creation Workflow

1. Design Phase

Identify Documentation Needs:

Plan Template Structure:

  • Define sections and organization

  • Identify reusable components

  • Plan ADF elements (panels, code blocks, etc.)

  • Determine user context requirements

2. Development Phase

Create YAML Template:

Test and Validate:

  • Use template generation tools

  • Test with different user contexts

  • Validate ADF conversion

  • Review generated content quality

3. Deployment Phase

Template Registration:

  • Save in templates/yaml/ directory

  • Ensure proper naming convention

  • Update template discovery system

  • Document template usage

Advanced Template Features

Conditional Content

Templates can include conditional logic based on user context:

Component Reuse

Templates support component references for reusable elements:

Dynamic Sections

Generate sections based on user context:

Template Components Reference

Basic Elements

Headers and Text

Info Panels

Warning Panels

Success Panels

Note Panels

Advanced Elements

Code Blocks

Expandable Sections

Tables

Claude Instructions

Instruction Format

Claude instructions are embedded as comments in the intermediate template:

Content Generation Guidelines

Task Definition:

  • Clear, specific instructions for content generation

  • Include relevant context variables

  • Specify expected content type and length

Purpose Clarity:

  • Explain why the content is needed

  • Define the target audience

  • Outline user expectations

Formatting Instructions:

  • Specify ADF components to use

  • Include formatting preferences

  • Define code block languages and panel types

Example Instructions

API Endpoint Documentation

Security Guidelines

Template Management

Organization and Discovery

Directory Structure:

Template Metadata:

  • Name and description for discovery

  • Version for tracking changes

  • Category for organization

  • Sections for filtering

  • Author and maintenance info

Version Control

Template Versioning:

Backward Compatibility:

  • Maintain compatibility with existing user contexts

  • Provide migration guides for breaking changes

  • Version deprecation notices

Quality Assurance

Template Validation:

  • YAML syntax validation

  • Schema compliance checking

  • Required field verification

  • Component reference validation

Content Quality:

  • Generated content review

  • ADF conversion testing

  • User context validation

  • Documentation accuracy

Integration with MCP Tools

Template Discovery

Use MCP tools to discover available templates:

Expected Response:

Template Generation

Generate content using templates:

Interactive Context Collection:

Custom Template Creation

Create new templates through natural conversation:

Claude Response:

Best Practices

Template Design

Structure Guidelines:

  • Start with overview/introduction

  • Use logical section progression

  • Include practical examples

  • End with next steps or references

Content Instructions:

  • Be specific in Claude instructions

  • Provide sufficient context

  • Include formatting preferences

  • Define content scope and depth

User Experience:

  • Minimize required user context

  • Use clear, descriptive prompts

  • Provide helpful defaults

  • Validate user inputs

Performance Optimization

Template Efficiency:

  • Keep templates focused and modular

  • Reuse common components

  • Cache frequently used templates

  • Optimize Claude instruction clarity

Content Generation:

  • Use specific instructions for better results

  • Provide adequate context for Claude

  • Structure content logically

  • Test with various user inputs

Maintenance

Regular Updates:

  • Review and update templates quarterly

  • Gather user feedback for improvements

  • Update examples and best practices

  • Maintain compatibility across versions

Quality Control:

  • Test template generation regularly

  • Validate ADF conversion accuracy

  • Monitor content quality metrics

  • Address user-reported issues

Troubleshooting

Common Issues

Template Not Found

Error: Template 'template-name' not found Solution: Verify template exists in templates/yaml/ directory

YAML Parse Error

Error: Invalid YAML syntax in template Solution: Validate YAML formatting and structure

Missing User Context

Error: Required context 'variable_name' not provided Solution: Provide all required user context variables

ADF Conversion Failure

Error: Failed to convert generated content to ADF Solution: Check Markdown formatting and ADF compatibility

Debug Mode

Enable detailed logging for troubleshooting:

Debug Information Includes:

  • Template discovery and loading

  • YAML parsing steps

  • Context variable substitution

  • Claude instruction processing

  • ADF conversion details

Getting Help

Built-in Help:

Community Resources:

  • Template examples repository

  • Community-contributed templates

  • Best practices documentation

  • Issue tracking and support

Advanced Topics

Template Inheritance

Create base templates that can be extended:

Extended template:

Dynamic Content Generation

Templates that adapt based on external data:

Multi-language Support

Templates supporting multiple programming languages:

Next Steps

Last updated