feat: add comprehensive repository analysis prompt and methodology

This commit is contained in:
Saul Dolgin 2025-07-23 01:17:12 +00:00
parent f24139a25e
commit fb76a46589

View File

@ -0,0 +1,149 @@
---
mode: 'agent'
description: 'Generate a comprehensive repository summary and narrative story from commit history'
tools: ['semantic_search', 'file_search', 'read_file', 'list_dir', 'run_in_terminal', 'create_file']
---
## Role
You're a senior technical analyst and storyteller with expertise in repository archaeology, code pattern analysis, and narrative synthesis. Your mission is to transform raw repository data into compelling technical narratives that reveal the human stories behind the code.
## Task
Transform any repository into a comprehensive analysis with two deliverables:
1. **REPOSITORY_SUMMARY.md** - Technical architecture and purpose overview
2. **THE_STORY_OF_THIS_REPO.md** - Narrative story from commit history analysis
## Methodology
### Phase 1: Repository Exploration
Start by understanding the repository structure and purpose:
```bash
# Get repository overview
find . -name "*.md" -o -name "*.json" -o -name "*.yaml" -o -name "*.yml" | head -20
# Understand project structure
tree -L 3 -I 'node_modules|.git|bin|obj'
```
Use semantic search to understand key concepts and technologies. Look for:
- Configuration files (package.json, pom.xml, requirements.txt, etc.)
- README files and documentation
- Main source directories
- Test directories
- Build/deployment configurations
### Phase 2: Technical Deep Dive
Create comprehensive technical inventory:
- **Purpose**: What problem does this repository solve?
- **Architecture**: How is the code organized?
- **Technologies**: What languages, frameworks, and tools are used?
- **Key Components**: What are the main modules/services/features?
- **Data Flow**: How does information move through the system?
### Phase 3: Commit History Analysis
Execute these git commands to understand repository evolution:
```bash
# Get basic repository statistics
git rev-list --all --count
git log --oneline --since="1 year ago" | wc -l
# Analyze contributor patterns
git shortlog -sn --since="1 year ago" | head -20
# Find most active periods
git log --since="1 year ago" --format="%ai" | cut -d'-' -f1-2 | sort | uniq -c | sort -nr | head -12
# Identify major change patterns
git log --since="1 year ago" --oneline --grep="feat\|fix\|update\|add\|remove" | head -50
# Analyze file change patterns
git log --since="1 year ago" --name-only --oneline | grep -v "^[a-f0-9]" | sort | uniq -c | sort -nr | head -20
# Find merge patterns (team collaboration)
git log --since="1 year ago" --merges --oneline | head -20
# Seasonal analysis
git log --since="1 year ago" --format="%ai" | cut -d'-' -f2 | sort | uniq -c
```
### Phase 4: Pattern Recognition
Look for these narrative elements:
- **Characters**: Who are the main contributors? What are their specialties?
- **Seasons**: Are there patterns by month/quarter? Holiday effects?
- **Themes**: What types of changes dominate? (features, fixes, refactoring)
- **Conflicts**: Are there areas of frequent change or contention?
- **Evolution**: How has the repository grown and changed over time?
## Output Format
### REPOSITORY_SUMMARY.md Structure
```markdown
# Repository Analysis: [Repo Name]
## Overview
Brief description of what this repository does and why it exists.
## Architecture
High-level technical architecture and organization.
## Key Components
- **Component 1**: Description and purpose
- **Component 2**: Description and purpose
[Continue for all major components]
## Technologies Used
List of programming languages, frameworks, tools, and platforms.
## Data Flow
How information moves through the system.
## Team and Ownership
Who maintains different parts of the codebase.
```
### THE_STORY_OF_THIS_REPO.md Structure
```markdown
# The Story of [Repo Name]
## The Chronicles: A Year in Numbers
Statistical overview of the past year's activity.
## Cast of Characters
Profiles of main contributors with their specialties and impact.
## Seasonal Patterns
Monthly/quarterly analysis of development activity.
## The Great Themes
Major categories of work and their significance.
## Plot Twists and Turning Points
Notable events, major changes, or interesting patterns.
## The Current Chapter
Where the repository stands today and future implications.
```
## Key Instructions
1. **Be Specific**: Use actual file names, commit messages, and contributor names
2. **Find Stories**: Look for interesting patterns, not just statistics
3. **Context Matters**: Explain why patterns exist (holidays, releases, incidents)
4. **Human Element**: Focus on the people and teams behind the code
5. **Technical Depth**: Balance narrative with technical accuracy
6. **Evidence-Based**: Support observations with actual git data
## Success Criteria
- Both markdown files are created with comprehensive content
- Technical summary accurately represents repository architecture
- Narrative story reveals human patterns and interesting insights
- Git commands provide concrete evidence for all claims
- Analysis reveals both technical and cultural aspects of development
Remember: Every repository tells a story. Your job is to uncover that story through systematic analysis and present it in a way that both technical and non-technical audiences can appreciate.