Performance deity
A ruthlessly strict algorithmic optimization methodology for AI coding agents. Forces your agent to profile, benchmark, and mathematically prove performance gains before writing code.From the repository description
npx -y skills add v0idOS/performance-deity --skill performance-deityAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 4 commands, including `tools/benchmark.py "<code snippet>"` and 3 more.
SKILL.md
2.8 KB, 652 tokens by cl100k_base, as published. Nobody here has run it
Performance Deity: Hot-Path Optimization
Description
This skill enforces a rigorous, math-driven approach to code optimization. The agent is forbidden from guessing what makes code faster. It must prove it through benchmarking.
Triggers
Activate this skill whenever the user asks to:
- "optimize" a function, file, or script.
- "speed up" or "refactor for speed".
- "benchmark" or "profile" a specific workflow.
- Or explicitly runs the command
/plugin performance-deity:optimize
Core Directives
When activated, you (the agent) MUST follow these exact steps sequentially. Do not skip any steps.
Phase 1: Establish Baseline
- Identify the target code the user wants to optimize.
- Use the included tools to run a micro-benchmark for the target language:
- Python: Use
tools/benchmark.py "<code snippet>" - Node/JS: Use
node tools/benchmark.js "<code snippet>" - PowerShell: Use
tools/Measure-Performance.ps1 -Command "<cmd>" - Bash/Shell: Use
bash tools/benchmark.sh "<cmd>" - If the language isn't supported by these tools, write a custom micro-benchmark script that calculates Average and P95.
- Python: Use
- Execute the benchmark. Ensure there is a "warm up" phase. Record the
P95andAverageexecution time over at least 100 iterations. - Report the baseline to the user. Do not proceed to Phase 2 until you have verified the benchmark runs successfully.
Phase 2: Algorithmic Analysis
- Analyze the Time Complexity (Big-O) of the current implementation.
- Analyze the Space Complexity (Memory allocations).
- Explicitly identify the bottleneck. State it clearly (e.g., "Nested loops causing O(n^2) scaling", "Unnecessary object creation causing GC pauses", "String concatenation in a tight loop").
Phase 3: Recursive Refactoring
- Rewrite the code using a more efficient algorithm or data structure.
- High-Priority Techniques:
- Replace Arrays/Lists with Hash Sets/Dictionaries for lookups (O(N) -> O(1)).
- Vectorization or batching instead of individual processing.
- Caching/Memoization of expensive calculations.
- Reducing garbage collection overhead (zero-allocation patterns, reusing buffers).
- Bitwise operations where mathematically applicable.
- Run the micro-benchmark on your new code.
- CRITICAL DIRECTIVE: If the new code is NOT significantly faster than the baseline, you must discard your changes, apologize internally, and try a different approach. Do not present failed optimizations to the user.
Phase 4: Final Proof
- Present the final, optimized code to the user.
- Output a Performance Report table comparing the:
- Baseline Execution Time
- New Execution Time
- Percentage Improvement (%)
- Briefly explain why the new code is faster based on CPU architecture or memory layout.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.