Memory Generator Skill
Generate comprehensive CLAUDE.md project memory files by exploring and analyzing codebases.
When to Use
Invoke this skill when:
- Starting work on a new/unfamiliar project
- A project lacks CLAUDE.md documentation
- User asks to "create memory" or "generate context" for a project
- Beginning exploration of a repository
Exploration Process
Phase 1: Project Structure Analysis
Identify project root markers:
.git/ directory
package.json, Cargo.toml, pyproject.toml, go.mod, etc.
Makefile, CMakeLists.txt, build.gradle
Map directory structure:
tree -L 3 -d --dirsfirst
# Or for large projects:
find . -type d -maxdepth 3 | head -50
Identify key directories:
- Source code:
src/, lib/, app/, pkg/
- Tests:
tests/, test/, __tests__/, spec/
- Config:
config/, .github/, .vscode/
- Docs:
docs/, doc/, documentation/
Phase 2: Technology Detection
Language detection:
# Count files by extension
find . -type f -name "*.py" | wc -l
find . -type f -name "*.go" | wc -l
find . -type f -name "*.rs" | wc -l
find . -type f -name "*.ts" -o -name "*.tsx" | wc -l
Framework detection:
- Python: Django, Flask, FastAPI, pytest
- JavaScript: React, Vue, Next.js, Express
- Go: Gin, Echo, standard library patterns
- Rust: Actix, Axum, Tokio
Dependency analysis:
- Read
requirements.txt, pyproject.toml
- Read
package.json, package-lock.json
- Read
Cargo.toml, go.mod
Phase 3: Pattern Recognition
Architecture patterns:
- Monolith vs microservices
- MVC, clean architecture, hexagonal
- Module organization
Code conventions:
- Naming patterns (snake_case, camelCase)
- File naming conventions
- Import organization
Testing patterns:
- Test file naming (
test_*.py, *_test.go)
- Fixture patterns
- Mock usage
Phase 4: Entry Point Discovery
Application entry points:
main.py, app.py, index.ts
cmd/, bin/ directories
Makefile targets
Build/run commands:
- npm scripts
- Makefile targets
- Docker compose services
Phase 5: Documentation Review
- Existing documentation:
- README.md content
- API documentation
- Architecture docs
- Contributing guides
Output: CLAUDE.md Template
# [Project Name]
## Overview
[1-2 sentence project description based on README or package metadata]
## Tech Stack
- **Language**: [Primary language and version]
- **Framework**: [Main framework if applicable]
- **Key Dependencies**: [Important libraries]
- **Testing**: [Test framework]
- **Build Tool**: [npm, cargo, make, etc.]
## Project Structure
[Simplified tree showing key directories]
### Key Directories
- `src/` - [Description]
- `tests/` - [Description]
- [Other important directories]
## Development Commands
```bash
# Install dependencies
[command]
# Run tests
[command]
# Run application
[command]
# Build
[command]
Architecture
Code Organization
[Brief description of how code is organized - modules, packages, layers]
Key Patterns
- [Pattern 1]: [Where/how it's used]
- [Pattern 2]: [Where/how it's used]
Entry Points
- [Main entry point and what it does]
- [Other important entry points]
Conventions
Naming
- Files: [convention]
- Functions/methods: [convention]
- Classes/types: [convention]
Code Style
- [Formatter used]
- [Linter used]
- [Key style rules]
Testing
- Test files: [naming pattern]
- Fixtures: [location/pattern]
- Running: [command]
Important Files
| File |
Purpose |
| [file1] |
[purpose] |
| [file2] |
[purpose] |
Notes for Claude
- [Important context about how to work with this codebase]
- [Any quirks or non-obvious patterns]
- [Preferred approaches for this project]
## Customization
Tailor the generated CLAUDE.md based on:
### For ML/AI Projects
- Add sections on:
- Model architecture locations
- Training scripts
- Dataset handling
- Experiment tracking
### For Web Applications
- Add sections on:
- API endpoints
- Frontend structure
- Database schema location
- Authentication flow
### For Libraries/Packages
- Add sections on:
- Public API surface
- Versioning approach
- Breaking change policy
- Example usage
### For Monorepos
- Add sections on:
- Package/workspace structure
- Shared dependencies
- Inter-package relationships
- Build order
## Usage Example
When user says:
- "Generate memory for this project"
- "Create CLAUDE.md for this repo"
- "Help me understand this codebase"
Execute exploration process and generate CLAUDE.md:
```bash
# Step 1: Basic structure
ls -la
tree -L 2 -d --dirsfirst 2>/dev/null || find . -type d -maxdepth 2
# Step 2: Detect language/framework
cat package.json 2>/dev/null | head -30
cat pyproject.toml 2>/dev/null | head -30
cat Cargo.toml 2>/dev/null | head -30
cat go.mod 2>/dev/null
# Step 3: Read existing docs
cat README.md 2>/dev/null | head -100
# Step 4: Sample source files to understand patterns
# Find representative files and read them
# Step 5: Generate CLAUDE.md
Output Location
- Primary:
./CLAUDE.md (project root, version controlled)
- Alternative:
./.claude/CLAUDE.md (claude-specific directory)
- Private:
./CLAUDE.local.md (gitignored, personal notes)
Ask user preference if unclear.
1---2name: memory-generator3description: Generate CLAUDE.md project memory files by exploring codebases. Use when user asks to "generate memory", "create CLAUDE.md", "document this project", "understand this codebase", or starts work on a new/unfamiliar repository. Triggers on new project onboarding and documentation requests.4---56# Memory Generator Skill78Generate comprehensive CLAUDE.md project memory files by exploring and analyzing codebases.910## When to Use1112Invoke this skill when:13- Starting work on a new/unfamiliar project14- A project lacks CLAUDE.md documentation15- User asks to "create memory" or "generate context" for a project16- Beginning exploration of a repository1718## Exploration Process1920### Phase 1: Project Structure Analysis21221. **Identify project root markers**:23 - `.git/` directory24 - `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, etc.25 - `Makefile`, `CMakeLists.txt`, `build.gradle`26272. **Map directory structure**:28 ```bash29 tree -L 3 -d --dirsfirst30 # Or for large projects:31 find . -type d -maxdepth 3 | head -5032 ```33343. **Identify key directories**:35 - Source code: `src/`, `lib/`, `app/`, `pkg/`36 - Tests: `tests/`, `test/`, `__tests__/`, `spec/`37 - Config: `config/`, `.github/`, `.vscode/`38 - Docs: `docs/`, `doc/`, `documentation/`3940### Phase 2: Technology Detection41421. **Language detection**:43 ```bash44 # Count files by extension45 find . -type f -name "*.py" | wc -l46 find . -type f -name "*.go" | wc -l47 find . -type f -name "*.rs" | wc -l48 find . -type f -name "*.ts" -o -name "*.tsx" | wc -l49 ```50512. **Framework detection**:52 - Python: Django, Flask, FastAPI, pytest53 - JavaScript: React, Vue, Next.js, Express54 - Go: Gin, Echo, standard library patterns55 - Rust: Actix, Axum, Tokio56573. **Dependency analysis**:58 - Read `requirements.txt`, `pyproject.toml`59 - Read `package.json`, `package-lock.json`60 - Read `Cargo.toml`, `go.mod`6162### Phase 3: Pattern Recognition63641. **Architecture patterns**:65 - Monolith vs microservices66 - MVC, clean architecture, hexagonal67 - Module organization68692. **Code conventions**:70 - Naming patterns (snake_case, camelCase)71 - File naming conventions72 - Import organization73743. **Testing patterns**:75 - Test file naming (`test_*.py`, `*_test.go`)76 - Fixture patterns77 - Mock usage7879### Phase 4: Entry Point Discovery80811. **Application entry points**:82 - `main.py`, `app.py`, `index.ts`83 - `cmd/`, `bin/` directories84 - `Makefile` targets85862. **Build/run commands**:87 - npm scripts88 - Makefile targets89 - Docker compose services9091### Phase 5: Documentation Review92931. **Existing documentation**:94 - README.md content95 - API documentation96 - Architecture docs97 - Contributing guides9899## Output: CLAUDE.md Template100101```markdown102# [Project Name]103104## Overview105[1-2 sentence project description based on README or package metadata]106107## Tech Stack108- **Language**: [Primary language and version]109- **Framework**: [Main framework if applicable]110- **Key Dependencies**: [Important libraries]111- **Testing**: [Test framework]112- **Build Tool**: [npm, cargo, make, etc.]113114## Project Structure115```116[Simplified tree showing key directories]117```118119### Key Directories120- `src/` - [Description]121- `tests/` - [Description]122- [Other important directories]123124## Development Commands125126```bash127# Install dependencies128[command]129130# Run tests131[command]132133# Run application134[command]135136# Build137[command]138```139140## Architecture141142### Code Organization143[Brief description of how code is organized - modules, packages, layers]144145### Key Patterns146- [Pattern 1]: [Where/how it's used]147- [Pattern 2]: [Where/how it's used]148149### Entry Points150- [Main entry point and what it does]151- [Other important entry points]152153## Conventions154155### Naming156- Files: [convention]157- Functions/methods: [convention]158- Classes/types: [convention]159160### Code Style161- [Formatter used]162- [Linter used]163- [Key style rules]164165### Testing166- Test files: [naming pattern]167- Fixtures: [location/pattern]168- Running: [command]169170## Important Files171172| File | Purpose |173|------|---------|174| [file1] | [purpose] |175| [file2] | [purpose] |176177## Notes for Claude178179- [Important context about how to work with this codebase]180- [Any quirks or non-obvious patterns]181- [Preferred approaches for this project]182```183184## Customization185186Tailor the generated CLAUDE.md based on:187188### For ML/AI Projects189- Add sections on:190 - Model architecture locations191 - Training scripts192 - Dataset handling193 - Experiment tracking194195### For Web Applications196- Add sections on:197 - API endpoints198 - Frontend structure199 - Database schema location200 - Authentication flow201202### For Libraries/Packages203- Add sections on:204 - Public API surface205 - Versioning approach206 - Breaking change policy207 - Example usage208209### For Monorepos210- Add sections on:211 - Package/workspace structure212 - Shared dependencies213 - Inter-package relationships214 - Build order215216## Usage Example217218When user says:219- "Generate memory for this project"220- "Create CLAUDE.md for this repo"221- "Help me understand this codebase"222223Execute exploration process and generate CLAUDE.md:224225```bash226# Step 1: Basic structure227ls -la228tree -L 2 -d --dirsfirst 2>/dev/null || find . -type d -maxdepth 2229230# Step 2: Detect language/framework231cat package.json 2>/dev/null | head -30232cat pyproject.toml 2>/dev/null | head -30233cat Cargo.toml 2>/dev/null | head -30234cat go.mod 2>/dev/null235236# Step 3: Read existing docs237cat README.md 2>/dev/null | head -100238239# Step 4: Sample source files to understand patterns240# Find representative files and read them241242# Step 5: Generate CLAUDE.md243```244245## Output Location246247- Primary: `./CLAUDE.md` (project root, version controlled)248- Alternative: `./.claude/CLAUDE.md` (claude-specific directory)249- Private: `./CLAUDE.local.md` (gitignored, personal notes)250251Ask user preference if unclear.