一键导入
profile
Run CPU and memory profiling with pprof to identify performance hotspots. Use when investigating high resource usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run CPU and memory profiling with pprof to identify performance hotspots. Use when investigating high resource usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run Go benchmarks and compare results to detect performance regressions. Use before and after performance-related changes.
Run pre-push quality checks (vet + lint + tests with race detector). Use before pushing code.
Run tests with coverage analysis and identify untested code paths. Use to find gaps before releases.
Check and tidy Go module dependencies. Use after adding/removing imports or before releases.
Run go generate to build templ templates and frontend assets. Use after changing templates or CSS/JS.
Run integration tests that require Docker (Postgres, MinIO via testcontainers). Use to validate database and storage behavior.
| name | profile |
| description | Run CPU and memory profiling with pprof to identify performance hotspots. Use when investigating high resource usage. |
| disable-model-invocation | true |
| argument-hint | cpu|memory|all package-path |
Profile Go code to identify CPU hotspots and memory allocators using pprof.
/profile cpu ./internal/index/ - CPU profiling on index package/profile memory ./internal/repo/ - Memory profiling on repo package/profile all ./... - Both CPU and memory on all packagesParse arguments
cpu, memory, or all)./...)Create profile output directory
mkdir -p .profiles
Run profiling benchmarks
For CPU profiling:
go test -cpuprofile=.profiles/cpu.prof -bench=. $PACKAGE 2>&1
For memory profiling:
go test -memprofile=.profiles/mem.prof -bench=. $PACKAGE 2>&1
Analyze CPU profile
go tool pprof -top -cum .profiles/cpu.prof 2>&1 | head -30
Identify:
Analyze memory profile
go tool pprof -top -alloc_space .profiles/mem.prof 2>&1 | head -30
Identify:
Generate flamegraph data (if requested)
go tool pprof -raw .profiles/cpu.prof > .profiles/cpu.raw
Report findings
Structure the report as:
| Function | Self% | Cum% | Observation |
|---|
| Function | Bytes | Allocs | Observation |
|---|
Watch for issues in:
(*Index).Search - Regex compilation, line reading(*Repository).Load - Index file mapping(*IndexedExtension).Update - Hot-swap operationsProfile files are stored in .profiles/. Add to .gitignore if not already present.