DEV Community

lucanu
lucanu

Posted on

Turn LLM Prompt Packs into Ready‑to‑Ship SaaS Documentation

A recent survey of 1,200 indie SaaS founders showed that 68 % spend more than 20 hours a month writing and updating product docs. ## 1. Grab a Prompt Pack and Wire It to Your Repo

Prompt packs are curated collections of prompts that output markdown, OpenAPI specs, or even Swagger UI snippets. The "LLM‑Doc‑Starter" pack on GitHub (https://github.com/llm‑doc‑starter) contains 12 prompts tuned for typical SaaS features: onboarding, billing, webhook lifecycle, and API error handling. To use it locally, clone the repo and install the helper CLI:

git clone https://github.com/llm-doc-starter.git
cd llm-doc-starter
pip install -r requirements.txt # installs openai, jinja2, python‑dotenv
Enter fullscreen mode Exit fullscreen mode

Create a .env file with your OpenAI key, then run the starter command for the billing module:

llm-doc generate --module billing --output docs/billing.md
Enter fullscreen mode Exit fullscreen mode

The CLI injects the prompt, streams the response, and writes a fully‑formatted markdown file. The result includes a table of contents, code samples, and a FAQ block, all ready for publishing. Takeaway: A single CLI call transforms a prompt pack into a version‑controlled doc file; commit it and you have the source of truth. ## 2. Automate Updates with GitHub Actions

Docs become stale when the code changes. Tie the prompt pack to your CI pipeline so every push to main triggers regeneration. Add a workflow file .github/workflows/doc-gen.yml:

name: Regenerate Docs
on:
 push:
 branches: [main]
jobs:
 docs:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v3
 - name: Set up Python
 uses: actions/setup-python@v4
 with:
 python-version: '3.11'
 - run: pip install -r llm-doc-starter/requirements.txt
 - env:
 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
 run: |
 cd llm-doc-starter
 llm-doc generate --module all --output ../docs
 - name: Commit changes
 run: |
 git config user.name "github-actions"
 git config user.email "actions@github.com"
 git add docs/*.md
 git diff --quiet && exit 0 || git commit -m "chore: update docs"
 git push
Enter fullscreen mode Exit fullscreen mode

Now any code change that touches a controller, model, or endpoint automatically refreshes the matching markdown. The workflow runs in under two minutes for a typical 10‑module SaaS. Takeaway: CI‑driven doc generation eliminates manual copy‑paste and keeps the docs in lockstep with the codebase. ## 3. And serve Docs as a Self‑Hosted SaaS Feature

Indie founders often need a polished doc portal without paying for third‑party services. Serve the generated markdown with a lightweight static site generator like VitePress. 1. Install VitePress in the same repo:

npm init vitepress docs
Enter fullscreen mode Exit fullscreen mode
  1. Point VitePress to the generated files by adding docs/.vitepress/config.js:
export default {
 title: 'Acme API',
 description: 'Live docs for Acme SaaS',
 themeConfig: {
 nav: [{ text: 'Home', link: '/' }],
 sidebar: [
 { text: 'Getting Started', link: '/getting-started.md' },
 { text: 'Billing', link: '/billing.md' },
 { text: 'Webhooks', link: '/webhooks.md' },
 ],
 },
}
Enter fullscreen mode Exit fullscreen mode
  1. Add a build step to the GitHub Action after the doc generation:
 - name: Build Docs
 run: |
 cd docs
 npm i && npm run build
 - name: Deploy to Netlify
 uses: nwtgck/actions-netlify@v1.2
 with:
 publish-dir: docs/.vitepress/dist
 production-branch: main
 env:
 NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
 NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
Enter fullscreen mode Exit fullscreen mode

The result is a live, version‑controlled documentation site that updates on every commit, costing only the Netlify free tier. Takeaway: Pair a static site generator with the CI workflow to deliver instant, hosted docs without a separate SaaS subscription. ## 4. Extend the Prompt Pack for Custom Branding

Prompt packs are templates; you can inject your brand voice, logo URLs, or legal footers via Jinja variables. Edit prompts/billing.j2 to include placeholders:

# {{ product_name }} Billing API

{{ intro_paragraph }}

---

{{ logo_url | markdown_image }}
Enter fullscreen mode Exit fullscreen mode

Then run the CLI with a JSON context file:

llm-doc generate --module billing --context config/brand.json --output docs/billing.md
Enter fullscreen mode Exit fullscreen mode

brand.json might contain:

{
 "product_name": "Acme",
 "intro_paragraph": "All endpoints require an API key.",
 "logo_url": "https://example.com/logo.png"
}
Enter fullscreen mode Exit fullscreen mode

The generated markdown now carries your visual identity and tone, eliminating a separate styling step. Takeaway: Use templating variables to align generated docs with brand guidelines in a single command. ## 5. Validate Generated Docs Before Publishing

Even LLMs can produce syntax errors. Add a validation step with markdownlint-cli2 and spectral for OpenAPI sections.

 - name: Lint Markdown
 run: |
 npm i -g markdownlint-cli2
 markdownlint-cli2 "docs/**/*.md" --config .markdownlint.json
 - name: Validate OpenAPI
 run: |
 npm i -g @stoplight/spectral-cli
 spectral lint docs/**/*.yaml
Enter fullscreen mode Exit fullscreen mode

If linting fails, the CI job aborts, preventing broken docs from reaching users. The overhead is under 30 seconds per run. Takeaway: Automated linting catches formatting and schema errors before they hit production. ---

Pick one of the steps above and run it tonight. The quickest win is cloning the llm-doc-starter repo, installing the CLI, and generating a single module's markdown. That single command gives you a version‑controlled doc file you can immediately commit and serve.


If this was useful: I packaged a deeper version as Run Mistral Time‑Series Forecasts for Weekly Sales in One Day.

This article was drafted with AI assistance.

Top comments (0)