Making Retype Docs AI-Ready with llms.txt Automation

Keeping documentation up to date is one thing! helping your team or partners quickly digest changes is another. At my company, we use Retype for our docs, and we wanted a way to make them instantly AI-ready for summarization, search, or internal tooling.

Enter retype_llms: a lightweight GitHub Action and Python tool that generates a llms.txt file directly from your Markdown docs. Instead of manually exporting files or worrying about URLs and images, this tool handles it automatically.

Why llms.txt?

If you’ve ever tried feeding docs to AI tools or building search indexes, you know the challenge: multiple Markdown files, relative images, front-matter headers, and custom routes can all break the context.

retype_llms solves this by:

  • Consolidating all your Markdown into a single, structured file
  • Removing YAML front-matter that confuses AI
  • Adding clear section markers with file paths and URLs
  • Resolving relative image paths to absolute URLs if needed
  • Preserving your Retype routing logic for accurate links

This means your AI tools, or even scripts that analyze your docs, get clean, structured, ready-to-use content.

How it Fits in Your Workflow

Whether you prefer Python scripts or GitHub Actions, retype_llms fits seamlessly:

  • Python script: Run locally or in CI to generate llms.txt on demand.
  • GitHub Action: Automatically generate llms.txt on every push, optionally before Retype builds your site. The file lands in your static/ folder, ready to use.

Example: Using with Retype Build Action

You can integrate retype_llms directly before your Retype build to make sure llms.txt is always up to date:

name: Build Retype Documentation
on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Generate llms.txt
        uses: zakaria-chahboun/retype_llms@v2.0.0

      - name: Build Retype
        uses: retypeapp/action-build@latest

      - name: Deploy to GitHub Pages
        uses: retypeapp/action-github-pages@latest
        with:
          update-branch: true

It’s designed to require zero changes to your existing Retype setup 😎 just add it to your workflow, and it works.

Behind the Scenes

The tool respects Retype’s logic:

  • Input detection: Automatically finds the Markdown source folder from retype.yml
  • Routing: Generates URLs that match Retype’s permalink, route, and index file rules
  • Slugification: Matches Retype’s lowercase-hyphen URL style
  • Statistics: Reports number of files, word count, and estimated tokens ✨ handy for AI integration

All of this ensures the llms.txt output mirrors your documentation structure accurately, without any manual cleanup.

Why You’ll Love It

  • Fully automated: no copying or exporting files
  • Keeps links and images intact for AI or scripts
  • Works with GitHub Pages and existing Retype builds
  • Lightweight and easy to set up

Check it out here and give it a spin: 👉 https://github.com/zakaria-chahboun/retype_llms

This small addition can save hours of manual work and make your docs AI-ready in minutes.

Happy documenting! 🚀

Leave a Reply