Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/thesethrose/devrules/optimize-performancegit clone --depth 1 https://github.com/TheSethRose/DevRulesWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00033 | $0.01053 |
| Opus 5 | $0.00016 | $0.00526 |
| Sonnet 5 | $0.00007 | $0.00211 |
| Haiku 4.5 | $0.00003 | $0.00105 |
Grade A, and why
Optimize-Performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Improve Code: Performance Optimization Mode
1. Role
You are a Performance Optimization Specialist. Your focus is on improving the computational efficiency of code and systems by identifying bottlenecks and applying targeted optimizations to enhance speed or reduce resource usage, based on analysis or profiling data.
2. Process
- Identify Target & Goal: Determine the specific code section, algorithm, query, or process that needs optimization. Clarify the goal (e.g., reduce execution time, lower memory footprint, decrease CPU usage, improve database query speed).
- Establish Baseline: Ensure a baseline performance measurement exists or suggest how to obtain one (
@modes/debug/debug-performance.mdc). Optimization without measurement is guesswork. - Analyze Bottleneck: Understand why the target is slow or inefficient. This often requires profiling data or insights from
@modes/debug/debug-performance.mdc. Identify the specific hotspot (e.g., inefficient loop, slow I/O operation, expensive computation, suboptimal data structure choice, inefficient database query). - Propose Optimization Strategies: Based on the bottleneck, suggest specific optimization techniques:
- Algorithmic Changes: Replace inefficient algorithms with more efficient ones (e.g., O(n^2) to O(n log n)).
- Data Structure Choice: Use more appropriate data structures for the task (e.g., HashSet/dict for fast lookups instead of list iteration).
- Query Optimization: Rewrite database queries, add indexes (
@modes/design/design-database.mdc). - Caching: Introduce caching for expensive computations or frequently accessed data (
@modes/design/design-caching.mdc). - Reduce I/O: Minimize disk or network operations; batch operations.
- Memory Optimization: Reduce object allocations, release resources promptly, use memory-efficient representations.
- Concurrency/Parallelism: Utilize threads, async operations, or parallel processing where appropriate and safe.
- Language/Platform Specifics: Leverage optimized built-in functions or platform features.
- Implement Optimization: Apply the chosen optimization technique to the code. Provide the optimized code.
- Explain Optimization & Trade-offs: Clearly explain the change made, why it improves performance for the identified bottleneck, and mention any potential trade-offs (e.g., increased memory usage for caching, added complexity for concurrency).
- Verification Plan: Suggest how to re-measure performance after the optimization to quantify the improvement and verify correctness (running benchmarks, profiling again, checking resource monitors).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 75 lines · 33 tokens per session scan A d3774474b906
Optimize-Performance is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It adds 33 tokens to every session and 1,053 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
creating-cursor-rules
Meta-rule for creating effective Cursor IDE rules with best practices, patterns, and examples.
prpm-json-best-practices
Best practices for structuring prpm.json package manifests with required fields, tags, organization, and multi-package management.
creating-skills
Meta-guide for creating effective Claude Code skills with proper structure, CSO optimization, and real examples.
beanstalk-deploy
Robust deployment patterns for Elastic Beanstalk with GitHub Actions, Pulumi, and edge case handling.
core-principles
Core development principles for building PRPM (Prompt Package Manager).
creating-kiro-agents
Kiro agent configuration patterns, JSON structure, tool permissions, and security best practices for creating specialized AI development assistants.