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---5
6# Memory Generator Skill
7
8Generate comprehensive CLAUDE.md project memory files by exploring and analyzing codebases.
9
10## When to Use
11
12Invoke this skill when:
13- Starting work on a new/unfamiliar project
14- A project lacks CLAUDE.md documentation
15- User asks to "create memory" or "generate context" for a project
16- Beginning exploration of a repository
17
18## Exploration Process
19
20### Phase 1: Project Structure Analysis
21
221. **Identify project root markers**:
23 - `.git/` directory
24 - `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, etc.
25 - `Makefile`, `CMakeLists.txt`, `build.gradle`
26
272. **Map directory structure**:
28 ```bash
29 tree -L 3 -d --dirsfirst
30 # Or for large projects:
31 find . -type d -maxdepth 3 | head -50
32 ```
33
343. **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/`
39
40### Phase 2: Technology Detection
41
421. **Language detection**:
43 ```bash
44 # Count files by extension
45 find . -type f -name "*.py" | wc -l
46 find . -type f -name "*.go" | wc -l
47 find . -type f -name "*.rs" | wc -l
48 find . -type f -name "*.ts" -o -name "*.tsx" | wc -l
49 ```
50
512. **Framework detection**:
52 - Python: Django, Flask, FastAPI, pytest
53 - JavaScript: React, Vue, Next.js, Express
54 - Go: Gin, Echo, standard library patterns
55 - Rust: Actix, Axum, Tokio
56
573. **Dependency analysis**:
58 - Read `requirements.txt`, `pyproject.toml`
59 - Read `package.json`, `package-lock.json`
60 - Read `Cargo.toml`, `go.mod`
61
62### Phase 3: Pattern Recognition
63
641. **Architecture patterns**:
65 - Monolith vs microservices
66 - MVC, clean architecture, hexagonal
67 - Module organization
68
692. **Code conventions**:
70 - Naming patterns (snake_case, camelCase)
71 - File naming conventions
72 - Import organization
73
743. **Testing patterns**:
75 - Test file naming (`test_*.py`, `*_test.go`)
76 - Fixture patterns
77 - Mock usage
78
79### Phase 4: Entry Point Discovery
80
811. **Application entry points**:
82 - `main.py`, `app.py`, `index.ts`
83 - `cmd/`, `bin/` directories
84 - `Makefile` targets
85
862. **Build/run commands**:
87 - npm scripts
88 - Makefile targets
89 - Docker compose services
90
91### Phase 5: Documentation Review
92
931. **Existing documentation**:
94 - README.md content
95 - API documentation
96 - Architecture docs
97 - Contributing guides
98
99## Output: CLAUDE.md Template
100
101```markdown
102# [Project Name]
103
104## Overview
105[1-2 sentence project description based on README or package metadata]
106
107## Tech Stack
108- **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.]
113
114## Project Structure
115```
116[Simplified tree showing key directories]
117```
118
119### Key Directories
120- `src/` - [Description]
121- `tests/` - [Description]
122- [Other important directories]
123
124## Development Commands
125
126```bash
127# Install dependencies
128[command]
129
130# Run tests
131[command]
132
133# Run application
134[command]
135
136# Build
137[command]
138```
139
140## Architecture
141
142### Code Organization
143[Brief description of how code is organized - modules, packages, layers]
144
145### Key Patterns
146- [Pattern 1]: [Where/how it's used]
147- [Pattern 2]: [Where/how it's used]
148
149### Entry Points
150- [Main entry point and what it does]
151- [Other important entry points]
152
153## Conventions
154
155### Naming
156- Files: [convention]
157- Functions/methods: [convention]
158- Classes/types: [convention]
159
160### Code Style
161- [Formatter used]
162- [Linter used]
163- [Key style rules]
164
165### Testing
166- Test files: [naming pattern]
167- Fixtures: [location/pattern]
168- Running: [command]
169
170## Important Files
171
172| File | Purpose |
173|------|---------|
174| [file1] | [purpose] |
175| [file2] | [purpose] |
176
177## Notes for Claude
178
179- [Important context about how to work with this codebase]
180- [Any quirks or non-obvious patterns]
181- [Preferred approaches for this project]
182```
183
184## Customization
185
186Tailor the generated CLAUDE.md based on:
187
188### For ML/AI Projects
189- Add sections on:
190 - Model architecture locations
191 - Training scripts
192 - Dataset handling
193 - Experiment tracking
194
195### For Web Applications
196- Add sections on:
197 - API endpoints
198 - Frontend structure
199 - Database schema location
200 - Authentication flow
201
202### For Libraries/Packages
203- Add sections on:
204 - Public API surface
205 - Versioning approach
206 - Breaking change policy
207 - Example usage
208
209### For Monorepos
210- Add sections on:
211 - Package/workspace structure
212 - Shared dependencies
213 - Inter-package relationships
214 - Build order
215
216## Usage Example
217
218When user says:
219- "Generate memory for this project"
220- "Create CLAUDE.md for this repo"
221- "Help me understand this codebase"
222
223Execute exploration process and generate CLAUDE.md:
224
225```bash
226# Step 1: Basic structure
227ls -la
228tree -L 2 -d --dirsfirst 2>/dev/null || find . -type d -maxdepth 2
229
230# Step 2: Detect language/framework
231cat package.json 2>/dev/null | head -30
232cat pyproject.toml 2>/dev/null | head -30
233cat Cargo.toml 2>/dev/null | head -30
234cat go.mod 2>/dev/null
235
236# Step 3: Read existing docs
237cat README.md 2>/dev/null | head -100
238
239# Step 4: Sample source files to understand patterns
240# Find representative files and read them
241
242# Step 5: Generate CLAUDE.md
243```
244
245## Output Location
246
247- Primary: `./CLAUDE.md` (project root, version controlled)
248- Alternative: `./.claude/CLAUDE.md` (claude-specific directory)
249- Private: `./CLAUDE.local.md` (gitignored, personal notes)
250
251Ask user preference if unclear.