Analyze and optimize code for performance, bundle size, and best practices. Suggests improvements.
When this skill is invoked, analyze the codebase and suggest optimizations.
# Identify project type
ls package.json requirements.txt go.mod Cargo.toml 2>/dev/null
# Check bundle/build size if applicable
ls -la dist/ build/ .next/ 2>/dev/null
# Count lines of code
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" \) -not -path "./node_modules/*" | xargs wc -l 2>/dev/null | tail -1
# For Node.js projects
npx depcheck 2>/dev/null || echo "depcheck not available"
npm outdated 2>/dev/null || pnpm outdated 2>/dev/null
npm ls --all 2>/dev/null | grep -E "deduped|invalid" | head -20
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" \) -not -path "./node_modules/*" -size +50k 2>/dev/null
# Files with many if/else/switch statements
grep -rc "if\|else\|switch\|case" --include="*.ts" --include="*.js" . 2>/dev/null | sort -t: -k2 -nr | head -10
# Event listeners without cleanup
grep -rn "addEventListener\|on(" --include="*.ts" --include="*.tsx" . 2>/dev/null | head -20
For frontend projects:
# Check if bundle analyzer is available
npm run build --if-present 2>/dev/null
npx source-map-explorer dist/**/*.js 2>/dev/null || echo "Run: npm install -D source-map-explorer"
# Optimization Report
## Summary
- Total files analyzed: X
- Potential issues found: Y
- Estimated improvement: Z%
## High Priority
1. **Issue**: Description
**Impact**: High/Medium/Low
**Fix**: How to fix
## Medium Priority
...
## Low Priority
...
## Recommended Actions
1. Action 1
2. Action 2
3. Action 3
These optimizations typically provide immediate benefits:
--deps - Only analyze dependencies--perf - Only check performance patterns--bundle - Only analyze bundle size--full - Complete optimization analysisSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer