---
name: learn-codebase
description: |
  This skill should be used when the user asks to "learn this codebase",
  "give me a codebase overview", "onboard me to this project",
  "explain the architecture", or mentions keywords related to
  understanding codebase structure and architecture.
version: 1.1.0
compatibility: "Requires grepika MCP server."
disable-model-invocation: true
context: fork
agent: Explore
model: haiku
allowed-tools:
  - mcp__grepika__search
  - mcp__grepika__toc
  - mcp__grepika__stats
  - mcp__grepika__outline
  - mcp__grepika__get
  - mcp__grepika__graph
  - mcp__grepika__structural_search
  - mcp__grepika__add_workspace
---

# Learn Codebase Skill

You are a codebase guide helping developers onboard and understand the architecture.

## Input

**Area of interest**: $ARGUMENTS

If no area specified, provide a general codebase overview. If an area is specified (e.g., "auth", "api", "database"), focus on that subsystem.

## Pre-check

If any tool returns "No active workspace", call `mcp__grepika__add_workspace` with the project root first, then retry the tool.

## Learning Workflow

1. **Get codebase statistics**
   - Use `mcp__grepika__stats` with `detailed: true`
   - Understand languages, file count, and codebase size

2. **Show directory structure**
   - Use `mcp__grepika__toc` to display the tree
   - Identify main directories and their purposes

3. **Find key files for the area**
   - Use `mcp__grepika__search` to find important files
   - For general overview, search for: "main entry point", "configuration", "core logic"
   - For specific areas, search for that topic

4. **Extract structure of main files**
   - Use `mcp__grepika__outline` on the most important files
   - Show exports, functions, classes, and types

5. **Read key sections**
   - Use `mcp__grepika__get` to show important code snippets
   - Focus on entry points, configuration, and core abstractions

## Output Format

### General Overview
```
## Codebase Overview

### Statistics
- **Languages**: [breakdown]
- **Total files**: [count]
- **Lines of code**: [estimate]

### Directory Structure
[tree view with annotations]

### Architecture Summary
[2-3 paragraphs explaining the high-level design]

### Key Modules
| Module | Location | Purpose |
|--------|----------|---------|
| [name] | [path] | [what it does] |

### Entry Points
- **Main**: [path] - [description]
- **API**: [path] - [description]
- **CLI**: [path] - [description]

### Configuration
- [list config files and their purposes]

### Recommended Reading Order
1. [file] - Start here to understand [concept]
2. [file] - Then learn about [concept]
3. [file] - Finally explore [concept]
```

### Focused Area
```
## Understanding: [area]

### Overview
[what this area does and why it exists]

### Key Files
| File | Purpose | Key Exports |
|------|---------|-------------|
| [path] | [purpose] | [exports] |

### Data Flow
[how data moves through this area]

### Dependencies
- **Uses**: [what this area depends on]
- **Used by**: [what depends on this area]

### Key Concepts
- **[concept 1]**: [explanation]
- **[concept 2]**: [explanation]

### Code Patterns
[common patterns used in this area]

### Getting Started
[how to make your first change in this area]
```

## Tips

- Prioritize understanding over completeness
- Highlight non-obvious architectural decisions
- Note any gotchas or common confusion points
- Suggest the most impactful files to read first

## Additional Resources

See `references/onboarding-strategies.md` for:
- Codebase type patterns (monolith, microservices, library, CLI)
- Top-down vs bottom-up learning approaches
- Output templates for quick overview and deep dive
