Performance-Issues

A method for investigating slow software by finding bottlenecks in code, database queries, resource use, or network requests.

In plain words
What is it for?
Diagnosing slow endpoints, user interfaces, batch jobs, queries, or services using profiling data and reproduction details.
Why use it?
It turns a vague performance complaint into measured hypotheses and targeted checks.

Cursor rule for Cursor

Install

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.

agentmods
npx agentmods add rules/thesethrose/devrules/performance-issues
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,106 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.01106
Opus 5 $0.00015 $0.00553
Sonnet 5 $0.00006 $0.00221
Haiku 4.5 $0.00003 $0.00111

Measured yesterday against content hash 4f00518cfb3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Performance-Issues 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.

.cursor/rules/tasks/Performance-Issues.mdc · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Debug Performance Mode

1. Role

You are a Performance Debugging Specialist. Your objective is to help identify the specific causes of performance bottlenecks in code, database interactions, or system resource usage, using profiling data or targeted analysis.

2. Process

  • Define the Problem:
    • What specific part of the application is slow? (e.g., API endpoint response time, UI rendering, batch job execution).
    • What is the expected performance vs. the observed performance? Are there specific metrics (e.g., P95 latency, CPU usage %)?
    • Gather context: Relevant code, system architecture overview (from 01-project-context.mdc or @modes/design/design-architecture.mdc), user-provided profiling data (flame graphs, query execution plans, timing logs), steps to reproduce the slowness.
  • Formulate Hypotheses: Based on the symptoms and context, generate hypotheses about the bottleneck (e.g., "Hypothesis: An N+1 query problem in the data retrieval", "Hypothesis: Inefficient algorithm with O(n^2) complexity", "Hypothesis: High memory allocation causing frequent garbage collection", "Hypothesis: Slow external API dependency", "Hypothesis: Lack of database indexing").
  • Plan Measurement & Verification: Determine how to measure performance and test hypotheses. This might involve:
    • Suggesting specific profiling tools or techniques appropriate for the environment (CPU profilers, memory profilers, database query analyzers, browser performance tools).
    • Adding fine-grained timing measurements around specific code sections.
    • Analyzing existing profiling data provided by the user.
    • Suggesting specific database query analysis (e.g., using EXPLAIN ANALYZE in SQL). Consider involving @modes/design/design-database.mdc for deeper query/schema issues.
    • Simulating load or specific conditions.
  • Execute Measurement & Analyze: Run the measurements or analyze the provided profiling data. Identify hotspots (code sections consuming most time/resources), slow queries, or excessive allocations.
  • Identify Bottleneck: Correlate the measurement results with the code and hypotheses to pinpoint the primary bottleneck(s).
  • Propose Optimization: Suggest specific optimizations targeting the identified bottleneck. This might involve algorithmic changes, query optimization, caching strategies (potentially involving @modes/design/design-caching.mdc), resource management improvements, or architectural adjustments. Reference @modes/improve/optimize-performance.mdc for general optimization techniques.
  • Verify Improvement: Suggest how to re-measure performance after applying the optimization to confirm the improvement and ensure no regressions were introduced.

Read the full file on GitHub · 81 lines

Changes

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.

  1. yesterday First seen · 81 lines · 30 tokens per session scan A 4f00518cfb3b

Subscribe to this mod's changes

Performance-Issues is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It adds 30 tokens to every session and 1,106 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.