analyze-codebase

analyze-codebase is a skill for Claude Code, Codex from divar-ir/ai-doc-gen. It costs 113 tokens per session (778 once invoked), scanned A, original, MIT.

A repository-inspection workflow that creates documents describing a codebase’s structure, dependencies, data movement, request handling, and APIs. The documents are saved in .ai/docs/.

In plain words
What is it for?
Use it to analyse a repository in depth or prepare information for generating a README or AI assistant rules.
Why use it?
It helps when a project is unfamiliar by turning scattered source code into readable maps of how the system is organised and connected.

Skill for Claude CodeCodex

Part of the ai-doc-gen plugin — 3 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/divar-ir/ai-doc-gen/analyze-codebase
Any agent
npx skills add divar-ir/ai-doc-gen --skill analyze-codebase
Clone the repo
git clone --depth 1 https://github.com/divar-ir/ai-doc-gen

Made for: Claude Code, Codex.

Or install ai-doc-gen, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-codebase

README.md
[![agentmods](https://agentmods.dev/badge/skills/divar-ir/ai-doc-gen/analyze-codebase.svg)](https://agentmods.dev/skills/divar-ir/ai-doc-gen/analyze-codebase)
Your own site
<a href="https://agentmods.dev/skills/divar-ir/ai-doc-gen/analyze-codebase"><img src="https://agentmods.dev/badge/skills/divar-ir/ai-doc-gen/analyze-codebase.svg" alt="Measured on agentmods" height="20"></a>
Per session 113 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00113 $0.00778
Opus 5 $0.00056 $0.00389
Sonnet 5 $0.00023 $0.00156
Haiku 4.5 $0.00011 $0.00078

Measured 4d ago against content hash c4b9e81d6eab, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

analyze-codebase scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/analyze-codebase/SKILL.md · 45 lines

How it starts

The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.
Analyzer Reference file Output file
Structure references/structure-analyzer.md .ai/docs/structure_analysis.md
Dependencies references/dependency-analyzer.md .ai/docs/dependency_analysis.md
Data flow references/data-flow-analyzer.md .ai/docs/data_flow_analysis.md
Request flow references/request-flow-analyzer.md .ai/docs/request_flow_analysis.md
API references/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.

Read the full file on GitHub · 45 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 45 lines · 113 tokens per session scan A c4b9e81d6eab

Subscribe to this mod's changes

analyze-codebase is a skill published in the GitHub repository divar-ir/ai-doc-gen (753 stars, last pushed 1mo ago), licensed MIT. It adds 113 tokens to every session and 778 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

knowledge-base

Create and maintain a Markdown knowledge base that any AI agent can read, search, and update. Use when the user wants to start a knowledge base, add or update notes, organize docs/notes for an agent or LLM to consume, build an index of notes, or run a cleanup/maintenance pass on an existing MD knowledge base. Triggers…

wonderwhy-er/DesktopCommanderMCP · 112 tokens

obsidian-vault

Organize Obsidian vaults with MOCs, wikilinks, frontmatter/properties, dashboards, orphan-note checks, and cleanup workflows. Use ONLY when the user explicitly refers to Obsidian — by naming "Obsidian", an Obsidian "vault", or an Obsidian-specific feature such as wikilinks ("[[ ]]"), the Dataview or Bases plugins, or…

wonderwhy-er/DesktopCommanderMCP · 171 tokens

wiki_submit

Submit wiki documentation pages to Wegent backend API. Simplifies the HTTP POST process for wiki content submission.

wecode-ai/Wegent · 21 tokens

company-product-context

Compiles comprehensive company product context from PDF documents, web research, and industry knowledge.

lofcz/LLMTornado · 20 tokens

codebase-context-extractor

This skill provides a comprehensive context extraction system for large codebases. It intelligently analyzes code structure, dependencies, and relationships to extract relevant context for understanding, debugging, or modifying code.

lofcz/LLMTornado · 42 tokens

skill-creator

Generates Anthropic Skills with complete workflow including GitHub PR creation and local download verification.

lofcz/LLMTornado · 22 tokens