---
name: analyze-project
description: Analyze project structure using Tree-sitter parser. Shows functions, classes, imports, and codebase overview.
---

# Project Analysis Skill

## Description

This skill analyzes a project directory using Tree-sitter parsing to provide a comprehensive overview of the codebase structure, including all functions, classes, and import dependencies.

## When to Use

- When the user asks "analyze this project" or "show me the project structure"
- When you need to understand a codebase before making changes
- When refactoring and need to know what exists in the codebase
- When the user asks about the overall structure of their code

## How to Use

### Step 1: Determine the Path

Ask the user which directory to analyze, or default to the current directory.

### Step 2: Run Analysis

Use the `analyze_project` tool:

```python
analyze_project(
    path=".",  # Project directory
    extensions="py,js,ts",  # Optional: specific file types
    max_files=100  # Limit number of files
)
```

### Step 3: Interpret Results

The tool returns JSON with:
- `files`: List of analyzed files with their functions, classes, and imports
- `total_functions`: Total function count
- `total_classes`: Total class count
- `languages`: Breakdown by language

## Examples

### Example 1: Full Project Analysis

**User Request:** "Analyze this project"

**Approach:**
1. Call `analyze_project(path=".")`
2. Summarize the structure: "Found X files, Y functions, Z classes"
3. List key modules and their purpose

### Example 2: Specific Language Analysis

**User Request:** "Show me all Python classes in this project"

**Approach:**
1. Call `analyze_project(path=".", extensions="py")`
2. Extract and list all classes with their locations
3. Group by module if many classes exist

## Supported Languages

- Python (.py, .pyi)
- JavaScript (.js, .jsx)
- TypeScript (.ts, .tsx)
- C/C++ (.c, .h, .cpp, .hpp)
- Go (.go)
- Rust (.rs)
- Java (.java)

## Notes

- For large codebases, use `max_files` to limit analysis scope
- Combine with `/callgraph` for deeper understanding
- Use `/deps` to see import relationships
