- Add 15 comprehensive skills extracted from Windsurf workflows - Cover debugging, testing, releases, deployment, security, and documentation - Each skill includes step-by-step instructions and copy-pasteable commands - Skills organized by category with cross-references and difficulty levels
8.6 KiB
8.6 KiB
Scan Repo & Update Context Skill
Description: Scan entire repository and generate comprehensive context documentation for AI assistants.
When to Use
- Onboarding new AI assistants or developers
- After major architectural changes
- Creating project documentation
- Setting up Windsurf/Cursor/other AI tools
Prerequisites
- Full repository access
- Read permissions on all files
- Understanding of project structure
Quick Start
# From repo root
/.windsurf/workflows/scan-repo-and-update-windsurf-context.md
Or run the workflow directly if supported:
/windsurf-workflow scan-repo-and-update-windsurf-context
Scanning Process
Phase 1: Read Key Documentation
Start with high-level understanding:
# Core documentation files
cat AGENTS.md # AI agent guide
cat README.md # Project overview
cat ARCHITECTURE.md # Technical architecture
cat CONTRIBUTING.md # Contribution guidelines
cat .windsurfrules # Windsurf-specific rules
Phase 2: Understand Project Structure
Scan directory structure:
# Get overview
find . -type d -maxdepth 2 | sort
# Key source directories
find . -name "src" -type d
find . -name "lib" -type d
find . -name "components" -type d
find . -name "modules" -type d
# Configuration files
find . -name "package.json" -o -name "Cargo.toml" -o -name "pom.xml" -o -name "build.gradle*"
Phase 3: Analyze Code Organization
For each major component:
# List key files
ls -la src/
ls -la lib/
ls -la components/
# Find main entry points
find . -name "main.*" -o -name "index.*" -o -name "App.*"
# Find configuration
find . -name "*.config.*" -o -name "*.env*" -o -name "settings.*"
Phase 4: Identify Patterns
Look for common patterns:
# API routes
find . -path "*/api/*" -name "*.js" -o -name "*.ts" -o -name "*.py"
# Database models
find . -name "*model*" -o -name "*schema*" -o -name "*entity*"
# Test files
find . -name "*test*" -o -name "*spec*"
# Documentation
find . -name "*.md" -o -name "*.rst" -o -name "*.txt"
Generating Context Documentation
Structure Template
# [PROJECT_NAME] Context Documentation
> Auto-generated on: YYYY-MM-DD HH:MM
> Regenerate with: /scan-repo-and-update-windsurf-context
## Project Summary
[Brief 1-paragraph description of the project]
## Architecture
[High-level architecture overview]
## Module Map
| Module | Purpose | Key Files |
| ------ | ------------------------------ | ---------------------- |
| auth | Authentication & authorization | src/auth/, lib/auth.js |
| api | REST API endpoints | src/api/, routes/ |
| db | Database layer | src/db/, models/ |
## Technology Stack
- **Frontend**: [Framework], [Language]
- **Backend**: [Framework], [Language]
- **Database**: [Database type]
- **Deployment**: [Platform]
## Key Directories
project-root/ ├── src/ # Main source code ├── tests/ # Test files ├── docs/ # Documentation ├── config/ # Configuration files └── scripts/ # Build/utility scripts
## Important Files
| File | Purpose |
|------|---------|
| package.json | Dependencies and scripts |
| .env.example | Environment variables template |
| docker-compose.yml | Container orchestration |
| README.md | Project documentation |
## Development Workflow
1. Setup: [Setup instructions]
2. Development: [How to run locally]
3. Testing: [How to run tests]
4. Deployment: [How to deploy]
## Common Commands
```bash
# Install dependencies
npm install
# Run development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
Coding Conventions
- File naming: [Pattern]
- Commit messages: [Format]
API Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/health | Health check |
| POST | /api/auth/login | User login |
Database Schema
[Key tables/collections and relationships]
Environment Variables
| Variable | Required? | Description |
|---|---|---|
| API_KEY | Yes | External API key |
| DB_URL | Yes | Database connection |
Troubleshooting
Common Issues
- Problem: Solution
- Problem: Solution
Debug Commands
# Check logs
tail -f logs/app.log
# Debug mode
DEBUG=1 npm run dev
## Implementation for Different Project Types
### JavaScript/TypeScript Project
```bash
# Scan package.json for dependencies
cat package.json | jq '.dependencies, .devDependencies'
# Find TypeScript config
find . -name "tsconfig.json"
# Check for framework-specific files
ls next.config.js webpack.config.js vite.config.js
Python Project
# Check requirements
cat requirements.txt pyproject.toml setup.py
# Find Python modules
find . -name "__init__.py" | head -20
# Check for Django/Flask
ls manage.py app.py wsgi.py
Mobile Project (React Native)
# Check React Native config
cat package.json | jq '.dependencies | keys | map(select(contains("react-native")))'
# Find platform-specific code
ls android/ ios/
# Check for native modules
ls android/app/src/main/java/ ios/YourApp/
Java/Kotlin Project
# Check Gradle configuration
cat build.gradle settings.gradle gradle.properties
# Find main source directory
find . -name "src/main/java"
# Check for Spring Boot
ls src/main/resources/application*.yml
Automation Script
Create scripts/generate-context.sh:
#!/bin/bash
# Generate context documentation
echo "Scanning repository..."
PROJECT_NAME=$(basename $(pwd))
OUTPUT_FILE="WINDSURF_CONTEXT.md"
# Header
cat > $OUTPUT_FILE << EOF
# $PROJECT_NAME Context Documentation
> Auto-generated on: $(date)
> Regenerate with: /scan-repo-and-update-windsurf-context
EOF
# Project summary
if [ -f "README.md" ]; then
echo "## Project Summary" >> $OUTPUT_FILE
head -20 README.md >> $OUTPUT_FILE
echo "" >> $OUTPUT_FILE
fi
# Directory structure
echo "## Directory Structure" >> $OUTPUT_FILE
echo '```' >> $OUTPUT_FILE
tree -L 2 -I 'node_modules|.git|dist|build' >> $OUTPUT_FILE
echo '```' >> $OUTPUT_FILE
echo "" >> $OUTPUT_FILE
# Dependencies
if [ -f "package.json" ]; then
echo "## Dependencies" >> $OUTPUT_FILE
echo '```json' >> $OUTPUT_FILE
cat package.json | jq '.dependencies' >> $OUTPUT_FILE
echo '```' >> $OUTPUT_FILE
fi
echo "Context documentation generated: $OUTPUT_FILE"
Best Practices
What to Include
- Project purpose - What does this project do?
- Architecture - How is it structured?
- Key components - Main modules and their purpose
- Development setup - How to get started
- Common tasks - Frequently used commands
- Important patterns - Coding conventions
- Troubleshooting - Common issues and solutions
What to Exclude
- Sensitive data - Never include real keys/passwords
- Temporary files - build/, dist/, node_modules/
- Personal notes - Keep it professional
- Outdated information - Keep it current
Formatting Tips
- Use consistent formatting - Markdown tables, code blocks
- Include examples - Show, don't just tell
- Cross-reference - Link to related sections
- Keep it scannable - Use headings, lists, bold text
Integration with AI Tools
Windsurf
The generated WINDSURF_CONTEXT.md is automatically picked up by Windsurf.
Cursor
Add to .cursorrules:
Always reference WINDSURF_CONTEXT.md for project understanding
GitHub Copilot
Include in .github/copilot-instructions.md:
## Project Context
See WINDSURF_CONTEXT.md for full project understanding
Maintenance
When to Update
- After major feature additions
- When architecture changes
- On regular schedule (monthly/quarterly)
- When new developers join
Version Control
# Commit generated context
git add WINDSURF_CONTEXT.md
git commit -m "docs: update AI context documentation"
git push
Notes
- Keep it current - Outdated context is worse than no context
- Be comprehensive - Include everything a new developer would need
- Use examples - Concrete examples are more helpful than abstract descriptions
- Review regularly - Ensure accuracy and completeness
Related Skills
- Update Agent Documentation - For AI-specific docs
- Architecture Patterns - Understanding architecture
- Local Development Setup - Setting up to work
- Documentation Standards - Writing good docs