analyze-repo

A command that inspects an existing software repository to document its structure, tools, conventions, and safety rules. It checks Git information, configuration files, and the directory layout.

In plain words
What is it for?
Use it to analyze a repository on its own, refresh its analysis after changes, or audit code quality and project guardrails.
Why use it?
It gives an agent a working map of an unfamiliar codebase before changes are made or reviewed.

Command

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 commands/alinaqi/maggy/analyze-repo
Clone the repo
git clone --depth 1 https://github.com/alinaqi/maggy
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,408 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.00000 $0.02408
Opus 5 $0.00000 $0.01204
Sonnet 5 $0.00000 $0.00482
Haiku 4.5 $0.00000 $0.00241

Measured yesterday against content hash 17c2d36e55b5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

analyze-repo 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 yesterday.

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.

commands/analyze-repo.md · 289 lines

How it starts

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

Analyze Repository

Analyze an existing repository's structure, conventions, and guardrails.

This command runs automatically when /initialize-project detects an existing codebase without Claude setup. You can also run it standalone anytime.

Use this command standalone when:

  • You want to re-analyze after making changes
  • You want analysis without running /initialize-project
  • Auditing code quality and guardrails on any repo
  • Reviewing a codebase without adding Claude skills

Automatic trigger:

  • /initialize-project on existing codebase → auto-runs this analysis first

Phase 1: Repository Detection

Run these checks to understand the repo:

# Git info
echo "=== Git Status ===" && \
git remote -v 2>/dev/null && \
git branch -a 2>/dev/null | head -10 && \
git log --oneline -5 2>/dev/null

# Config files
echo "=== Config Files ===" && \
ls -la *.json *.toml *.yaml *.yml 2>/dev/null

# Directory structure (3 levels, excluding noise)
echo "=== Directory Structure ===" && \
find . -type d -maxdepth 3 \
    -not -path "*/node_modules/*" \
    -not -path "*/.git/*" \
    -not -path "*/venv/*" \
    -not -path "*/__pycache__/*" \
    -not -path "*/dist/*" \
    -not -path "*/build/*" \
    2>/dev/null | head -40

Phase 2: Tech Stack Detection

Identify the primary technologies:

# JavaScript/TypeScript
if [ -f "package.json" ]; then
    echo "=== Package.json ===" && \
    cat package.json | head -50
fi

# Python
if [ -f "pyproject.toml" ]; then
    echo "=== pyproject.toml ===" && \
    cat pyproject.toml
fi

# Mobile
ls pubspec.yaml android/build.gradle ios/*.xcodeproj 2>/dev/null

Based on findings, determine:

File Technology
package.json + tsconfig.json TypeScript
package.json (no tsconfig) JavaScript
pyproject.toml Python
pubspec.yaml Flutter (Dart)
android/build.gradle Android Native
Cargo.toml Rust
go.mod Go

Phase 3: Repo Structure Type

Read the full file on GitHub · 289 lines

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. yesterday First seen · 289 lines · 0 tokens per session scan A 17c2d36e55b5

Subscribe to this mod's changes

analyze-repo is a command published in the GitHub repository alinaqi/maggy (704 stars, last pushed 14d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,408 tokens. 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.