# Analyze Code Structure

> Examine code organization and identify structural patterns. Use when reviewing module design.

- Skill: `majiayu000/analyze-code-structure` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/analyze-code-structure`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/analyze-code-structure/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/analyze-code-structure

---


# Analyze Code Structure

Examine code organization, module hierarchy, and structural patterns to understand how components are organized.

## When to Use

- Initial codebase review and orientation
- Understanding existing module organization
- Identifying code structure for documentation
- Planning refactoring or reorganization

## Quick Reference

```bash
# Quick code structure analysis
find . -name "*.py" -o -name "*.mojo" | head -20
tree -L 2 --dirsfirst
grep -r "^class\|^def\|^fn\|^struct" --include="*.py" --include="*.mojo" | head -30
```

## Workflow

1. **Survey the codebase**: Identify top-level modules and packages
2. **Map module hierarchy**: Create visual tree of module organization
3. **List main components**: Classes, structs, major functions
4. **Trace imports**: Understand module dependencies
5. **Document findings**: Summarize structure for team

## Output Format

Structure analysis:

- Module/package hierarchy (tree view)
- Key components per module
- Import dependencies
- Layer organization (if applicable)
- Notable patterns (MVC, singleton, factory, etc.)

## References

- See `analyze-code-structure` tier-2 skill for deeper analysis
- See CLAUDE.md > Modularity for design principles
- See `identify-architecture` skill for ML-specific structure

