Skip to content
Back to search

divar

MarketplaceWorks with Claude CodeGitHub

Claude Code plugins from Divar engineering.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/divar-ir-ai-doc-gen/badge.svg)](/listings/divar-ir-ai-doc-gen)

HTML

<a href="/listings/divar-ir-ai-doc-gen"><img src="/api/listings/divar-ir-ai-doc-gen/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Using Skills (Claude Code)

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/` documents - `generate-readme` — README generation from analysis or direct exploration - `generate-ai-rules` — `CLAUDE.md`, `AGENTS.md`, and Cursor rules generation

Prerequisites

- Python 3.13 - Git - API access to an OpenAI-compatible LLM provider

1. Clone the repository:

git clone https://github.com/divar-ir/ai-doc-gen.git
cd ai-doc-gen

2. Install using uv (recommended):

curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

3. Or install with pip:

pip install -e .

A `Dockerfile` and a Helm chart (`k8s/helm/`) are also provided for containerized and scheduled (Kubernetes CronJob) deployments.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 15 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "divar",
  3. "description": "Claude Code plugins from Divar engineering.",
  4. "owner": {
  5. "name": "Divar",
  6. "url": "https://github.com/divar-ir"
  7. },
  8. "plugins": [
  9. {
  10. "name": "ai-doc-gen",
  11. "source": "./",
  12. "description": "Multi-agent codebase analysis and documentation generation: parallel analyzers plus README and AI-rules generators."
  13. }
  14. ]
  15. }
README.md · README · 208 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # AI Documentation Generator
  2. 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.
  3. ## 📝 Blog Posts
  4. Read the full story behind this project:
  5. - 🇺🇸 [English: Docs That Don’t Rot: How Multi-Agent AI Rewrote Our Workflow](https://medium.com/@milad.noroozi/docs-that-dont-rot-how-multi-agent-ai-rewrote-our-workflow-6e0c911658d6)
  6. - 🇮🇷 [از دستیار کدنویس تا همکار هوشمند؛ گام اول: کابوس مستندسازی](https://virgool.io/@divar/%D8%A7%D8%B2-%D8%AF%D8%B3%D8%AA%DB%8C%D8%A7%D8%B1-%DA%A9%D8%AF%D9%86%D9%88%DB%8C%D8%B3-%D8%AA%D8%A7-%D9%87%D9%85%DA%A9%D8%A7%D8%B1-%D9%87%D9%88%D8%B4%D9%85%D9%86%D8%AF-%DA%AF%D8%A7%D9%85-%D8%A7%D9%88%D9%84-%DA%A9%D8%A7%D8%A8%D9%88%D8%B3-%D9%85%D8%B3%D8%AA%D9%86%D8%AF%D8%B3%D8%A7%D8%B2%DB%8C-jx7vhznchc9w)
  7. ## Table of Contents
  8. - [Features](#features)
  9. - [Installation](#installation)
  10. - [Quick Start](#quick-start)
  11. - [Usage](#usage)
  12. - [Configuration](#configuration)
  13. - [Architecture](#architecture)
  14. - [License](#license)
  15. ## Features
  16. - **Multi-Agent Analysis**: Five specialized AI agents for code structure, data flow, dependency, request flow, and API analysis, writing reusable analysis documents to `.ai/docs/`
  17. - **Automated Documentation**: Generates comprehensive README files with configurable sections
  18. - **AI Assistant Configuration**: Generates `CLAUDE.md`, `AGENTS.md`, and `.cursor/rules/*.mdc` files for AI coding assistants
  19. - **Claude Code Plugin & Skills**: Ships as an installable Claude Code plugin with `analyze-codebase`, `generate-readme`, and `generate-ai-rules` skills (`.claude-plugin/`, `skills/`)
  20. - **GitLab Integration**: Cronjob mode discovers recently active GitLab projects, runs analysis, and opens merge requests
  21. - **Concurrent Processing**: Parallel agent execution with a configurable worker pool (`ANALYZER_MAX_WORKERS`, 0 = auto-detect CPU count)
  22. - **Flexible Configuration**: Layered configuration — Pydantic defaults, `.ai/config.yaml`, then CLI flags
  23. - **Multiple LLM Support**: Works with any OpenAI-compatible API (OpenAI, Anthropic-compatible gateways, OpenRouter, local models, etc.), with per-agent model/endpoint settings
  24. - **Resilience**: Agent-level retries plus an HTTP retry client with exponential backoff and `Retry-After` support (handles 429s)
  25. - **Observability**: OpenTelemetry tracing via logfire with optional Langfuse integration
  26. ## Installation
  27. ### Using Skills (Claude Code)
  28. 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:
  29. ```
  30. /plugin marketplace add divar-ir/ai-doc-gen
  31. /plugin install ai-doc-gen@divar
  32. ```
  33. This adds three skills that Claude Code invokes directly:
  34. - `analyze-codebase` — multi-agent analysis producing `.ai/docs/` documents
  35. - `generate-readme` — README generation from analysis or direct exploration
  36. - `generate-ai-rules` — `CLAUDE.md`, `AGENTS.md`, and Cursor rules generation
  37. ### Prerequisites
  38. - Python 3.13
  39. - Git
  40. - API access to an OpenAI-compatible LLM provider
  41. 1. Clone the repository:
  42. ```bash
  43. git clone https://github.com/divar-ir/ai-doc-gen.git
  44. cd ai-doc-gen
  45. ```
  46. 2. Install using uv (recommended):
  47. ```bash
  48. curl -LsSf https://astral.sh/uv/install.sh | sh
  49. uv sync
  50. ```
  51. 3. Or install with pip:
  52. ```bash
  53. pip install -e .
  54. ```
  55. A `Dockerfile` and a Helm chart (`k8s/helm/`) are also provided for containerized and scheduled (Kubernetes CronJob) deployments.
  56. ## Quick Start
  57. 1. Set up your environment and configuration:
  58. ```bash
  59. # Copy and edit environment variables (LLM API keys, base URLs, etc.)
  60. cp .env.sample .env
  61. # Copy and edit configuration
  62. mkdir -p .ai
  63. cp config_example.yaml .ai/config.yaml
  64. ```
  65. 2. Run analysis and generate documentation:
  66. ```bash
  67. # Analyze your repository
  68. uv run src/main.py analyze --repo-path .
  69. # Generate README documentation
  70. uv run src/main.py generate readme --repo-path .
  71. # Generate AI assistant configuration files (CLAUDE.md, AGENTS.md, .cursor/rules/)
  72. uv run src/main.py generate ai-rules --repo-path .
  73. ```
  74. Analysis documents are saved to `.ai/docs/`, and generated documentation and AI configuration files are placed in your repository root.
  75. ## Usage
  76. ### Available Commands
  77. ```bash
  78. # Analyze codebase (structure, data flow, dependencies, request flow, APIs)
  79. uv run src/main.py analyze --repo-path <path>
  80. # Generate README documentation
  81. uv run src/main.py generate readme --repo-path <path>
  82. # Generate AI assistant configuration files
  83. uv run src/main.py generate ai-rules --repo-path <path>
  84. # Run cronjob (GitLab batch analysis)
  85. uv run src/main.py cronjob analyze
  86. ```
  87. The package also installs an `ai-doc-gen` console script exposing the same CLI.
  88. ### Advanced Options
  89. **Analysis Options:**
  90. ```bash
  91. # Analyze with specific exclusions
  92. uv run src/main.py analyze --repo-path . --exclude-code-structure --exclude-data-flow
  93. # Limit concurrent analyzer agents
  94. uv run src/main.py analyze --repo-path . --max-workers 2
  95. # Use custom configuration file
  96. uv run src/main.py analyze --repo-path . --config /path/to/config.yaml
  97. ```
  98. **README Generation Options:**
  99. ```bash
  100. # Generate with specific section exclusions
  101. uv run src/main.py generate readme --repo-path . --exclude-architecture --exclude-c4-model
  102. # Use existing README as context
  103. uv run src/main.py generate readme --repo-path . --use-existing-readme
  104. ```
  105. **AI Rules Generation Options:**
  106. ```bash
  107. # Skip overwriting existing files
  108. uv run src/main.py generate ai-rules --repo-path . \
  109. --skip-existing-claude-md \
  110. --skip-existing-agents-md \
  111. --skip-existing-cursor-rules
  112. # Customize detail level and line limits
  113. uv run src/main.py generate ai-rules --repo-path . \
  114. --detail-level comprehensive \
  115. --max-claude-lines 600 \
  116. --max-agents-lines 150
  117. ```
  118. **Cronjob Options:**
  119. ```bash
  120. # Only process projects with commits in the last N days
  121. uv run src/main.py cronjob analyze --max-days-since-last-commit 14
  122. ```
  123. ## Configuration
  124. The tool automatically looks for configuration in `.ai/config.yaml` or `.ai/config.yml` in your repository. Precedence: Pydantic defaults < YAML file < CLI flags.
  125. ### Configuration Options
  126. - **Exclude specific analyses**: Skip code structure, data flow, dependencies, request flow, or API analysis
  127. - **Tune concurrency**: `analyzer.max_workers` caps concurrent analyzer agents (0 = auto-detect CPU count)
  128. - **Customize README sections**: Control which sections appear in generated documentation
  129. - **AI rules behavior**: Skip existing files, choose detail level (`minimal`/`standard`/`comprehensive`), set line limits
  130. - **Configure cronjob settings**: Working path and commit recency filter
  131. See [`config_example.yaml`](config_example.yaml) for all available options and [`.env.sample`](.env.sample) for environment variables (per-agent LLM models, timeouts, retry behavior, GitLab credentials, Langfuse keys).
  132. ## Architecture
  133. The system uses a **multi-agent architecture** with specialized AI agents for different types of code analysis and generation:
  134. - **CLI Layer** (`src/main.py`): argparse-based entry point; CLI flags are auto-generated from Pydantic config models
  135. - **Handler Layer** (`src/handlers/`): command-specific orchestration implementing an `AbstractHandler` interface (analyze, generate readme, generate ai-rules, cronjob analyze)
  136. - **Agent Layer** (`src/agents/`): pydantic-ai agents with YAML/Jinja2 prompt templates
  137. - `AnalyzerAgent`: coordinates 5 analysis agents through a worker pool
  138. - `DocumenterAgent`: generates README.md from analysis documents
  139. - `AIRulesGeneratorAgent`: generates markdown rules (CLAUDE.md + AGENTS.md) and Cursor rules concurrently
  140. - **Tool Layer** (`src/agents/tools/`): `FileReadTool` (ranged file reading) and `ListFilesTool` (filtered recursive listing) registered with every agent
  141. ### Technology Stack
  142. - **Python 3.13** with [pydantic-ai](https://ai.pydantic.dev/) for AI agent orchestration
  143. - **OpenAI-compatible APIs** for LLM access (`OpenAIChatModel` + `OpenAIProvider` with configurable base URL)
  144. - **GitPython & python-gitlab** for repository operations and GitLab automation
  145. - **logfire / OpenTelemetry & Langfuse** for observability
  146. - **YAML + Jinja2 + Pydantic** for prompts and configuration management
  147. ## License
  148. This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
  149. ## Acknowledgments
  150. - Built with [pydantic-ai](https://ai.pydantic.dev/) for AI agent orchestration
  151. - Supports multiple LLM providers through OpenAI-compatible APIs (including OpenRouter)
  152. - Uses [Langfuse](https://langfuse.com/) for LLM observability

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.