An AI-powered code documentation generator that automatically analyzes repositories and creates comprehensive documentation using large language models.
FAQ
ai-doc-gen is a Claude Code plugin with 3 hand-picked skills for documentation work, indexed on Flowy. Install it with the command on its page. It includes analyze-codebase, generate-ai-rules, generate-readme. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
> /plugin marketplace add divar-ir/ai-doc-gen> /plugin install ai-doc-gen@divar
Repo: divar-ir/ai-doc-gen
An AI-powered code documentation generator that automatically analyzes repositories and creates comprehensive documentation using large language models. The system employs a multi-agent architecture: five specialized analysis agents run concurrently to map a codebase's structure, dependencies, data flow, request flow, and APIs, and generation agents turn those analyses into a polished README.md and AI assistant configuration files (CLAUDE.md, AGENTS.md, .cursor/rules/). A GitLab cronjob mode discovers active projects and opens merge requests with fresh analysis automatically.
Read the full story behind this project:
.ai/docs/CLAUDE.md, AGENTS.md, and .cursor/rules/*.mdc files for AI coding assistantsanalyze-codebase, generate-readme, and generate-ai-rules skills (.claude-plugin/, skills/)ANALYZER_MAX_WORKERS, 0 = auto-detect CPU count).ai/config.yaml, then CLI flagsRetry-After support (handles 429s)This repository doubles as a Claude Code plugin — the easiest way to use it, no API keys or Python setup required. Install it from within Claude Code:
/plugin marketplace add divar-ir/ai-doc-gen
/plugin install ai-doc-gen@divar
This adds three skills that Claude Code invokes directly:
analyze-codebase — multi-agent analysis producing .ai/docs/ documentsgenerate-readme — README generation from analysis or direct explorationgenerate-ai-rules — CLAUDE.md, AGENTS.md, and Cursor rules generationgit clone https://github.com/divar-ir/ai-doc-gen.git
cd ai-doc-gen
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
pip install -e .
A Dockerfile and a Helm chart (k8s/helm/) are also provided for containerized and scheduled (Kubernetes CronJob) deployments.
# Copy and edit environment variables (LLM API keys, base URLs, etc.)
cp .env.sample .env
# Copy and edit configuration
mkdir -p .ai
cp config_example.yaml .ai/config.yaml
# Analyze your repository
uv run src/main.py analyze --repo-path .
# Generate README documentation
uv run src/main.py generate readme --repo-path .
# Generate AI assistant configuration files (CLAUDE.md, AGENTS.md, .cursor/rules/)
uv run src/main.py generate ai-rules --repo-path .
Analysis documents are saved to .ai/docs/, and generated documentation and AI configuration files are placed in your repository root.
# Analyze codebase (structure, data flow, dependencies, request flow, APIs)
uv run src/main.py analyze --repo-path <path>
# Generate README documentation
uv run src/main.py generate readme --repo-path <path>
# Generate AI assistant configuration files
uv run src/main.py generate ai-rules --repo-path <path>
# Run cronjob (GitLab batch analysis)
uv run src/main.py cronjob analyze
The package also installs an ai-doc-gen console script exposing the same CLI.
Analysis Options:
# Analyze with specific exclusions
uv run src/main.py analyze --repo-path . --exclude-code-structure --exclude-data-flow
# Limit concurrent analyzer agents
uv run src/main.py analyze --repo-path . --max-workers 2
# Use custom configuration file
uv run src/main.py analyze --repo-path . --config /path/to/config.yaml
README Generation Options:
# Generate with specific section exclusions
uv run src/main.py generate readme --repo-path . --exclude-architecture --exclude-c4-model
# Use existing README as context
uv run src/main.py generate readme --repo-path . --use-existing-readme
AI Rules Generation Options:
# Skip overwriting existing files
uv run src/main.py generate ai-rules --repo-path . \
--skip-existing-claude-md \
--skip-existing-agents-md \
--skip-existing-cursor-rules
# Customize detail level and line limits
uv run src/main.py generate ai-rules --repo-path . \
--detail-level comprehensive \
--max-claude-lines 600 \
--max-agents-lines 150
Cronjob Options:
# Only process projects with commits in the last N days
uv run src/main.py cronjob analyze --max-days-since-last-commit 14
The tool automatically looks for configuration in .ai/config.yaml or .ai/config.yml in your repository. Precedence: Pydantic defaults < YAML file < CLI flags.
analyzer.max_workers caps concurrent analyzer agents (0 = auto-detect CPU count)minimal/standard/comprehensive), set line limitsSee config_example.yaml for all available options and .env.sample for environment variables (per-agent LLM models, timeouts, retry behavior, GitLab credentials, Langfuse keys).
The system uses a multi-agent architecture with specialized AI agents for different types of code analysis and generation:
src/main.py): argparse-based entry point; CLI flags are auto-generated from Pydantic config modelssrc/handlers/): command-specific orchestration implementing an AbstractHandler interface (analyze, generate readme, generate ai-rules, cronjob analyze)src/agents/): pydantic-ai agents with YAML/Jinja2 prompt templates
AnalyzerAgent: coordinates 5 analysis agents through a worker poolDocumenterAgent: generates README.md from analysis documentsAIRulesGeneratorAgent: generates markdown rules (CLAUDE.md + AGENTS.md) and Cursor rules concurrentlysrc/agents/tools/): FileReadTool (ranged file reading) and ListFilesTool (filtered recursive listing) registered with every agentOpenAIChatModel + OpenAIProvider with configurable base URL)This project is licensed under the MIT License - see the LICENSE file for details.
.ai/
config.yaml
docs/
api_analysis.md
data_flow_analysis.md
dependency_analysis.md
request_flow_analysis.md
structure_analysis.md
.claude-plugin/
marketplace.json
plugin.json
.cursor/
rules/
agent-development.mdc
code-patterns.mdc
project-overview.mdc
.dockerignore
.env.sample
.github/
workflows/
claude-code-review.yml
claude.yml
.gitignore
AGENTS.md
CLAUDE.md
config_example.yaml
Dockerfile
k8s/
helm/
.gitignore
.helmignore
Chart.yaml
templates/
_helpers.tpl
configmap.yaml
cronjob.yaml
service.yaml
servicemonitor.yaml
values.yaml
LICENSE
pyproject.toml
README.md
skills/
analyze-codebase/
references/
api-analyzer.md
data-flow-analyzer.md
dependency-analyzer.md
request-flow-analyzer.md
structure-analyzer.md
SKILL.md
generate-ai-rules/
SKILL.md
generate-readme/
SKILL.md
src/
__init__.py
agents/
__init__.py
ai_rules_generator.py
analyzer.py
documenter.py
prompts/
ai_rules_generator.yaml
analyzer.yaml
documenter.yaml
tools/
__init__.py
dir_tool/
__init__.py
list_files.py
file_tool/
__init__.py
file_reader.py
config.py
handlers/
__init__.py
ai_rules.py
analyze.py
base_handler.py
cronjob.py
readme.py
main.py
utils/
__init__.py
dict.py
logger.py
prompt_manager.py
repo.py
retry_client.py
worker_pool.py
uv.lock© 2026 Flowy · Free and open source
Built for Claude Code · Not affiliated with Anthropic