Claude Skills Guide

Claude Code Confluence Documentation Guide

Confluence remains a cornerstone for team documentation in enterprise environments. Integrating Claude Code with your Confluence workspace transforms static wiki pages into dynamic, code-generated content that stays current with your codebase. This guide shows developers and power users how to build that integration from the ground up.

Prerequisites

Before you begin, ensure you have the following:

You do not need administrator-level Confluence access to get started. A user account with page creation permissions suffices for the workflows described here.

Setting Up the Confluence API Connection

The first step involves configuring Claude Code to communicate with your Confluence instance. You need your Confluence domain, email, and an API token.

Create a local configuration file to store these credentials securely:

# Store these in your shell environment or a .env file
export CONFLUENCE_DOMAIN="your-company.atlassian.net"
export CONFLUENCE_EMAIL="your.email@company.com"
export CONFLUENCE_API_TOKEN="your-api-token-here"

Never commit API tokens to version control. Use environment variables or a secrets manager instead.

Using the MCP Protocol for Confluence Integration

Model Context Protocol (MCP) servers extend Claude Code capabilities. While Atlassian does not provide an official MCP server for Confluence, you can build a custom integration using the mcp-builder skill or connect via existing HTTP-based tools.

For teams using the Atlassian REST API directly, a simple Node.js wrapper handles authentication and page operations:

const axios = require('axios');

class ConfluenceClient {
  constructor(domain, email, token) {
    this.client = axios.create({
      baseURL: `https://${domain}/wiki/rest/api`,
      auth: { username: email, password: token },
      headers: { 'Content-Type': 'application/json' }
    });
  }

  async createPage(space, title, content) {
    return this.client.post('/content', {
      type: 'page',
      title,
      space: { key: space },
      body: { storage: { value: content, representation: 'storage' } }
    });
  }

  async updatePage(pageId, content, version) {
    return this.client.put(`/content/${pageId}`, {
      id: pageId,
      type: 'page',
      body: { storage: { value: content, representation: 'storage' } },
      version: { number: version + 1 }
    });
  }
}

This client forms the foundation for automated documentation pushes from Claude Code.

Generating Technical Documentation with Claude Skills

With the connection established, use Claude skills to generate the actual documentation content. The pdf skill excels at creating formatted technical documents from code analysis. The docx skill generates Microsoft Word-compatible output that Confluence imports cleanly.

For API documentation specifically, ask Claude Code to analyze your codebase:

Analyze the /src/api directory and generate:
- Endpoint summaries with HTTP methods
- Request/response parameter tables
- Authentication requirements
- Example cURL commands for each endpoint

Claude Code scans your code, extracts docstrings and type annotations, and produces structured output you can pipe directly to Confluence.

Automating the Documentation Pipeline

Manual documentation updates fail because they require deliberate action. Automate the pipeline so documentation regenerates when your code changes.

A practical approach uses a Git hook or CI trigger:

# In your project's .git/hooks/post-commit
#!/bin/bash
cd /path/to/your/project
claude --print "Generate API documentation for the /src/api directory in markdown format" > /tmp/api-docs.md
node /path/to/confluence-push.js --title "API Documentation" --file /tmp/api-docs.md

This script runs after every commit, analyzing your API code and pushing fresh documentation to Confluence. The supermemory skill complements this workflow by remembering your documentation preferences across sessions—output format, Confluence space, and page IDs.

Handling Different Content Types

Technical documentation varies widely. Adapt your approach based on content type:

Architecture Decision Records (ADRs): Use Claude Code to draft ADRs from discussion summaries. Provide context about the decision, alternatives considered, and consequences. The docx skill formats these for Confluence storage format.

Runbooks and Incident Response: The tdd skill helps structure runbook content with clear step sequences. For on-call documentation, include exact commands and expected outputs.

Release Notes: After each deployment, prompt Claude Code with git log output:

Generate release notes from this git log:
[insert git log output here]

Format as Confluence-compatible HTML with:
- New features (green highlight)
- Bug fixes (yellow highlight)  
- Breaking changes (red highlight)

Managing Page Versions and Conflicts

Confluence tracks page versions. When automating documentation updates, increment the version number correctly or your updates fail.

The API client shown earlier handles this by fetching the current version, adding one, and sending it with the update request. Implement conflict detection for teams editing documentation manually:

async function safeUpdate(client, pageId, newContent) {
  const current = await client.getPage(pageId);
  const currentVersion = current.version.number;
  
  // Add a check: has content changed significantly?
  if (current.body.storage.value === newContent) {
    console.log("No changes detected, skipping update");
    return;
  }
  
  return client.updatePage(pageId, newContent, currentVersion);
}

This prevents overwriting manual edits made between your automated pushes.

Best Practices for Claude-Confluence Workflows

Keep your documentation maintainable by following these principles:

Use a dedicated Confluence space for automated documentation. This isolates machine-generated content from human-edited pages and simplifies permissions.

Include source code references. Every documented endpoint should link back to the actual source file. Confluence’s macro system supports this with relative links.

Version control your documentation source. Store the markdown or code that generates documentation in your repo. This gives you rollback capability and an audit trail.

Test output before pushing. Run the documentation generator locally first. Review the output in a text editor, then push to Confluence only after verification.

Extending the Integration

Once the basic pipeline works, expand capabilities:

The algorithmic-art skill even generates custom diagrams for technical content when existing tools fall short.


Claude Code paired with Confluence closes the documentation gap that plagues most development teams. Start with a single automated page, measure the time saved, and expand the pipeline incrementally. Your future self debugging production issues at 2 AM will thank you for documentation that actually matches the code.

Built by theluckystrike — More at zovo.one