Identify and resolve performance bottlenecks through profiling, measurement, and targeted optimization.
/plugin marketplace add nguyenthienthanh/aura-frog/plugin install aura-frog@aurafrogThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Category: Dev Expert Version: 1.0.0 Used By: All development agents
Identify and resolve performance bottlenecks through profiling, measurement, and targeted optimization.
1. Measure first, optimize second
2. Optimize the bottleneck, not everything
3. 80/20 rule: 80% of slowness is in 20% of code
4. Premature optimization is the root of all evil
| Layer | Tools | Metrics |
|---|---|---|
| Frontend | Lighthouse, DevTools | FCP, LCP, TTI, CLS |
| Backend | APM, profilers | Response time, throughput |
| Database | EXPLAIN, slow query log | Query time, index usage |
| Memory | Heap snapshots | Allocation, leaks |
| Metric | Good | Description |
|---|---|---|
| LCP | < 2.5s | Largest Contentful Paint |
| FID | < 100ms | First Input Delay |
| CLS | < 0.1 | Cumulative Layout Shift |
// Lazy load images
<img loading="lazy" src="image.jpg" />
// Code splitting
const Component = lazy(() => import('./Component'))
// Debounce handlers
const handleSearch = debounce((q) => search(q), 300)
// Memoize expensive computations
const result = useMemo(() => expensiveCalc(data), [data])
| Issue | Solution |
|---|---|
| N+1 queries | Eager loading, batching |
| Missing indexes | Add appropriate indexes |
| Unbounded queries | Pagination, limits |
| Sync blocking | Async/parallel processing |
| No caching | Cache hot data |
// Batch database calls
const users = await User.findByIds(ids) // 1 query, not N
// Add indexes
CREATE INDEX idx_users_email ON users(email)
// Cache expensive queries
const data = await cache.getOrSet('key', () => db.query(), 3600)
// Parallel async
const [users, orders] = await Promise.all([getUsers(), getOrders()])
-- Always EXPLAIN slow queries
EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = 123;
-- Look for: Seq Scan (bad), Index Scan (good)
| Query Pattern | Index Type |
|---|---|
| Exact match | B-tree (default) |
| Range queries | B-tree |
| Full-text search | GIN/GiST |
| JSON fields | GIN |
| Cache Level | TTL | Use Case |
|---|---|---|
| Browser | Hours-Days | Static assets |
| CDN | Minutes-Hours | API responses |
| Application | Seconds-Minutes | Computed data |
| Database | Varies | Query cache |
// Time-based
cache.set(key, value, { ttl: 3600 })
// Event-based
onUserUpdate(user => cache.delete(`user:${user.id}`))
// Version-based
cache.set(`data:v${version}`, value)
| Cause | Fix |
|---|---|
| Event listeners not removed | Cleanup in useEffect/destroy |
| Closures holding references | Null out references |
| Growing arrays/maps | Use WeakMap, clear periodically |
| Timers not cleared | clearInterval/clearTimeout |
// Node.js heap snapshot
const v8 = require('v8')
v8.writeHeapSnapshot()
// Browser DevTools
// Memory tab → Take heap snapshot → Compare
Before:
After:
Version: 1.0.0 | Last Updated: 2025-11-28
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.