一键导入
perf
Performance optimization with benchmarking first. Use when asked to optimize, improve speed, reduce allocations, or profile code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Performance optimization with benchmarking first. Use when asked to optimize, improve speed, reduce allocations, or profile code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add or modify tests following project conventions. Use when asked to write tests, add test coverage, or fix failing tests.
Add or modify tests for PhotoManager following project conventions. Use this skill when asked to write tests, add test coverage, or fix failing tests.
Avalonia UI reference guide for PhotoManager: UI conventions, MVVM patterns, and cross-platform UI patterns. Use this skill when working on UI code, adding image-processing methods, or needing to understand the Avalonia UI layer of the application.
Refactor code following Clean Architecture patterns. Use when asked to restructure, extract, move, or reorganize code while preserving behavior.
Avalonia UI reference guide for PhotoManager: UI conventions, MVVM patterns, and cross-platform UI patterns. Use this skill when working on UI code, adding image-processing methods, or needing to understand the Avalonia UI layer of the application.
Refactor PhotoManager code following Clean Architecture patterns. Use this skill when asked to restructure, extract, move, or reorganize code while preserving behavior.
| name | perf |
| description | Performance optimization with benchmarking first. Use when asked to optimize, improve speed, reduce allocations, or profile code. |
| disable-model-invocation | true |
| argument-hint | <class.method to optimize> |
You are tasked with optimizing the performance of: $ARGUMENTS
Follow this workflow in order:
Create a BenchmarkDotNet benchmark file:
PhotoManager/Benchmarks/PhotoManager.Benchmarks/{Category}/{ClassName}{MethodName}Benchmarks.csPhotoManager/Benchmarks/PhotoManager.Benchmarks/Common/HashingHelperCalculateHashBenchmarks.cs[MemoryDiagnoser], [Orderer(SummaryOrderPolicy.FastestToSlowest)],
[RankColumn][Benchmark(Baseline = true)]Keep the original method unchanged in its source file — do NOT modify it yet.
Add optimized implementations IN THE BENCHMARK FILE ONLY:
[Benchmark] methodOptimized_ApproachName, Optimized_Stackalloc, etc.Run the benchmark:
dotnet run --project PhotoManager/Benchmarks/PhotoManager.Benchmarks/PhotoManager.Benchmarks.csproj -c Release -- --filter "*BenchmarkClassName"
Evaluate results (speed is priority, but allocation shouldn't increase significantly):
Implement the winner in the original source file:
// ClassName.MethodName: X% fasterGlobalUsings.cs before adding any using directivesVerify: Run dotnet test --filter "FullyQualifiedName~ClassName" PhotoManager/PhotoManager.slnx
to ensure no regressions. Build must produce zero warnings.
Keep all variants in the benchmark file (original + all optimizations) for future reference.
Return benchmark results summary with percentage improvement.