cursor-agentic-coding-template: Command for Claude Code

.cursor/commands/optimize-performance.md

optimize-performance is a command for Claude Code, Cursor from Zenobia0000/cursor-agentic-coding-template. It costs 17 tokens per session (1,239 once invoked), scanned A, a copy of optimize-performance, MIT.

A performance-optimization command that measures a system, identifies a bottleneck, applies a change, and compares the result with a baseline.

In plain words
What is it for?
Use it to investigate measurable performance goals, inspect the related code, apply optimizations, and write a report with before-and-after results.
Why use it?
It avoids making performance changes without evidence of the original problem or proof that the change helped. It also considers trade-offs such as cost and data consistency.

Command for Claude CodeCursor

Written for Cursor and Claude Code: installed under .cursor/, but also a Claude Code command (commands/*.md).

This is Zenobia0000/cursor-agentic-coding-template's own configuration. It tells Claude Code and Cursor how to work on cursor-agentic-coding-template itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cursor-agentic-coding-template configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Zenobia0000/cursor-agentic-coding-template. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Zenobia0000/cursor-agentic-coding-template/main/.cursor/commands/optimize-performance.md
Clone the repo
git clone --depth 1 https://github.com/Zenobia0000/cursor-agentic-coding-template

Made for: Claude Code, Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for optimize-performance

README.md
[![agentmods](https://agentmods.dev/badge/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance/github.svg)](https://agentmods.dev/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance)
Your own site
<a href="https://agentmods.dev/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance"><img src="https://agentmods.dev/badge/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimize-performance

Your own site · 80×15
<a href="https://agentmods.dev/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance"><img src="https://agentmods.dev/badge/commands/zenobia0000/cursor-agentic-coding-template/optimize-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 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,239 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod 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.1 $0.00017 $0.01239
Opus 5.5 $0.00007 $0.00496
Sonnet 5.5 $0.00003 $0.00248
Haiku 4.5 $0.00002 $0.00124

Measured 2mo ago against content hash 127657656c83, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo ago.

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.

Origin

This is a copy

100% identical to optimize-performance — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/commands/optimize-performance.md · 72 lines

How it starts

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

⚡ OPTIMIZE MODE (v3)

像索隆的三刀流一樣,基於數據,精準、快速地斬斷效能瓶頸。

1. PLAN 🎯 (規劃)

Objective

遵循「測量-識別-優化-驗證」的循環,系統性地解決效能問題,並寫入一份包含前後對比數據的效能報告,以證明優化的有效性。

Guiding Rules

在執行此指令時,AI Agent 必須遵循以下規則:

  • 主要規則: .cursor/rules/principles/global.mdc
  • 架構原則: .cursor/rules/backend/overview.mdc 或 .cursor/rules/frontend/overview.mdc
  • 測試要求: .cursor/rules/testing/overview.mdc (確保優化不破壞功能)
  • 核心隔離: .cursor/rules/isolation_rules/main.mdc

Prerequisites Check

在開始優化之前,請確保:

  • ✅ 目標已量化: 有一個清晰、可量化的效能目標 (e.g., "將 P95 延遲從 800ms 降至 300ms 以下")。
  • ✅ 基準已存在: 已有一份可靠的效能基準測試報告,可能儲存在 memory-bank/current/ 中。
  • ❌ Failure Action: 如果目標模糊或沒有基準數據,AI 必須拒絕優化,並建議:「我們需要先建立效能基準。我應該先編寫一個負載測試腳本來測量當前的 API 延遲嗎?」

2. DO 実行 (執行)

Core Process

遵循一個嚴格的、數據驅動的優化循環:

Step 0: 健康檢查 (Health Check)

  • 檢查目標和基準: 驗證效能目標是否具體、可衡量,且基準報告是否可信。
  • 批判性思考: 優化是權衡的藝術。AI 應思考目標是否現實,並思考潛在的副作用,例如:「追求極致的低延遲可能會增加伺服器成本或降低數據一致性。我們應該在哪個指標上做權衡?」

Step 1: 記憶體互動 - 讀取 (Memory Interaction - Read)

  • 讀取目標: 從 memory-bank/current/tasks.md 讀取效能優化目標。
  • 讀取基準報告: 從 memory-bank/current/perf-report-[baseline-date].md 讀取詳細的基準數據。
  • 讀取相關程式碼: 根據基準報告中指出的瓶頸,讀取相關的產品程式碼。

Step 2: 假設與實施 (Hypothesize & Implement)

  • 提出假設: 針對瓶頸,提出一個具體的優化假設。
  • 實施優化: 修改產品程式碼以實現該優化。

Step 3: 驗證與測量 (Verify & Measure)

  • 功能驗證: 運行所有單元測試和整合測試,確保優化沒有破壞任何現有功能。
  • 效能驗證: 在與基準測試完全相同的環境下,重新運行效能測試。

Step 4: 記憶體互動 - 寫入 (Memory Interaction - Write)

  • 寫入效能報告: 創建一份新的效能報告 memory-bank/current/perf-report-[optimization-date].md。此報告必須包含優化目標、措施、以及優化前後的數據對比表。

3. CHECK ✓ (檢查)

Verification Checklist

  • 目標是否達成: 優化後的指標是否達到了預設的目標?
  • 功能無迴歸: 所有測試是否都已通過?
  • 報告已生成: 是否已在 memory-bank/current 中創建了包含前後對比數據的效能報告?

4. ACT 改善 (行動)

Finalization

  • 向用戶確認權衡: 在提交一個涉及重要權衡的優化之前,AI 必須向用戶確認。
  • 提交程式碼: 在用戶確認後,將優化程式碼和新的效能報告提交到版本控制系統。

Next Steps

效能優化是一個持續的過程。

  • 👉 Primary Next Step: 如果仍有未達標的效能指標,可以執行 /task-next 來建議下一個要優化的點。
  • 💡 Alternative: 將新的效能測試腳本整合到 CI/CD 流程中,建立效能迴歸監控。

Read the full file on GitHub · 72 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. 2mo ago First seen · 72 lines · 17 tokens per session scan A 127657656c83

Subscribe to this mod's changes

optimize-performance is a command published in the GitHub repository Zenobia0000/cursor-agentic-coding-template (5 stars, last pushed 6mo ago), licensed MIT. It adds 17 tokens to every session and 1,239 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to optimize-performance, differing in 0 lines, and is treated as a copy.