Onboard — Codebase Architecture & Smell Analysis
You are generating an onboarding guide for a codebase. A tree-sitter structural map and code smell report have been injected below.
Arguments
$ARGUMENTS may contain any combination of:
| Flag |
Effect |
--skip-smells TYPE,TYPE |
Exclude specific smell types (e.g. MISSING_DOCSTRING,LARGE_FILE) |
--long-func N |
Override lines threshold for LONG_FUNCTION (default: 50) |
--god-class N |
Override methods threshold for GOD_CLASS (default: 15) |
--deep-nesting N |
Override nesting threshold for DEEP_NESTING (default: 4) |
--many-params N |
Override parameters threshold for MANY_PARAMS (default: 5) |
--large-file N |
Override lines threshold for LARGE_FILE (default: 500) |
--skip-dirs dir,dir |
Additional directories to ignore (e.g. generated,vendor) |
If $ARGUMENTS is empty, all defaults apply.
Injected Data
!`python3 ~/.claude/skills/onboard/scripts/treemap.py $ARGUMENTS`
Error Handling
- If treemap.py fails: Fall back to manual analysis — use Glob and Grep to survey the codebase structure, then produce the onboarding document from those results. Note in the output that tree-sitter analysis was unavailable.
- Skipped languages: If the output shows warnings about unavailable parsers, note which languages were skipped and recommend installing the missing
tree-sitter-* packages.
- Large codebases (>5000 files): If the scan is slow or produces excessive output, suggest re-running with
--skip-smells MISSING_DOCSTRING --skip-dirs test,tests,vendor to reduce noise.
Your Task
Using the structural map and smell report above, produce a comprehensive onboarding document with these sections:
1. Architecture Overview
- High-level description of the project's purpose and design
- Key directories and what they contain
- Layering / module boundaries (e.g., CLI vs core vs API)
2. Entry Points
- Where execution starts (main functions, CLI entry points, app factories)
- How a request/command flows through the system
3. Key Abstractions
- The most important classes, interfaces, and types
- How they relate to each other (inheritance, composition, dependency)
4. Data Flow
- How data moves through the system (user input -> processing -> output)
- Key data structures and where they're transformed
5. Import / Dependency Graph
- Which modules depend on which
- Any notable patterns (layered architecture, plugin system, etc.)
6. Code Smells & Tech Debt (Prioritized)
- Walk through each smell from the report
- Group by severity (High / Medium / Low)
- For each, briefly explain why it's a problem and suggest a concrete fix
- If circular imports were detected, explain the cycle and how to break it
7. Onboarding Recommendations
- Suggested reading order for a new contributor
- Files to read first to understand the architecture
- Common patterns used in the codebase
- Gotchas and non-obvious conventions
8. Save to Project Memory
After generating the onboarding document, persist the key findings to Claude's project memory so future sessions benefit automatically.
First, check if the project has already been onboarded by reading the existing MEMORY.md in the project's auto memory directory (.claude/projects/.../memory/MEMORY.md).
If MEMORY.md already exists (re-onboarding):
- Read all existing memory files to understand what's already saved
- Compare the previous onboarded commit hash with the current HEAD
- Preserve any user-added notes, preferences, or debugging insights that aren't part of the auto-generated onboarding sections
- Update the architecture sections with new findings from the fresh tree-sitter analysis
- Add a re-onboard note at the top of MEMORY.md:
Re-onboarded at commit <hash> (previously <old-hash>)
- Highlight what changed — new files/modules, removed modules, new or resolved code smells, shifted architecture
- If the codebase structure hasn't materially changed, keep updates minimal and preserve existing memory content
If MEMORY.md does not exist (first onboarding):
- Note the Git HEAD commit hash printed at the top of the injected data
- Write a concise
MEMORY.md containing:
- Project overview (1-2 sentences)
- Onboarded commit hash
- Key entry points
- Core abstractions (names and file paths)
- Data flow summary
- Known tech debt highlights
- Create additional topic files (e.g.,
architecture.md, key-files.md) linked from MEMORY.md for detailed reference
Always:
- Keep MEMORY.md under 200 lines (it gets loaded into the system prompt)
- Use topic files for detailed content, link from MEMORY.md
Composability
After onboarding, suggest the user run /readme to generate or update the project's README with the architecture context now available in project memory.
Formatting Rules
- Use markdown headers and bullet points
- Reference specific files and line numbers from the map
- Keep the document scannable — use bold for key terms
- Be direct and specific, not generic
1---2name: onboard3description: Generate an architecture overview and onboarding guide using tree-sitter codebase mapping and code smell detection4---56# Onboard — Codebase Architecture & Smell Analysis78You are generating an onboarding guide for a codebase. A tree-sitter structural map and code smell report have been injected below.910## Arguments1112`$ARGUMENTS` may contain any combination of:1314| Flag | Effect |15|------|--------|16| `--skip-smells TYPE,TYPE` | Exclude specific smell types (e.g. `MISSING_DOCSTRING,LARGE_FILE`) |17| `--long-func N` | Override lines threshold for LONG_FUNCTION (default: 50) |18| `--god-class N` | Override methods threshold for GOD_CLASS (default: 15) |19| `--deep-nesting N` | Override nesting threshold for DEEP_NESTING (default: 4) |20| `--many-params N` | Override parameters threshold for MANY_PARAMS (default: 5) |21| `--large-file N` | Override lines threshold for LARGE_FILE (default: 500) |22| `--skip-dirs dir,dir` | Additional directories to ignore (e.g. `generated,vendor`) |2324If `$ARGUMENTS` is empty, all defaults apply.2526## Injected Data2728```29!`python3 ~/.claude/skills/onboard/scripts/treemap.py $ARGUMENTS`30```3132## Error Handling3334- **If treemap.py fails**: Fall back to manual analysis — use Glob and Grep to survey the codebase structure, then produce the onboarding document from those results. Note in the output that tree-sitter analysis was unavailable.35- **Skipped languages**: If the output shows warnings about unavailable parsers, note which languages were skipped and recommend installing the missing `tree-sitter-*` packages.36- **Large codebases (>5000 files)**: If the scan is slow or produces excessive output, suggest re-running with `--skip-smells MISSING_DOCSTRING --skip-dirs test,tests,vendor` to reduce noise.3738## Your Task3940Using the structural map and smell report above, produce a comprehensive onboarding document with these sections:4142### 1. Architecture Overview43- High-level description of the project's purpose and design44- Key directories and what they contain45- Layering / module boundaries (e.g., CLI vs core vs API)4647### 2. Entry Points48- Where execution starts (main functions, CLI entry points, app factories)49- How a request/command flows through the system5051### 3. Key Abstractions52- The most important classes, interfaces, and types53- How they relate to each other (inheritance, composition, dependency)5455### 4. Data Flow56- How data moves through the system (user input -> processing -> output)57- Key data structures and where they're transformed5859### 5. Import / Dependency Graph60- Which modules depend on which61- Any notable patterns (layered architecture, plugin system, etc.)6263### 6. Code Smells & Tech Debt (Prioritized)64- Walk through each smell from the report65- Group by severity (High / Medium / Low)66- For each, briefly explain *why* it's a problem and suggest a concrete fix67- If circular imports were detected, explain the cycle and how to break it6869### 7. Onboarding Recommendations70- Suggested reading order for a new contributor71- Files to read first to understand the architecture72- Common patterns used in the codebase73- Gotchas and non-obvious conventions7475### 8. Save to Project Memory76After generating the onboarding document, **persist the key findings** to Claude's project memory so future sessions benefit automatically.7778**First, check if the project has already been onboarded** by reading the existing `MEMORY.md` in the project's auto memory directory (`.claude/projects/.../memory/MEMORY.md`).7980#### If MEMORY.md already exists (re-onboarding):811. Read all existing memory files to understand what's already saved822. Compare the previous onboarded commit hash with the current HEAD833. **Preserve** any user-added notes, preferences, or debugging insights that aren't part of the auto-generated onboarding sections844. **Update** the architecture sections with new findings from the fresh tree-sitter analysis855. **Add a re-onboard note** at the top of MEMORY.md: `Re-onboarded at commit <hash> (previously <old-hash>)`866. **Highlight what changed** — new files/modules, removed modules, new or resolved code smells, shifted architecture877. If the codebase structure hasn't materially changed, keep updates minimal and preserve existing memory content8889#### If MEMORY.md does not exist (first onboarding):901. Note the **Git HEAD commit hash** printed at the top of the injected data912. Write a concise `MEMORY.md` containing:92 - Project overview (1-2 sentences)93 - Onboarded commit hash94 - Key entry points95 - Core abstractions (names and file paths)96 - Data flow summary97 - Known tech debt highlights983. Create additional topic files (e.g., `architecture.md`, `key-files.md`) linked from MEMORY.md for detailed reference99100#### Always:101- Keep MEMORY.md under 200 lines (it gets loaded into the system prompt)102- Use topic files for detailed content, link from MEMORY.md103104## Composability105106After onboarding, suggest the user run `/readme` to generate or update the project's README with the architecture context now available in project memory.107108## Formatting Rules109- Use markdown headers and bullet points110- Reference specific files and line numbers from the map111- Keep the document scannable — use bold for key terms112- Be direct and specific, not generic