Auto‑Generating SDK Docs with AI: Using Cursor and Claude Code to Diff and Document
This guide explains how to leverage AI tools like Cursor and Claude Code to automatically extract code differences, generate prompts, create markdown documentation, configure Confluence integration, and publish wiki pages, streamlining SDK documentation creation and reducing manual effort for development teams.
Background
When a large feature is added to an SDK, developers must write documentation to explain the implementation and aid future maintenance, which often consumes significant time for gathering details, drawing diagrams, and writing text.
Code Diff Retrieval
Cursor’s chat interface provides Git diff capabilities:
Commit (Diff of Working State): compares uncommitted changes.
Branch (Diff of Main Branch): compares the current branch with the main branch.
Commit record: shows the commit history.
Using the Branch(Diff of Main Branch) command retrieves the code differences needed for documentation.
Prompt Generation
In the Cursor chat, the @tech-doc-generation prompt creates a tech-doc-generation.mdc file that defines how to generate markdown documentation from the diff.
Document Generation
The generated markdown is produced locally by invoking @tech-doc-generation with the branch diff, then the markdown is prepared for Confluence wiki upload.
Claude Code Generation
Claude Code can also generate documentation by processing the same diff. After configuring the claude-code tool, a prompt is issued to produce a markdown file that summarizes the feature implementation.
Automatic Wiki Article Creation
Tokens for Confluence access are obtained from the personal wiki profile. Required environment variables include: CONFLUENCE_URL: wiki domain. CONFLUENCE_PERSONAL_TOKEN: personal access token. READ_ONLY_MODE: set to true to disable writes. MCP_VERBOSE: set to true for detailed logs. ENABLED_TOOLS: comma‑separated list of enabled features.
Enabled tools for Confluence interaction are: confluence_search: search content via CQL. confluence_get_page: retrieve a specific page. confluence_create_page: create a new page. confluence_update_page: update an existing page.
After configuring the MCP service (running in Docker), the markdown is uploaded to Confluence using the custom markdown macro, ensuring proper rendering.
Summary
Cursor focuses on fine‑grained code analysis, producing highly detailed but sometimes fragmented documentation, while Claude Code emphasizes overall architecture and functional description, yielding more cohesive documents. AI‑generated docs free developers from repetitive writing, improve review efficiency, and enhance code quality.
Related Resources
mcp‑atlassian service
claude‑code documentation
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
