Awesome-omni-skill repo-docs-generator
Generate comprehensive AGENTS.md, README.md, and CLAUDE.md documentation for any repository. Deep-dives into codebase structure, identifies technologies, creates ASCII architecture diagrams, and respects existing documentation content.
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tools/repo-docs-generator" ~/.claude/skills/diegosouzapw-awesome-omni-skill-repo-docs-generator && rm -rf "$T"
skills/tools/repo-docs-generator/SKILL.mdRepository Documentation Generator Skill
Generates comprehensive, agent-friendly documentation (AGENTS.md, README.md, CLAUDE.md) for any software repository by analyzing its structure, technologies, and patterns.
When to Use This Skill
- Setting up documentation for a new repository
- Enhancing existing documentation with architecture diagrams
- Creating standardized AGENTS.md files across an organization
- Onboarding AI agents to understand a codebase
- Documenting legacy codebases that lack proper documentation
Philosophy
Respect existing content. Never blindly replace documentation that humans have written. Always:
- Read existing AGENTS.md, README.md, and CLAUDE.md files first
- Identify valuable content that must be preserved
- Enhance rather than replace when possible
- Ask for confirmation before making destructive changes
Core Workflow
Phase 1: Discovery
Thoroughly explore the repository before writing anything:
# 1. Understand the repo structure find . -maxdepth 3 -type f -name "*.md" 2>/dev/null | head -20 ls -la cat README.md 2>/dev/null || echo "No README.md" cat AGENTS.md 2>/dev/null || echo "No AGENTS.md" cat CLAUDE.md 2>/dev/null || echo "No CLAUDE.md" # 2. Identify the tech stack ls package.json pyproject.toml requirements.txt Cargo.toml go.mod build.gradle pom.xml Gemfile 2>/dev/null cat package.json 2>/dev/null | head -50 cat pyproject.toml 2>/dev/null | head -50 # 3. Find main entry points find . -maxdepth 2 -name "main.*" -o -name "index.*" -o -name "app.*" 2>/dev/null ls src/ app/ lib/ 2>/dev/null # 4. Identify the build/deploy system ls Dockerfile docker-compose.yml .github/workflows .circleci serverless.yml 2>/dev/null # 5. Check for existing documentation find . -maxdepth 2 -name "*.md" -type f 2>/dev/null # 6. Identify quality gates (pre-commit, linters, formatters) ls .pre-commit-config.yaml .pre-commit-config.yml 2>/dev/null rg -n "djlint|ruff|mypy|pyright|ty|eslint|prettier|black|isort" .pre-commit-config.yaml .pre-commit-config.yml pyproject.toml package.json 2>/dev/null | head -50
Phase 2: Analysis
Based on discovery, identify:
- Repository Type: Web app, API, CLI tool, library, infrastructure, scripts collection, etc.
- Primary Language(s): Python, JavaScript, Java, Go, Rust, etc.
- Framework(s): Django, React, Express, Spring, etc.
- Architecture Pattern: Monolith, microservices, serverless, etc.
- Key Components: What are the main modules/packages/services?
- Data Storage: PostgreSQL, MongoDB, Redis, S3, etc.
- CI/CD: GitHub Actions, CircleCI, Jenkins, etc.
- Deployment: Docker, Kubernetes, Lambda, Heroku, etc.
Phase 2.5: Quality Gates (High ROI)
If the repo uses pre-commit and/or strict linters, treat them as the highest ROI documentation target. In AGENTS.md, explicitly document:
- How to run the gates (preferred wrappers, scoped vs all-files behavior)
- What the gates enforce (template rules, type checks, commit-msg conventions)
- Type-gate detection and precedence for Python repos:
first when configured, thenty
, thenpyrightmypy
is mandatory if configuredty- no "baseline acceptable" language for touched files
- “Gotchas” that repeatedly waste time (e.g., djlint inline styles, named endblocks, date/time math that must be verified with code/tests)
- Local typing policy docs if present (for example:
,docs/python-typing-3.14-best-practices.md
)TY_MIGRATION_GUIDE.md
Phase 3: Documentation Generation
AGENTS.md Structure (Required)
# AGENTS.md — The [Project Name] Story *A guide for AI agents and humans alike. [One-sentence description of what this guide explains.]* --- ## What This Repo Is **[Project Name]** is [brief description of what it does and why it exists]. [Metaphor or analogy that captures its essence.]
[HIGH-LEVEL ASCII ARCHITECTURE DIAGRAM]
--- ## Architecture Diagrams ### [Subsystem 1] Architecture
[DETAILED ASCII DIAGRAM]
### [Subsystem 2] Architecture
[DETAILED ASCII DIAGRAM]
--- ## Folder Structure
project/ | +-- dir1/ # Description | +-- file.ext # Description +-- dir2/ # Description
--- ## Technologies | Category | Technology | Purpose | |----------|------------|---------| | **Language** | ... | ... | | **Framework** | ... | ... | | **Database** | ... | ... | --- ## Do - [Best practice 1] - [Best practice 2] - [Best practice 3] ## Don't - Don't [anti-pattern 1] - Don't [anti-pattern 2] - Don't [anti-pattern 3] --- ## Common Commands ```bash # Development command1 # Description # Testing command2 # Description # Deployment command3 # Description
The Hard Lessons
Lesson 1: [Title]
[What happened]
The cause: [Root cause]
The fix: [Solution]
Quick Reference
[Category 1]:
command
[Category 2]:
key info
When in doubt: [Most important advice]
#### ASCII Diagram Rules (Critical) **DO use these characters:** - Box corners: `+` - Horizontal lines: `-`, `=` - Vertical lines: `|` - Arrows: `>`, `<`, `v`, `^`, `---->`, `|` - Bullet points: `*`, `-` - Section dividers: `===`, `---` **DO NOT use:** - Unicode box-drawing characters (U+2500-U+257F): `─`, `│`, `┌`, `┐`, `└`, `┘`, `├`, `┤`, `┬`, `┴`, `┼` - Emojis in diagrams - Fancy Unicode arrows: `→`, `←`, `↓`, `↑` **Correct example:**
+------------------------------------------------------------------+ | PROJECT NAME | +------------------------------------------------------------------+ | | | +------------------+ +------------------+ +------------------+ | | | COMPONENT A | | COMPONENT B | | COMPONENT C | | | | Description | | Description | | Description | | | +------------------+ +------------------+ +------------------+ | | | +------------------------------------------------------------------+
**Flow diagram example:**
+----------------+ +----------------+ +----------------+ | Input |---->| Process |---->| Output | | (source) | | (transform) | | (result) | +----------------+ +----------------+ +----------------+ | | Annotated flow description v +----------------+ | Next Step | +----------------+
#### README.md Strategy **If README.md exists:** 1. Read it entirely 2. Identify human-written content that must be preserved 3. Add architecture overview at the TOP (after title) 4. Add reference to AGENTS.md for detailed documentation 5. Keep all existing sections intact 6. Only add, don't remove **If README.md doesn't exist:** - Create a concise version with: - Project name and description - Architecture overview diagram - Quick start instructions - Reference to AGENTS.md for details #### CLAUDE.md Structure (Required) CLAUDE.md should be minimal and source AGENTS.md: ```markdown @AGENTS.md --- ## Notes This `CLAUDE.md` intentionally sources `AGENTS.md` so that requirements, commands, and agent behavior live in a single source of truth for this repo. For Claude Code best practices on `CLAUDE.md` / `AGENTS.md` in web-based repos, see: - https://docs.claude.com/en/docs/claude-code/claude-code-on-the-web#best-practices Relevant guidance (summarized): - Document requirements: clearly specify dependencies and commands for the project. - If you have an `AGENTS.md` file, you can source it in your `CLAUDE.md` using `@AGENTS.md` to maintain a single source of truth.
Phase 4: Validation
Before finalizing:
- Verify ASCII diagrams render correctly - No Unicode box characters
- Check all paths exist - Referenced files should exist
- Validate commands - Commands should be runnable
- Confirm tech stack - All mentioned technologies are actually used
- Review against existing docs - No valuable content was lost
Technology-Specific Patterns
Python Projects
Look for:
,pyproject.toml
,setup.pyrequirements.txt
,uv.lock
,poetry.lockPipfile.lock- Django:
,manage.py
, apps withsettings.pymodels.py - Flask:
,app.pywsgi.py - FastAPI:
withmain.py
instanceFastAPI()
Common commands:
# uv-based uv run python ... uv sync # pip-based pip install -r requirements.txt python manage.py runserver # poetry-based poetry install poetry run python ...
JavaScript/TypeScript Projects
Look for:
,package.json
,yarn.lockpackage-lock.json
for TypeScripttsconfig.json- React:
,src/App.tsxsrc/index.tsx - Node.js:
,server.jsindex.js - Vite:
vite.config.ts - Next.js:
,next.config.js
orpages/app/
Common commands:
npm install / yarn npm run dev / yarn dev npm run build / yarn build npm test / yarn test
Java Projects
Look for:
(Maven),pom.xml
(Gradle)build.gradle
,src/main/java/src/test/java/- Spring Boot:
,Application.javaapplication.properties
Common commands:
# Maven mvn clean install mvn spring-boot:run # Gradle ./gradlew build ./gradlew bootRun # Ant (legacy) ant build ant clean
Infrastructure/Terraform
Look for:
files*.tf
,modules/environments/
,terraform.tfvarsbackend.tf
Common commands:
terraform init terraform plan terraform apply terraform fmt
Serverless
Look for:
(Serverless Framework)serverless.yml
(Zappa)zappa_settings.json
(AWS SAM)sam.yaml
directoryfunctions/
Common commands:
serverless deploy --stage dev serverless offline zappa deploy staging
Output Shape
When documentation is generated, report:
## Documentation Generated **Repository:** /path/to/repo **Type:** [Web App / API / Library / Infrastructure / Scripts] **Tech Stack:** [Primary technologies] ### Files Created/Updated: | File | Action | Notes | |------|--------|-------| | AGENTS.md | Created/Updated | [summary] | | README.md | Enhanced/Created | [summary] | | CLAUDE.md | Created/Updated | Sources AGENTS.md | ### Architecture Diagrams Included: 1. [Diagram name 1] 2. [Diagram name 2] 3. [Diagram name 3] ### Preserved Content: - [Existing section 1 from README.md] - [Existing section 2 from README.md] ### Recommendations: - [Any follow-up suggestions]
Important Rules
- Always read existing docs first - Never overwrite without understanding what exists
- Use standard ASCII only - No Unicode box characters in diagrams
- Be specific about technologies - Don't guess; verify by reading config files
- Include "The Hard Lessons" - If you can identify common pitfalls, document them
- Test commands before documenting - Don't document commands that don't work
- Reference files that exist - Don't mention files that aren't in the repo
- Keep README.md concise - Detailed docs go in AGENTS.md
- CLAUDE.md sources AGENTS.md - Single source of truth pattern
Error Recovery
Existing AGENTS.md has critical content
If the existing AGENTS.md has valuable content that shouldn't be lost:
- Extract and preserve critical sections
- Merge with new structure
- Show diff to user before writing
- Ask for confirmation
Unable to determine tech stack
If you can't identify the technology:
- List what you found (or didn't find)
- Ask user for clarification
- Generate placeholder sections that can be filled in
Repository is monorepo
If the repo contains multiple distinct projects:
- Identify each sub-project
- Consider generating per-project AGENTS.md in subdirectories
- Create top-level AGENTS.md that explains the monorepo structure
- Link to sub-project documentation
Examples
Example 1: Python Django Project
After analyzing a Django project, the AGENTS.md might include:
## Architecture Diagrams ### Request Flow
+------------------------------------------------------------------+ | DJANGO REQUEST LIFECYCLE | +------------------------------------------------------------------+
+----------------+ +----------------+ +----------------+ | Browser |---->| nginx |---->| gunicorn | | (HTTP request) | | (reverse proxy)| | (WSGI server) | +----------------+ +----------------+ +----------------+ | v +----------------+ +----------------+ | Django |---->| PostgreSQL | | (views/models) | | (database) | +----------------+ +----------------+
Example 2: React Frontend
After analyzing a React project:
## Architecture Diagrams ### Component Hierarchy
+------------------------------------------------------------------+ | REACT APPLICATION | +------------------------------------------------------------------+
+------------------------+ | App.tsx | | (Router, Providers) | +------------------------+ | +---------------------+---------------------+ | | | v v v
+----------------+ +----------------+ +----------------+ | AuthLayout | | DashboardLayout| | PublicLayout | | (login/signup) | | (main app) | | (landing) | +----------------+ +----------------+ +----------------+
Example 3: Preserving Existing README
If README.md exists with:
# My Project Some important info written by humans. ## Installation Custom installation instructions.
The enhanced README.md becomes:
# My Project Some important info written by humans. > **Architecture Note**: For detailed architecture documentation, agent guidelines, and development patterns, see [AGENTS.md](./AGENTS.md). ## Architecture Overview
[ASCII DIAGRAM]
--- ## Installation Custom installation instructions.
Quick Reference
Discover repo:
ls -la && cat README.md 2>/dev/null && cat AGENTS.md 2>/dev/null
Find tech stack:
ls package.json pyproject.toml *.tf serverless.yml 2>/dev/null
Check existing docs:
find . -maxdepth 2 -name "*.md" -type f
When in doubt: Read everything first, enhance carefully, preserve human content, use standard ASCII only for diagrams.
Canonicalize Mode
Use
/repo-docs:canonicalize to audit and fix existing documentation across a repository, making AGENTS.md the canonical source of truth and normalizing all CLAUDE.md files to minimal stubs.
When to Use Canonicalize
- Repository has scattered/divergent AGENTS.md and CLAUDE.md files
- Documentation contains stale content (old package managers, outdated commands)
- CLAUDE.md files have unique content that should live in AGENTS.md
- Want to enforce the "single source of truth" pattern across a codebase
Canonicalize Workflow
Phase 1: Discovery
Find all directories with AGENTS.md and/or CLAUDE.md:
# Find all AGENTS.md and CLAUDE.md files recursively find . -name "AGENTS.md" -o -name "CLAUDE.md" | sort # Group by directory find . -name "AGENTS.md" -o -name "CLAUDE.md" | xargs -I{} dirname {} | sort -u
Phase 2: Per-Directory Analysis
For each directory with docs, analyze the actual current behavior:
Tooling Analysis:
# Check for uv (modern Python) ls uv.lock pyproject.toml 2>/dev/null # Check for .bin/* wrappers ls .bin/ 2>/dev/null # Check CI configuration ls .github/workflows/*.yml 2>/dev/null cat .github/workflows/*.yml 2>/dev/null | grep -E "run:|command:" | head -20 # Check for Makefile/scripts ls Makefile *.sh scripts/ 2>/dev/null # Check pre-commit + linting configuration (often the real “source of truth”) ls .pre-commit-config.yaml .pre-commit-config.yml 2>/dev/null rg -n "djlint|ruff|mypy|pyright|ty|eslint|prettier|black|isort" .pre-commit-config.yaml .pre-commit-config.yml pyproject.toml package.json 2>/dev/null | head -50
Identify Stale Patterns (remove these):
→ should bepip install -r requirements.txtuv sync
/poetry install
→ should bepoetry run
/uv syncuv run
→ should bepython manage.py
or.bin/djangouv run python manage.py
→ should bepytest
or.bin/pytestuv run pytest- References to old Django versions, old CI patterns, removed features
Identify Current Patterns (use these):
,uv syncuv run ...
,.bin/django
,.bin/pytest
, plus active type gate wrapper (.bin/ruff
,.bin/ty
, or.bin/pyright
).bin/mypy
(and any repo wrappers likepre-commit run ...
)make precommit- Current CI job names and commands
- Actual architecture from code inspection
Phase 3: Comparison & Merge
For each directory:
-
Read both files:
cat AGENTS.md 2>/dev/null cat CLAUDE.md 2>/dev/null -
Identify content categories:
- Keep: Still true and important
- Remove: Stale, outdated, or incorrect
- Merge: In CLAUDE.md but not AGENTS.md (move to AGENTS.md)
-
Merge strategy:
- If CLAUDE.md has better/more current detail → move to AGENTS.md
- If both have same info → keep AGENTS.md version
- If conflict → prefer what matches actual code behavior
Phase 4: Rewrite AGENTS.md
Update AGENTS.md to be canonical for its directory scope:
Command updates:
## Common Commands ```bash # Environment setup uv sync # Install dependencies # Running the server .bin/django runserver # Or: uv run python manage.py runserver # Testing .bin/pytest # Or: uv run pytest .bin/pytest -x -vvs path/to/test.py # Single test with output # Linting .bin/ruff check . # Check for issues .bin/ruff format . # Auto-format # Pre-commit (if present, this is usually the authoritative lint gate) pre-commit run --all-files # Or: pre-commit run --files <changed files> # Type checking # Prefer ty when configured, then pyright, then mypy .bin/ty check . # Run ty (if configured) .bin/pyright . # Or pyright .bin/mypy . # Or mypy ```
Behavior descriptions must match actual code:
- Check what CI actually runs, not what old docs say
- Verify management commands exist before documenting them
- Confirm architecture matches current codebase structure
- If
exists, summarize key hooks and “gotchas” in AGENTS.md (e.g. djlint template rules, required commit message prefixes) so agents write compliant code on the first pass instead of discovering failures at commit time..pre-commit-config.*
Phase 5: Normalize CLAUDE.md
Replace every CLAUDE.md with this minimal stub:
@AGENTS.md --- ## Notes This `CLAUDE.md` intentionally sources `AGENTS.md` so that requirements, commands, and agent behavior live in a single source of truth for this repo. For Claude Code best practices on `CLAUDE.md` / `AGENTS.md` in web-based repos, see: - https://docs.claude.com/en/docs/claude-code/claude-code-on-the-web#best-practices Relevant guidance (summarized): - Document requirements: clearly specify dependencies and commands for the project. - If you have an `AGENTS.md` file, you can source it in your `CLAUDE.md` using `@AGENTS.md` to maintain a single source of truth.
Important: No additional rules, requirements, or divergent specs in CLAUDE.md. All behavioral guidance must live in AGENTS.md.
Canonicalize Output Shape
## Documentation Canonicalized **Repository:** /path/to/repo **Directories processed:** N ### Summary by Directory: | Directory | AGENTS.md | CLAUDE.md | Changes | |-----------|-----------|-----------|---------| | `/` | Updated | Normalized | Merged 3 sections, removed stale pip commands | | `/backend` | Updated | Normalized | Updated to .bin/* wrappers | | `/infra` | Created | Normalized | Was CLAUDE.md only, now has AGENTS.md | ### Stale Content Removed: - `pip install -r requirements.txt` → `uv sync` - `poetry run pytest` → `.bin/pytest` - References to Django 3.x (now 4.x) - Old CI workflow names ### Content Merged from CLAUDE.md → AGENTS.md: - `/backend/CLAUDE.md`: Database migration safety rules - `/infra/CLAUDE.md`: Terraform state locking guidance ### All CLAUDE.md files now source @AGENTS.md
Canonicalize Rules
- Analyze before changing - Always understand actual behavior first
- AGENTS.md is the source of truth - All rules live there
- CLAUDE.md is just a pointer - Minimal stub, no unique content
- Commands must be current -
,uv
wrappers, actual CI commands.bin/* - Remove stale content aggressively - Old package managers, old patterns
- Merge, don't lose - Move valuable CLAUDE.md content to AGENTS.md first
- Recursive - Process every directory with docs, not just root
- Confirm before destructive changes - Show diff, ask user if uncertain
- Encode recurring failure modes - If linters (pre-commit/djlint) or reasoning pitfalls (date/time math) repeatedly trip agents, write explicit “gotchas” and verification commands into AGENTS.md so they’re avoided up front.
Handling Edge Cases
Directory has CLAUDE.md but no AGENTS.md
- Create AGENTS.md from CLAUDE.md content
- Update to current patterns
- Replace CLAUDE.md with minimal stub
Directory has both but CLAUDE.md has unique rules
- Merge unique rules into AGENTS.md
- Verify rules match actual code behavior
- Replace CLAUDE.md with minimal stub
AGENTS.md references files/commands that don't exist
- Remove or update the reference
- Document what actually exists
- Note the removal in output report
Subdirectory AGENTS.md contradicts parent
- Subdirectory AGENTS.md is authoritative for its scope
- Parent should not repeat subdirectory rules
- Each AGENTS.md documents its directory scope only