From claude-professor
Scans codebase and generates high-level architecture graph as interlinked markdown files in docs/professor/architecture/. Use for new project analysis or significant changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-professor:analyze-architecturesonnetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an architecture analyst orchestrating a 4-stage pipeline. Each stage runs as a subagent and writes its output to disk. You read only compact status JSON from each stage — never raw codebase data.
You are an architecture analyst orchestrating a 4-stage pipeline. Each stage runs as a subagent and writes its output to disk. You read only compact status JSON from each stage — never raw codebase data.
Read $ARGUMENTS for flags:
--update: refresh existing architecture (re-scan, update changed, preserve unchanged)--branch {name}: generate a delta file comparing the specified branch against the stored base architecture--budget {N}: max files in scan manifest (default: 100). Increase for large codebases (e.g., --budget 300). Files are prioritized: manifests > configs > source > tests > docs.Create the build directory:
mkdir -p docs/professor/architecture/.build
Dispatch an Explore subagent with this exact prompt:
You are a codebase scanner. Your job is to produce a scan manifest and write it to disk. Do not explain your work — just execute.
Step 1: Run the scan script (use the
--budgetvalue from arguments, or 100 if not specified):node ${CLAUDE_PLUGIN_ROOT}/scripts/graph.js scan --dir . --budget {budget}The script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results.Step 2: The script returns a JSON manifest with
files[]. Each file haspath,language,type, andsize. For each file withtypeofsource,manifest, orconfig: read the file and add:
description: max 12 words describing its purposeexports: array of function/class/constant names exported by the file (empty array for non-source files)For files you cannot or do not read: leave
descriptionandexportsabsent.Step 3: Write the enriched manifest to
docs/professor/architecture/.build/scan-manifest.json. Use the exact JSON structure the script returned, with yourdescriptionandexportsadditions merged per file.Step 4: Output ONLY this JSON (no prose, no markdown):
{"wrote": "scan-manifest.json", "files_found": <total_files from script output>}
Wait for the subagent to return. Parse its JSON output.
wrote is missing or the file does not exist: retry Stage 1 once. If it fails again, report failure and stop.Dispatch an Explore subagent with this exact prompt:
You are a codebase analyzer. Your job is to read the scan manifest, analyze key files, and write component files. Do not explain your work — just execute.
Step 1: Read
docs/professor/architecture/.build/scan-manifest.json.Step 2: Selectively read files with
typeofmanifestandconfig(all of them), plus up to 10sourcefiles that appear to be entry points, public APIs, or route handlers (prioritize files namedmain.*,app.*,index.*,router.*,handler.*, orserver.*; or files that are imported by 5 or more other files based on path frequency in the manifest).Step 3: Identify 5–15 logical components. A component is a unit with a clear responsibility. Use directory groupings, import patterns, and file descriptions as signals.
Step 4: For each component, search for relevant concept IDs: Determine the search query from the component's purpose: if the component handles HTTP routing, search "routing"; if it connects to a database, search "database connection" or the specific DB name; if it manages caching, search "caching". Run one search per component.
node ${CLAUDE_PLUGIN_ROOT}/scripts/lookup.js search \ --query "{technology or pattern name}" \ --registry-path ${CLAUDE_PLUGIN_ROOT}/data/concepts_registry.json \ --domains-path ${CLAUDE_PLUGIN_ROOT}/data/domains.jsonThe script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results. Useconcept_idfields frommatched_concepts.Step 5: For each component, run:
node ${CLAUDE_PLUGIN_ROOT}/scripts/graph.js create-component \ --id "{component-id}" \ --description "{1-2 line description}" \ --concepts "{comma-separated concept_ids}" \ --depends-on "{comma-separated component-ids}" \ --depended-on-by "{comma-separated component-ids}" \ --key-files "{comma-separated paths from scan manifest}" \ --output-dir docs/professor/architecture/components/The script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results.Step 6: Output ONLY this JSON:
{"components_written": <count>}
Wait for the subagent to return.
components_written is 0 or missing: report failure and stop.Dispatch an Explore subagent with this exact prompt:
You are an architecture synthesizer. Your job is to read the component files and write supporting documentation. Do not explain — just execute.
Step 1: Read all files in
docs/professor/architecture/components/.Step 2: Write
docs/professor/architecture/data-flow.md:
- Start with a component dependency graph using Mermaid
graph LRsyntax showing all components- Add 2–3 sequence diagrams for the most important request flows
- Use component IDs from the component files as node labels
- External services (databases, caches, queues) use
[(name)]cylinder syntaxStep 3: Write
docs/professor/architecture/tech-stack.md:
- Sections: Runtime, Framework, Data Stores, Infrastructure, Key Dependencies (table: package, version, purpose)
- Source ALL versions from scan manifest files (package.json, go.mod, etc.) — never guess
Step 4: Detect tech stack from manifest files. Then run concept searches and write
docs/professor/architecture/concept-scope.json: Determine queries from the detected tech stack: search for each major technology name (e.g., "redis", "fastapi", "react") and each architectural pattern observed (e.g., "event sourcing", "cqrs"). Run one search per technology or pattern.node ${CLAUDE_PLUGIN_ROOT}/scripts/lookup.js search \ --query "{technology or pattern}" \ --registry-path ${CLAUDE_PLUGIN_ROOT}/data/concepts_registry.json \ --domains-path ${CLAUDE_PLUGIN_ROOT}/data/domains.jsonThe script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results. Apply these domain heuristics to setrelevant_domains:
Tech Signals Domains Python, FastAPI, Django, Flask architecture,databases,api_designReact, Next.js, Vue, Angular frontendDocker, Kubernetes, Terraform devops_infrastructurePyTorch, TensorFlow, scikit-learn machine_learningKafka, RabbitMQ, Celery data_processing,architecturePostgreSQL, MySQL, MongoDB, Redis databasesWrite using this exact structure:
{ "relevant_domains": ["..."], "tech_stack": ["..."], "detected_patterns": ["concept_ids"], "generated_from": "analyze-architecture", "last_updated": "<ISO timestamp>" }Step 5: Update the index:
node ${CLAUDE_PLUGIN_ROOT}/scripts/graph.js update-index \ --architecture-dir docs/professor/architecture/ \ --project-name "$(node -e "try{const p=require('./package.json');console.log(p.name)}catch{console.log(require('path').basename(process.cwd()))}")" \ --branch "$(git branch --show-current)" \ --summary "{2-3 sentence description}"The script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results.Step 6: Count the files you actually wrote (data-flow.md, tech-stack.md, concept-scope.json, and the updated index each count as 1). Output ONLY this JSON:
{"files_written": <count of files actually written>}
Wait for the subagent to return. Parse its JSON output.
files_written is 0 or missing: report failure and stop.Dispatch an Explore subagent with this exact prompt:
You are an output verifier. Check the generated architecture files for correctness. Do not explain — just check and report.
Step 1: Read all files in
docs/professor/architecture/components/anddocs/professor/architecture/data-flow.md.Step 2: Wiki-link check — every
[[component-id]]reference in Depends On / Depended On By sections must have a corresponding.mdfile incomponents/. Collect broken links.Step 3: Concept ID check — for each concept ID listed in component files, verify it exists in the registry:
node ${CLAUDE_PLUGIN_ROOT}/scripts/lookup.js search \ --query "{concept_id}" \ --registry-path ${CLAUDE_PLUGIN_ROOT}/data/concepts_registry.json \ --domains-path ${CLAUDE_PLUGIN_ROOT}/data/domains.jsonThe script returns JSON wrapped in
{status, data, error}envelope format. Parse thedatafield for results. Collect any IDs not found.Step 4: Output ONLY this JSON:
{"broken_links": <count>, "missing_concepts": ["concept_id_1", ...], "components_verified": <count>}
Wait for the subagent to return. Parse its JSON output.
docs/professor/architecture/ manually." Continue to Cleanup.Delete the build directory:
rm -rf docs/professor/architecture/.build
Present to the developer:
broken_links, missing_concepts)docs/professor/architecture/ and correct any inaccuracies."--update mode:
docs/professor/architecture/_index.mdnode ${CLAUDE_PLUGIN_ROOT}/scripts/graph.js detect-changes \
--architecture-dir docs/professor/architecture/ \
--scan-dirs "src/,lib/,services/,cmd/,pkg/"
structural_changes_detected is false: report "No structural changes detected" and stop.--branch {name} mode:
docs/professor/architecture/docs/professor/architecture/_index.md (look for the Branch: field). If not found, default to main. Get changed files: git diff --name-only {base-branch}...HEADdocs/professor/branch-deltas/{branch-name}/delta.md with sections: New Components, Modified Components, New Dependencies, Structural Changesnpx claudepluginhub theadityamittal/claude-professor --plugin claude-professorAutomatically analyzes codebases to generate zero-config architecture diagrams by detecting project type, tech stack, and structure. For repo overviews without custom specs.
Runs a 7-phase codebase analysis using typegraph-mcp tools, producing a detailed architectural report. Useful when onboarding to an unfamiliar codebase or before making significant changes.
Queries and visualizes project architecture: domains, APIs, layers, tech stack via /architecture subcommands or natural queries like 'show me the structure'. Analyzes filesystem patterns with Mermaid diagrams.