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.
git clone --depth 1 https://github.com/holtwood/awesome-cursorrules-zhWrote 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/rules/holtwood/awesome-cursorrules-zh/fastapi-performance-metrics)<a href="https://agentmods.dev/rules/holtwood/awesome-cursorrules-zh/fastapi-performance-metrics"><img src="https://agentmods.dev/badge/rules/holtwood/awesome-cursorrules-zh/fastapi-performance-metrics/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/rules/holtwood/awesome-cursorrules-zh/fastapi-performance-metrics"><img src="https://agentmods.dev/badge/rules/holtwood/awesome-cursorrules-zh/fastapi-performance-metrics.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.00005 | $0.00773 |
| Opus 5 | $0.00003 | $0.00387 |
| Sonnet 5 | $0.00001 | $0.00155 |
| Haiku 4.5 | $0.00001 | $0.00077 |
Grade A, and why
fastapi-performance-metrics 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 6d 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
FastAPI 性能指标
本规则集定义了在 FastAPI 应用程序中监控和优化性能的关键指标和方法,旨在确保应用程序的高效运行和良好的用户体验。
1. 关键性能指标 (KPIs)
- 响应时间 (Latency): API 端点处理请求并返回响应所需的时间。通常关注平均响应时间、P95 和 P99 响应时间。
- 吞吐量 (Throughput): 单位时间内 API 端点能够处理的请求数量(例如,每秒请求数 RPS)。
- 错误率 (Error Rate): 返回错误响应(例如,HTTP 5xx 状态码)的请求所占的百分比。
- 资源利用率: CPU 使用率、内存使用率、磁盘 I/O 和网络 I/O。
- 并发连接数: 同时连接到服务器的客户端数量。
2. 监控工具与实践
- 日志: 使用结构化日志记录请求和响应信息,包括响应时间、状态码等。
- Prometheus/Grafana: 集成 Prometheus 用于收集指标,Grafana 用于可视化和构建仪表盘。
- FastAPI 性能中间件: 可以使用
starlette-exporter或自定义中间件来暴露 Prometheus 指标。
- FastAPI 性能中间件: 可以使用
- APM (Application Performance Monitoring): 使用 Sentry、New Relic、Datadog 等 APM 工具进行更全面的应用性能监控和追踪。
- 压力测试: 使用 Locust、JMeter、k6 等工具进行压力测试,模拟高并发场景,发现性能瓶颈。
3. 性能优化策略
- 异步操作: 充分利用 FastAPI 的异步特性(
async/await),尤其是在进行 I/O 密集型操作(如数据库查询、外部 API 调用)时。 - 数据库优化:
- 索引: 确保数据库表有适当的索引。
- 查询优化: 避免 N+1 查询问题,使用连接查询或批量查询。
- 连接池: 使用数据库连接池来管理数据库连接。
- 缓存:
- 内存缓存: 使用 Redis 或 Memcached 缓存频繁访问的数据。
- HTTP 缓存: 利用 HTTP 缓存头(
Cache-Control,ETag,Last-Modified)减少重复请求。
- 数据序列化优化: 优化 Pydantic 模型的序列化和反序列化性能。
- Gunicorn/Uvicorn 配置:
- 工作进程数: 根据 CPU 核心数配置 Gunicorn 的工作进程数(通常为
2 * CPU_CORES + 1)。 - Worker 类型: 对于 I/O 密集型应用,可以考虑使用
uvloop和httptools优化 Uvicorn。
- 工作进程数: 根据 CPU 核心数配置 Gunicorn 的工作进程数(通常为
- 代码优化:
- 避免不必要的计算: 减少每个请求中的计算量。
- 延迟加载: 延迟加载不立即需要的数据或资源。
- 限流: 实施速率限制以保护 API 免受滥用和过载。
- CDN: 对于静态文件,使用 CDN 加速内容分发。
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.
- 6d ago First seen · 46 lines · 5 tokens per session scan A 1de19d3ba2aa
fastapi-performance-metrics is a cursor rule published in the GitHub repository holtwood/awesome-cursorrules-zh (233 stars, last pushed 1mo ago), licensed MIT. It adds 5 tokens to every session and 773 once invoked, about $0.0000 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-09-03.
Other cursor rules, from other repositories
cursorrules
You are an expert backend API developer. Follow these rules strictly for REST APIs, GraphQL servers, and microservices.
app-router-patterns
Next.js 14+ App Router patterns — Server Components, Client Components, Route Handlers, Server Actions, and metadata API.
skill-rails-api
Padrões DARE para APIs em Ruby on Rails 8 — API mode, ActiveRecord, Solid Queue, Solid Cable, Action Cable, strong parameters, services, serializers (Blueprinter/Alba), Devise/JWT, rack-attack, rswag/grape-swagger.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.