Borrowing it
Nothing to install: this file belongs to cacr92/WeReply. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/cacr92/WeReply/main/.claude/commands/optimize.mdgit clone --depth 1 https://github.com/cacr92/WeReplyWrote 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.
[](https://agentmods.dev/commands/cacr92/wereply/optimize)<a href="https://agentmods.dev/commands/cacr92/wereply/optimize"><img src="https://agentmods.dev/badge/commands/cacr92/wereply/optimize/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.
<a href="https://agentmods.dev/commands/cacr92/wereply/optimize"><img src="https://agentmods.dev/badge/commands/cacr92/wereply/optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00861 |
| Opus 5.5 | $0.00000 | $0.00344 |
| Sonnet 5.5 | $0.00000 | $0.00172 |
| Haiku 4.5 | $0.00000 | $0.00086 |
Grade A, and why
optimize 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 1mo 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.
What it actually says
/optimize - 性能优化分析
用途
识别性能瓶颈并提供具体的优化建议。
分析步骤
1. Rust 后端性能分析
识别热点代码
# 使用 cargo-flamegraph 生成火焰图
cargo flamegraph --bin cacrfeedformula
# 使用 criterion 进行基准测试
cargo bench
检查点
- 是否有不必要的克隆?
- 是否可以使用并行计算(Rayon)?
- 是否可以添加缓存(Moka)?
- 数据库查询是否优化?
- 是否有 N+1 查询问题?
2. React 前端性能分析
使用 React DevTools Profiler
// 识别重渲染问题
// 检查是否需要:
// - React.memo
// - useCallback
// - useMemo
检查点
- 组件是否过度渲染?
- 是否需要虚拟滚动(大列表)?
- 是否需要代码分割(lazy loading)?
- 是否有内存泄漏?
3. 数据库性能分析
SQLite 优化
-- 检查查询计划
EXPLAIN QUERY PLAN SELECT ...;
-- 检查索引使用
PRAGMA index_list('table_name');
-- 检查表统计信息
ANALYZE;
检查点
- 是否有缺失的索引?
- 是否有未使用的索引?
- 查询是否可以优化?
- 是否需要批量操作?
优化建议模板
## 性能优化建议
### 高优先级(立即修复)
1. **配方优化计算耗时过长**
- 问题:单次优化耗时 15 秒
- 原因:未使用缓存,重复计算
- 建议:添加 Moka 缓存,缓存原料数据
- 预期改进:耗时减少到 3 秒
2. **原料列表渲染卡顿**
- 问题:1000+ 原料渲染缓慢
- 原因:��使用虚拟滚动
- 建议:使用 react-window
- 预期改进:渲染时间从 2 秒降到 200ms
### 中优先级(计划修复)
1. **数据库查询慢**
- 问题:配方列表查询耗时 500ms
- 原因:缺少索引
- 建议:添加 species_code 索引
- 预期改进:查询时间降到 50ms
### 低优先级(可选优化)
1. **启动时间优化**
- 问题:应用启动耗时 3 秒
- 原因:启动时加载所有数据
- 建议:延迟加载非关键数据
- 预期改进:启动时间降到 1.5 秒
性能基准
目标指标
- 应用启动时间: < 2 秒
- 配方优化计算: < 5 秒
- 数据库查询: < 100ms
- UI 响应时间: < 100ms
- 大列表渲染: < 500ms
测量工具
- Rust: cargo-flamegraph, criterion
- React: React DevTools Profiler
- 数据库: EXPLAIN QUERY PLAN
- 整体: Chrome DevTools Performance
何时使用
- 发现性能问题时
- 定期性能审查
- 重大功能上线前
- 用户反馈卡顿时
相关 Skills
- rust-optimization
- react-typescript-development
- sqlite-optimization
- performance-standards (规范文件)
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.
- 1mo ago First seen · 122 lines · 0 tokens per session scan A 2b4e3c484b54
optimize is a command published in the GitHub repository cacr92/WeReply (9 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 861 tokens. 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-31.
Other commands, from other repositories
qa-changes
This skill should be used when the user asks to "QA a pull request", "test PR changes", "verify a PR works", "functionally test changes", or when an automated workflow triggers QA validation of code changes. Provides a structured methodology for setting up the environment, exercising changed behavior, and reporting…
auditar-cascading
Invoca cascading-failures-auditor — audita serviço para 5 triggers de cascade (sem timeout, retry sem jitter, sem circuit breaker, sem deadline, queue unbounded) e gera CASCADING-AUDIT.md.
react-native
Command "react-native" from getsentry/toolkit, covering xcode build step (react-native xcode) and important notes.
http-service
Build, review or debug a Bun HTTP service. Loads the http-service skill, then works the task through its workflow.
doctor
Diagnosticar y reparar problemas del framework Don Cheli, git y entorno. Usa cuando el usuario dice "doctor", "problemas del framework", "don cheli no funciona", "repair Don Cheli", "debug setup", "setup broken", "framework broken", "reparar entorno". Detecta y repara issues de configuración, git y dependencias…
doctor
Badi configuration validation. Checks all Badi components and produces a diagnostic report.