๐ฏ Best Practices¶
Essential guidelines and proven strategies for optimal LookAtni File Markers usage.
Project Organization¶
File Structure Guidelines¶
โ Recommended Structure:
my-project/
โโโ src/ # Source code (always include)
โ โโโ components/ # Reusable components
โ โโโ pages/ # Page components
โ โโโ utils/ # Utility functions
โ โโโ types/ # Type definitions
โ โโโ hooks/ # Custom hooks
โโโ docs/ # Documentation (include)
โโโ tests/ # Test files (selective)
โโโ public/ # Static assets (selective)
โโโ config/ # Configuration files (include)
โโโ scripts/ # Build/utility scripts (include)
โโโ package.json # Always include
โโโ README.md # Always include
โโโ .gitignore # Include for reference
โโโ node_modules/ # Never include
๐ง Configuration Example:
{
"include": [
"src/**/*.{ts,tsx,js,jsx}",
"docs/**/*.{md,mdx}",
"config/**/*.{json,js,ts}",
"scripts/**/*.{js,ts,sh}",
"*.{json,md,yml,yaml}",
".gitignore",
".env.example"
],
"exclude": [
"node_modules/**",
"dist/**",
"build/**",
"coverage/**",
"*.log",
".git/**",
".vscode/**",
"**/*.test.*",
"**/*.spec.*"
]
}
File Naming Conventions¶
๐ Consistent Naming:
- Descriptive names:
user-profile-markers.txtvsmarkers.txt - Version indicators:
project-v1.2.0-markers.txt - Timestamps:
project-20240712-1430.txt - Environment tags:
project-prod-stable.txt
๐ท๏ธ Naming Templates:
{
"templates": {
"development": "{{project}}-dev-{{timestamp}}.txt",
"staging": "{{project}}-staging-{{version}}.txt",
"production": "{{project}}-prod-{{version}}-{{date}}.txt",
"feature": "{{project}}-feature-{{branch}}-{{timestamp}}.txt"
}
}
Generation Best Practices¶
Smart Filtering Strategies¶
๐ฏ Purpose-Driven Generation:
Performance Optimization¶
โก Speed Guidelines:
- Use specific patterns instead of broad includes
- Exclude large directories early in the pattern
- Use parallel processing for large projects
- Stream large files to reduce memory usage
# Optimized for large projects
lookatni generate \
--source . \
--include "src/**/*.{ts,tsx}" \
--exclude "node_modules/**,dist/**,coverage/**" \
--parallel=8 \
--stream \
--compress
๐พ Memory Management:
{
"performance": {
"maxFileSize": "5MB",
"maxTotalSize": "100MB",
"streamThreshold": "1MB",
"parallelThreads": 4,
"useTemporaryFiles": true
}
}
Validation Best Practices¶
Comprehensive Validation Strategy¶
๐ Multi-Level Validation:
# 1. Quick syntax check
lookatni validate markers.txt
# 2. Detailed analysis
lookatni validate markers.txt --detailed --fix-suggestions
# 3. Strict production validation
lookatni validate markers.txt --strict --report validation.json
# 4. Cross-validation with extraction
lookatni extract markers.txt --dry-run --verbose
Error Prevention¶
๐ก๏ธ Common Issues Prevention:
| Issue | Prevention | Solution |
|---|---|---|
| Large files | Set size limits | Use maxFileSize in config |
| Binary files | Exclude patterns | Add *.{jpg,png,pdf} to exclude |
| Path conflicts | Normalize paths | Use --normalize-paths flag |
| Encoding issues | Specify encoding | Set defaultEncoding: "utf-8" |
| Missing dependencies | Include related files | Use dependency analysis |
โ๏ธ Preventive Configuration:
{
"validation": {
"strict": true,
"maxFileSize": "10MB",
"allowedExtensions": [
".js", ".ts", ".jsx", ".tsx",
".json", ".md", ".css", ".html"
],
"requiredFiles": ["package.json", "README.md"],
"customRules": [
{
"pattern": "**/*.{jpg,png,gif}",
"action": "warn",
"message": "Binary files should be excluded"
}
]
}
}
Extraction Best Practices¶
Safe Extraction Practices¶
๐ Safety-First Approach:
# 1. Always preview first
lookatni extract markers.txt --dry-run
# 2. Extract to clean directory
mkdir -p ./extracted/project-name
lookatni extract markers.txt --output ./extracted/project-name
# 3. Use backup for existing projects
lookatni extract markers.txt --output ./existing-project --backup
# 4. Validate after extraction
lookatni verify markers.txt --extracted ./extracted/project-name
Conflict Resolution Strategies¶
๐ค Handling Conflicts:
Team Collaboration Guidelines¶
Sharing Protocols¶
๐ค Distribution Best Practices:
- Always validate before sharing
- Include documentation about the markers
- Use descriptive filenames with context
- Provide extraction instructions
- Include version information
๐ Sharing Checklist:
## Marker File Checklist
- [ ] Generated with latest LookAtni version
- [ ] Passed strict validation
- [ ] Descriptive filename with version/date
- [ ] Includes README or documentation
- [ ] Tested extraction in clean environment
- [ ] File size reasonable for distribution method
- [ ] Contains only necessary files
- [ ] Sensitive data excluded (.env, secrets, etc.)
Version Control Integration¶
๐ Git Workflow:
# .gitignore additions
markers/
*.markers.txt
temp-extraction/
# Pre-commit hook example
#!/bin/sh
# Validate any marker files before commit
if ls *.txt 1> /dev/null 2>&1; then
for file in *.txt; do
if [[ $file == *"markers"* ]]; then
echo "Validating $file..."
lookatni validate "$file" --strict || exit 1
fi
done
fi
Security Best Practices¶
Data Protection¶
๐ Security Guidelines:
- Never include sensitive data:
- API keys, passwords, tokens
- Database credentials
- Private certificates
-
Personal information
-
Use exclusion patterns:
-
Validate before sharing:
Access Control¶
๐ฅ Sharing Permissions:
- Internal projects: Team access only
- Open source: Public safe files only
- Client work: Explicit permission required
- Educational: Remove proprietary code
Performance Guidelines¶
Optimization Strategies¶
๐ Speed Optimization:
| Project Size | Strategy | Configuration |
|---|---|---|
| Small (<10MB) | Standard | Default settings |
| Medium (10-100MB) | Selective | Filter patterns, parallel processing |
| Large (100MB+) | Optimized | Streaming, compression, chunking |
| Enterprise (1GB+) | Advanced | Custom scripts, incremental processing |
โ๏ธ Large Project Configuration:
{
"performance": {
"parallel": true,
"threads": 8,
"streaming": true,
"compression": true,
"chunkSize": "10MB",
"tempDirectory": "/tmp/lookatni",
"maxMemory": "4GB"
}
}
Resource Management¶
๐พ Memory & Storage:
# Monitor resource usage
lookatni generate --source . --monitor-resources
# Set limits
lookatni generate \
--source . \
--max-memory=2GB \
--max-files=10000 \
--timeout=300
# Cleanup temporary files
lookatni cleanup --temp-files --older-than=1h
Quality Assurance¶
Testing Workflows¶
๐งช QA Process:
-
Generation Testing:
-
Validation Testing:
-
Extraction Testing:
Automated Testing¶
๐ค CI/CD Testing:
# GitHub Actions example
- name: Test Marker Generation
run: |
# Generate test markers
lookatni generate --source ./test-project --output test.txt
# Validate
lookatni validate test.txt --strict
# Test extraction
lookatni extract test.txt --output ./extracted --dry-run
# Verify integrity
lookatni verify test.txt --extracted ./extracted
Troubleshooting Guide¶
Common Issues & Solutions¶
โ File Too Large Error:
โ Permission Denied:
# Solution: Check directory permissions
chmod 755 output-directory
lookatni extract --output ./safe-directory
โ Invalid Path Characters:
โ Memory Issues:
Next: Explore Advanced Topics for technical deep-dive.