Skip to content

claude-commands/command-profile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

command-profile

A Claude Code slash command for performance profiling and optimization suggestions.

Installation

# Clone to your preferred location
git clone git@github.com:claude-commands/command-profile.git <clone-path>/command-profile

# Symlink (use full path to cloned repo)
ln -s <clone-path>/command-profile/profile.md ~/.claude/commands/profile.md

Usage

/profile                      # Find performance issues in project
/profile src/api/users.ts     # Profile specific file
/profile handleRequest        # Profile specific function
/profile --memory             # Focus on memory usage
/profile --cpu                # Focus on CPU hotspots

What it does

  1. Detects language and profiling tools
  2. Identifies slow functions and hotspots
  3. Analyzes complexity and patterns
  4. Generates optimization suggestions
  5. Creates benchmarks for comparison

Output Format

# Performance Profile

## Hotspots Identified
1. getUserWithPosts (Line 45)
   - Issue: N+1 query pattern
   - Fix: Use JOIN or batch loading
   - Impact: 10x improvement

## Memory Concerns
| Function | Allocations |
| -------- | ----------- |
| loadAllUsers | 45/call |

## Recommendations
1. Fix N+1 queries
2. Add caching layer

Language Support

Language Profiler
Node.js node --prof, clinic.js
Go pprof, trace
Python cProfile, py-spy
Rust perf, flamegraph

Common Issues Detected

Pattern Issue
Nested loops O(n²) complexity
N+1 queries Database round trips
Sync I/O Blocking operations
No caching Repeated computation

Requirements

  • Source code to analyze
  • Claude Code with Opus 4.5 model access

Updates

cd <clone-path>/command-profile && git pull

About

Claude Code command: Performance profiling and optimization suggestions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •