Turn any codebase into a structured architecture document with one command.
X-Ray runs professional code analysis tools + AI deep reading to generate a complete project architecture skeleton — module responsibilities, dependency graphs, business call chains, type relationships, and more.
Works with any language and framework. TypeScript/JavaScript projects get enhanced analysis via madge and dependency-cruiser.
/xray
→ Detects project structure
→ Runs scc, madge, dependency-cruiser (auto-installed)
→ AI reads every module in depth
→ Generates 5 structured docs per target
→ Updates CLAUDE.md with architecture summary
→ Supports incremental analysis (only re-analyzes changed modules)
After running /xray, you get:
docs/codebase/
├── frontend/
│ ├── structure.md # Directory layout + code stats
│ ├── dependencies.md # Module dependency graph + circular deps
│ ├── modules.md # Per-module deep analysis
│ ├── call-chains.md # Key business flow tracing
│ └── types.md # Core type/interface relationships
├── backend/
│ ├── structure.md
│ ├── dependencies.md
│ ├── modules.md
│ ├── call-chains.md
│ └── types.md
└── .analysis-meta.json # Incremental analysis metadata
Plus a concise summary injected into your CLAUDE.md so Claude always has architectural context.
curl -fsSL https://raw.githubusercontent.com/Minara-AI/project-xray/main/install.sh | bashThe installer lets you choose between global install (~/.claude/skills/), per-project install (.claude/skills/), or both.
Copy and paste this prompt into Claude Code:
Install the X-Ray codebase analysis skill: run
curl -fsSL https://raw.githubusercontent.com/Minara-AI/project-xray/main/install.sh | bashand choose global install. Then tell me it's ready and I can use/xray setupto configure my project, or/xrayto start analysis directly.
# Install globally (available in all projects)
git clone --single-branch --depth 1 https://github.com/Minara-AI/project-xray.git /tmp/project-xray \
&& mkdir -p ~/.claude/skills \
&& cp -r /tmp/project-xray/skills/xray ~/.claude/skills/xray \
&& rm -rf /tmp/project-xray
# Or install into current project (shared with teammates via git)
git clone --single-branch --depth 1 https://github.com/Minara-AI/project-xray.git /tmp/project-xray \
&& mkdir -p .claude/skills \
&& cp -r /tmp/project-xray/skills/xray .claude/skills/xray \
&& rm -rf /tmp/project-xray/xray setup # Interactive configuration — detects your project structure
/xray # Run analysis
On first run without setup, X-Ray will automatically guide you through configuration.
| Command | Description |
|---|---|
/xray |
Auto-detect incremental/full, analyze all targets |
/xray setup |
Interactive setup — configure targets, paths, options |
/xray [target] |
Analyze a specific target (e.g., /xray frontend) |
/xray --full |
Force full analysis (ignore cached results) |
- Reads
.xray-config.json(or runs interactive setup if missing) - Auto-installs
scc,madge,dependency-cruiseras needed
- Compares current commit against last analyzed commit
- Only re-analyzes modules with changes (config file changes trigger full re-analysis)
- scc — Code statistics (lines, complexity, languages)
- tree — Directory structure visualization
- madge — Dependency graph, circular dependencies, orphan files (JS/TS only)
- dependency-cruiser — Dependency rule validation (JS/TS only)
- Round 1: Module identification and responsibility mapping
- Round 2: Per-module deep analysis — business logic, call chains, type relationships
- 5 structured docs per target in
docs/codebase/ - Architecture summary in
CLAUDE.md - AI memory files for persistent context
| Language | Framework | Enhanced Analysis |
|---|---|---|
| TypeScript/JavaScript | Next.js, NestJS, React, Express, Fastify | scc + madge + depcruise + AI |
| Go | Standard, Gin, Echo | scc + go mod graph + AI |
| Rust | Standard, Actix, Axum | scc + cargo tree + AI |
| Python | Django, FastAPI, Flask | scc + pipdeptree + AI |
| Java/Kotlin | Spring Boot, Gradle | scc + dependency tree + AI |
| Any other | — | scc + AI deep reading |
X-Ray stores its config in .xray-config.json at the project root:
{
"version": 1,
"targets": [
{
"name": "frontend",
"path": "./frontend",
"srcDir": "src",
"language": "typescript",
"framework": "nextjs",
"tsconfig": "./frontend/tsconfig.json"
}
],
"outputDir": "docs/codebase",
"updateClaudeMd": true,
"updateMemory": true,
"excludeDirs": ["node_modules", "dist", "coverage", "build"],
"sameRepo": true
}Run /xray setup at any time to reconfigure.
| Requirement | Version | Note |
|---|---|---|
| Claude Code | Latest | CLI, desktop, or IDE extension |
| OS | macOS / Linux | Windows via WSL |
| Git | Any | For incremental analysis |
| scc | Auto-installed | Code statistics |
| madge | Auto-installed | JS/TS dependency graphs (optional) |
| dependency-cruiser | Auto-installed | JS/TS dep rules (optional) |
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT — free for personal and commercial use.