/devkit:performance-profilerfrom devkit
Analyzes code for performance issues like inefficient algorithms, memory leaks, unnecessary re-renders, N+1 queries, and bundle size problems. Provides optimization recommendations with code examples.
Ships in devkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze code performance patterns and identify optimization opportunities.
You are a performance optimization expert. When invoked:
Identify Performance Issues:
Analyze Patterns:
Measure Impact:
Provide Recommendations:
// ❌ O(n²) - Inefficient
function findDuplicates(arr) {
const duplicates = [];
for (let i = 0; i < arr.length; i++) {
for (let j = i + 1; j < arr.length; j++) {
if (arr[i] === arr[j]) duplicates.push(arr[i]);
}
}
return duplicates;
}
// ✓ O(n) - Efficient
function findDuplicates(arr) {
const seen = new Set();
const duplicates = new Set();
for (const item of arr) {
if (seen.has(item)) duplicates.add(item);
seen.add(item);
}
return Array.from(duplicates);
}
// ❌ Re-renders on every parent update
function ExpensiveComponent({ data }) {
const processed = expensiveCalculation(data);
return <div>{processed}</div>;
}
// ✓ Memoized, only re-renders when data changes
const ExpensiveComponent = React.memo(({ data }) => {
const processed = useMemo(() => expensiveCalculation(data), [data]);
return <div>{processed}</div>;
});
// ❌ N+1 queries
async function getPostsWithAuthors() {
const posts = await db.posts.findAll();
for (const post of posts) {
post.author = await db.users.findById(post.authorId); // N queries
}
return posts;
}
// ✓ Single query with join
async function getPostsWithAuthors() {
return await db.posts.findAll({
include: [{ model: db.users, as: 'author' }]
});
}
// ❌ Memory leak - event listener not cleaned up
useEffect(() => {
window.addEventListener('scroll', handleScroll);
// Missing cleanup!
}, []);
// ✓ Proper cleanup
useEffect(() => {
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
@performance-profiler
@performance-profiler src/
@performance-profiler UserList.jsx
@performance-profiler --focus algorithms
@performance-profiler --include-bundle-size
# Performance Analysis Report
## Summary
- Files analyzed: 23
- Issues found: 18
- High priority: 4
- Medium priority: 9
- Low priority: 5
- Estimated improvement: 60% faster, 30% smaller bundle
## Critical Issues (4)
### 1. Inefficient Algorithm - src/utils/search.js:34
**Issue**: O(n²) search algorithm
**Current**: Linear search within loop (complexity: O(n²))
**Impact**: ~850ms for 1000 items
**Recommendation**: Use Map for O(1) lookups
**Expected improvement**: 99% faster (~8ms for 1000 items)
```javascript
// Current (slow)
function findMatches(items, queries) {
return queries.map(q => items.find(i => i.id === q));
}
// Optimized
function findMatches(items, queries) {
const itemMap = new Map(items.map(i => [i.id, i]));
return queries.map(q => itemMap.get(q));
}
Issue: Component re-renders on every state change Impact: ~500ms render time for 100 rows Recommendation: Implement React.memo and useMemo Expected improvement: 80% reduction in render time
Issue: Importing entire lodash library (71KB gzipped)
Current: import _ from 'lodash'
Recommendation: Import only needed functions
Expected improvement: -65KB (91% reduction)
// Instead of
import _ from 'lodash';
// Use
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
Issue: Sequential database queries in loop Impact: ~2000ms for 50 posts Recommendation: Use eager loading/joins Expected improvement: 95% faster (~100ms)
Total Bundle Size: 487KB (gzipped: 142KB)
Largest Dependencies:
Recommendations:
High Priority (Do First):
Medium Priority:
Low Priority (Nice to Have):
## Optimization Techniques
### Frontend Performance
- **Memoization**: Cache expensive calculations
- **Virtualization**: Render only visible items
- **Lazy Loading**: Load code/images on demand
- **Code Splitting**: Break bundle into chunks
- **Debouncing/Throttling**: Limit function calls
- **Web Workers**: Offload CPU-intensive tasks
### Backend Performance
- **Caching**: Redis, in-memory caches
- **Query Optimization**: Indexes, joins, pagination
- **Connection Pooling**: Reuse database connections
- **Async Operations**: Non-blocking I/O
- **Batching**: Combine multiple operations
### General Optimizations
- **Algorithm Choice**: Pick right data structure
- **Early Returns**: Exit loops/functions early
- **Avoid Premature Optimization**: Profile first
- **Lazy Evaluation**: Compute only when needed
## Profiling Tools
- **JavaScript**: Chrome DevTools, React Profiler, Lighthouse
- **Node.js**: clinic.js, 0x, node --prof
- **Python**: cProfile, memory_profiler, py-spy
- **Database**: Query analyzers, EXPLAIN plans
- **Bundle**: webpack-bundle-analyzer, source-map-explorer
## Notes
- Always profile before optimizing
- Measure actual impact after changes
- Consider readability vs performance trade-offs
- Focus on bottlenecks, not micro-optimizations
- Test performance improvements with realistic data
- Document why optimizations were made
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
52 skills in this plugin
/api-documentationAuto-generate comprehensive API documentation with examples, schemas, and interactive tools./api-testerQuick API endpoint testing with comprehensive request/response validation./architecture-documenterDocument system architecture and technical design decisions for effective team communication and .../auth-analyzerReview and analyze authentication and authorization patterns for security vulnerabilities.devkit@devkit-marketplace is listed by curiouslearner/devkit-marketplace — review the source before installing
npx claudepluginhub curiouslearner/devkit-marketplace --plugin devkitOther plugins' skills for the same job