Skip to main content

Generate beautiful READMEs from your actual code, not templates

Project description

readme-ai

Generate beautiful, accurate READMEs from your actual code — not templates.

Python License CI PyPI PRs welcome


pip install readme-ai && readme-ai analyze ./your-project

demo


Why readme-ai?

Every developer has a graveyard of repos with a 3-line README.
Writing a good one takes hours. Templates give you empty boxes to fill in manually.
readme-ai reads your code — imports, docstrings, entry points, env vars, file structure —
and writes a README that's actually accurate.

readme-ai ChatGPT (manual) README templates
Reads actual code
Zero config
Works offline ✅ (Ollama)
Multiple LLMs
CI/CD ready

Features

  • Understands your code — scans imports, docstrings, entry points, and file structure
  • Multi-provider — OpenAI, Anthropic Claude, or fully local via Ollama (no API key needed)
  • Any language — Python, JavaScript, TypeScript, Go, Rust, Ruby, Java, and more
  • Smart sampling — picks the most informative files within a context budget
  • Auto badges — generates shields.io badges for language, license, CI, and more
  • GitHub Actions — drop-in workflow to regenerate README on every push
  • Analyze remote repos — pass a GitHub URL directly, no cloning needed
  • Preview in terminalreadme-ai preview renders markdown in your terminal

Installation

From PyPI (recommended)

pip install readme-ai

From source

git clone https://github.com/surfruit/readme-ai
cd readme-ai
pip install -e ".[dev]"

Requirements

  • Python 3.9+
  • An API key for OpenAI or Anthropic OR Ollama running locally

Quick Start

# With OpenAI (default)
export OPENAI_API_KEY=sk-...
readme-ai analyze ./my-project

# With Anthropic Claude
export ANTHROPIC_API_KEY=sk-ant-...
readme-ai analyze ./my-project --provider anthropic

# 100% local, no API key — requires Ollama running
ollama pull llama3
readme-ai analyze ./my-project --provider ollama

# Analyze a GitHub repo directly
readme-ai analyze https://github.com/tiangolo/fastapi --provider openai

Output is saved to README.md in the current directory. Pass --output to change the path.


Usage

CLI reference

readme-ai analyze [REPO] [OPTIONS]

Arguments:
  REPO  Local path or GitHub URL  [required]

Options:
  -o, --output PATH          Output file (default: README.md)
  -p, --provider TEXT        LLM provider: openai | anthropic | ollama
  -m, --model TEXT           Model name (uses provider default if omitted)
  --api-key TEXT             API key (or set via env var)
  --ollama-host TEXT         Ollama URL (default: http://localhost:11434)
  -y, --overwrite            Skip overwrite confirmation
  --version                  Show version and exit
readme-ai preview [README]

Arguments:
  README  Path to README file (default: README.md)

Providers and default models

Provider Flag Default model Needs API key
OpenAI --provider openai gpt-4o-mini Yes
Anthropic --provider anthropic claude-3-haiku-20240307 Yes
Ollama --provider ollama llama3 No

Examples

# Use a specific model
readme-ai analyze . --provider openai --model gpt-4o

# Save to a different file
readme-ai analyze . --output docs/README.md

# Analyze a specific GitHub repo and skip confirmation
readme-ai analyze https://github.com/sindresorhus/got -y

# Preview the generated README in your terminal
readme-ai preview README.md

GitHub Actions — Auto-update README

Add this to .github/workflows/readme.yml to regenerate your README on every push to main:

name: Update README

on:
  push:
    branches: [main]
    paths-ignore:
      - 'README.md'

jobs:
  readme:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - run: pip install readme-ai
      - run: readme-ai analyze . --provider openai -y
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
      - uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: 'docs: regenerate README [skip ci]'

Configuration

readme-ai works with zero configuration. All options are available as CLI flags or environment variables.

Environment Variable CLI flag Description
OPENAI_API_KEY --api-key OpenAI API key
ANTHROPIC_API_KEY --api-key Anthropic API key
README_AI_PROVIDER --provider Default LLM provider
README_AI_MODEL --model Default model name

How it works

Your repo
    │
    ▼
ProjectAnalyzer ──── reads pyproject.toml / package.json / go.mod / Cargo.toml
    │                 detects language, frameworks, deps, env vars, entry points
    ▼
CodeSampler ──────── picks the most informative files within a ~40KB budget
    │                 prioritizes: main.py, cli.py, lib.rs, index.ts, etc.
    ▼
LLM Engine ──────── sends structured prompt to OpenAI / Anthropic / Ollama
    │                returns JSON with tagline, features, installation, examples...
    ▼
ReadmeBuilder ────── assembles sections, generates badges, formats markdown
    │
    ▼
README.md

Roadmap

  • --watch mode — regenerate on file changes during development
  • Notion export
  • Multilingual README (generate in any language with --lang)
  • VS Code extension
  • Web UI for non-CLI users
  • Support for monorepos (per-package READMEs)

Contributing

Contributions are welcome! Please read CONTRIBUTING.md to get started.

git clone https://github.com/surfruit/readme-ai
cd readme-ai
pip install -e ".[dev]"
pytest tests/ -v

New to the codebase? Look for good first issue labels.


License

MIT — free for personal and commercial use.


If readme-ai saved you time, consider giving it a ⭐

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

readme_ai_cli-0.1.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

readme_ai_cli-0.1.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file readme_ai_cli-0.1.0.tar.gz.

File metadata

  • Download URL: readme_ai_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for readme_ai_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18ea66834baac0bd9f0b665c02f8a2e13851620e5723a6976d6f36830161e5ee
MD5 b40b4fc555c4a7b327a46f439d09415c
BLAKE2b-256 54047af1a612c21505738e6d381910270149f64446b00606d68b4f294ce3fbbb

See more details on using hashes here.

File details

Details for the file readme_ai_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: readme_ai_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for readme_ai_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a28ee0a8a0ec0a3bc2e072465ebdd263e969f38b7cabcf17f1e9f12dee02d0f1
MD5 f21ee0300f44330d5b8a9d4f3c3b3b20
BLAKE2b-256 94c9523887183335325b4cb7fdd388df19de2420b504f8255328ac11bfca0ae9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page