Agent skill

Analyze Codebase

by divar-ir in divar-ir/ai-doc-gen

Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs.

MITAuto-check passedAgent Workflows

Install Analyze Codebase

skills CLI
$ npx skills add divar-ir/ai-doc-gen --skill analyze-codebase -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divar-ir/ai-doc-gen analyze-codebase --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divar-ir/ai-doc-gen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/analyze-codebase .claude/skills/analyze-codebase && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
analyze-codebase
GitHub stars
765
Token cost
~899 tokens
SKILL.md length
396 words
Files
6 (incl. references)
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs.

  • Works in 3 steps: Determine scope → Run the analyzers in parallel → Verify and report
  • The user asks to analyze a repository
  • SKILL.md covers Workflow and Notes
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Analyze Codebase is an agent skill from divar-ir/ai-doc-gen. Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs. Use whenever the user asks to analyze a repository, generate codebase analysis, understand an unfamiliar codebase in depth, or before generating documentation (README, CLAUDE.md, AGENTS.md) so the generators have analysis data to work from. Also use when the user mentions ".ai/docs", "ai analysis", or wants a structured architectural map of a…

Its SKILL.md is about 900 tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/api-analyzer.md`, `references/data-flow-analyzer.md` and `references/dependency-analyzer.md`).

It sits in Agent Workflows, covering Agent instruction files, Codebase onboarding and Multi-agent orchestration. It works with Pydantic AI and Python. The repository describes itself as: AI-powered multi-agent system that automatically analyzes codebases and generates comprehensive documentation. Features GitLab integration, concurrent processing, and multiple… The licence is MIT.

When your agent uses it

  • The user asks to analyze a repository
  • Generate codebase analysis
  • Understand an unfamiliar codebase in depth
  • Before generating documentation (README

Example prompts

  • “.ai/docs”
  • “ai analysis”
  • “/analyze-codebase”

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Determine scope
  2. Run the analyzers in parallel
  3. Verify and report

What it can do on your machine

Read from SKILL.md and the folder at commit bd3aba7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Analyze Codebase loads about 899 tokens when it runs, and up to ~4k if it reads all its reference files. Until then it costs about 135 tokens; SKILL.md has 396 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~135
When it runs · the whole SKILL.md, loaded when a task matches
~899
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from divar-ir/ai-doc-gen at commit bd3aba7, republished under its MIT licence (© divar-ir). 396 words, ~899 tokens.

Download SKILL.mdSave it as .claude/skills/analyze-codebase/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
analyze-codebase
description
Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs. Use whenever the user asks to analyze a repository, generate codebase analysis, understand an unfamiliar codebase in depth, or before generating documentation (README, CLAUDE.md, AGENTS.md) so the generators have analysis data to work from. Also use when the user mentions ".ai/docs", "ai analysis", or wants a structured architectural map of a project.

Analyze Codebase

Produce five AI-readable analysis documents by running specialized analyzers in parallel, each writing to .ai/docs/ in the target repository. These documents are the input for the generate-readme and generate-ai-rules skills, and are valuable on their own as machine-readable architecture maps.

Workflow

1. Determine scope
  • Target repository: the current working directory unless the user names another path.
  • Which analyses to run: all five by default. The user may exclude some (e.g., "skip the data flow analysis"). For projects with no meaningful API surface or request handling (pure libraries, simple scripts), suggest skipping the API and request-flow analyzers, but let the user decide.
AnalyzerReference fileOutput file
Structurereferences/structure-analyzer.md.ai/docs/structure_analysis.md
Dependenciesreferences/dependency-analyzer.md.ai/docs/dependency_analysis.md
Data flowreferences/data-flow-analyzer.md.ai/docs/data_flow_analysis.md
Request flowreferences/request-flow-analyzer.md.ai/docs/request_flow_analysis.md
APIreferences/api-analyzer.md.ai/docs/api_analysis.md
2. Run the analyzers in parallel

Create .ai/docs/ in the target repo if it doesn't exist. Then spawn one subagent per selected analyzer, all in a single message so they run concurrently. Each subagent prompt should say:

Read the instructions at <absolute path to this skill's references/<analyzer>.md> and follow them exactly for the repository at <absolute repo path>. Explore the codebase with your file tools as needed. Write your complete analysis to <absolute repo path>/.ai/docs/<output file>, following the exact output format in the instructions. In the written file, refer to files by repo-relative paths (e.g. src/main.py, not absolute paths) so the document is portable. Return a one-paragraph summary of what you found.

Failures are isolated: if one analyzer fails, the others' results still count. Retry a failed analyzer once; if it fails again, note it in the final report and move on. Only treat the run as failed if every analyzer fails.

Show full SKILL.md (119 more words)Show less
3. Verify and report

After all subagents finish:

  1. Confirm each expected output file exists and is non-trivial (has content under its section headings, not just the skeleton).
  2. Check that no absolute local paths leaked into the documents; replace any with repo-relative paths.
  3. Report to the user: which analyses succeeded, where the files are, and a short synthesis of the most important findings. Suggest generate-readme or generate-ai-rules as natural next steps.

Notes

  • Analysis documents are optimized for AI consumption, not human reading — that's intentional. Human-facing output comes from the generator skills.
  • Recommend adding .ai/docs/ to the repo (committed, not ignored) so future AI sessions and teammates benefit; but respect the project's existing convention if .ai/ is gitignored.

© divar-ir, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/analyze-codebase of divar-ir/ai-doc-gen.

  • SKILL.md
  • references/api-analyzer.md
  • references/data-flow-analyzer.md
  • references/dependency-analyzer.md
  • references/request-flow-analyzer.md
  • references/structure-analyzer.md

Open the folder on GitHubat commit bd3aba7

Compare with similar skills

Analyze Codebase next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Analyze Codebase compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Analyze Codebase this skilldivar-ir/ai-doc-gen765—~899Automated safety check: PassMIT
Harness Agent Team Designerrevfactory/harness9.1k—~4.5kAutomated safety check: PassApache-2.0
Harness Evolution Feedback Looprevfactory/harness9.1k—~855Automated safety check: PassApache-2.0
Mspm0 Ccsmc3545dada/mspm0-skill374—~4.5kAutomated safety check: PassMIT
Goal Prompt Builderwin4r/goal-prompt-builder228—~3.1kAutomated safety check: PassMIT
Adk Agent Buildergoogle/adk-python22k—~879Automated safety check: PassApache-2.0

Similar skills

  • Harness Agent Team Designer

    revfactory/harness

    Designs a project-specific agent harness: defines specialist agents, writes the skills they follow, picks an execution mode and model for each, and keeps the setup maintained.

    9.1k GitHub stars~4.5k tokensUpdated 9 days ago
    Agent WorkflowsAuto-check passed
  • Collects feedback on how an agent harness performed, generalizes it, and updates the harness agents, skills and orchestrator along with a change-history table.

    9.1k GitHub stars~855 tokensUpdated 9 days ago
    Agent WorkflowsAuto-check passed
  • Mspm0 Ccs

    mc3545dada/mspm0-skill

    Tool-neutral CLI agent rules for TI MSPM0 development with Code Composer Studio, Keil/uVision, CMake/GCC/OpenOCD, SysConfig, and DriverLib.

    374 GitHub stars~4.5k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Goal Prompt Builder

    win4r/goal-prompt-builder

    Build high-quality /goal commands for OpenAI Codex CLI 0.128+ that maximize audit-friendliness and minimize false-completion.

    228 GitHub stars~3.1k tokensUpdated 5 mo ago
    Agent WorkflowsAuto-check passed
  • Adk Agent Builder

    google/adk-python

    Official

    Builds ADK (Agent Development Kit) Python agents: LLM agents with tools, graph workflows of function and agent nodes, conditional routing, fan-out and join, schema-validated delegation between…

    22k GitHub stars~879 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Requirement Ledger CLI Workflow

    adand-91/gpt-6-astra-skill

    Runs an evidence-bound audit, daily or weekly review through the requirement-ledger CLI, binding scope and authority first and blocking the final report until a handoff check passes.

    125 GitHub stars~1.5k tokensUpdated 21 days ago
    Agent WorkflowsAuto-check passed

More from divar-ir/ai-doc-gen

  • Generate AI Rules

    divar-ir/ai-doc-gen

    Generate AI assistant configuration files for a repository — CLAUDE.md, AGENTS.md, and Cursor rules (.cursor/rules/.mdc) — from codebase analysis.

    765 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Generate Readme

    divar-ir/ai-doc-gen

    Generate or refresh a comprehensive, professional README.md for a repository, with architecture overview, mermaid and optional C4 diagrams, repository structure, dependencies, and API documentation.

    765 GitHub stars~996 tokensUpdated 2 mo ago
    Auto-check passed

Categories

Questions about Analyze Codebase

What does Analyze Codebase do?

Run a multi-agent deep analysis of a codebase, producing AI-readable analysis documents in .ai/docs/ covering structure, dependencies, data flow, request flow, and APIs. Analyze Codebase is an agent skill from divar-ir/ai-doc-gen.ai/docs/ covering structure, dependencies, data flow, request flow, and APIs.

When should I use Analyze Codebase?

Analyze Codebase fits situations like: the user asks to analyze a repository; generate codebase analysis; understand an unfamiliar codebase in depth; before generating documentation (README.

How do I install Analyze Codebase in Claude Code?

Run `npx skills add divar-ir/ai-doc-gen --skill analyze-codebase -a claude-code`. Or copy the skill folder (skills/analyze-codebase in divar-ir/ai-doc-gen) into .claude/skills/analyze-codebase in your project. Claude Code loads it when a task matches its description.

How do I install Analyze Codebase in Codex?

Run `npx skills add divar-ir/ai-doc-gen --skill analyze-codebase -a codex`. Or copy the skill folder (skills/analyze-codebase in divar-ir/ai-doc-gen) into .agents/skills/analyze-codebase in your project. Codex loads it when a task matches its description.

Can I use Analyze Codebase in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divar-ir/ai-doc-gen --skill analyze-codebase -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/analyze-codebase, .gemini/skills/analyze-codebase, .github/skills/analyze-codebase and .opencode/skills/analyze-codebase in your project.

What does Analyze Codebase need to run?

SKILL.md names no scripts, command-line tools or credentials: Analyze Codebase is instructions for the agent only.

Does Analyze Codebase access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Analyze Codebase safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Analyze Codebase use?

Analyze Codebase is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Analyze Codebase use?

About 899 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.1k tokens, read only when the agent opens those files.

What are the alternatives to Analyze Codebase?

Skills that share tags, products or a category with Analyze Codebase: Harness Agent Team Designer (revfactory/harness, 9.1k stars), Harness Evolution Feedback Loop (revfactory/harness, 9.1k stars), Mspm0 Ccs (mc3545dada/mspm0-skill, 374 stars) and Goal Prompt Builder (win4r/goal-prompt-builder, 228 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Analyze Codebase?

divar-ir (a GitHub organization) maintains it in divar-ir/ai-doc-gen, which has 765 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on July 21, 2026.

Source: divar-ir/ai-doc-gen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.