Borrowing it
Nothing to install: this file belongs to ianlkl11234s/mini-taiwan-pulse. 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/ianlkl11234s/mini-taiwan-pulse/master/.claude/commands/check-rpc.mdgit clone --depth 1 https://github.com/ianlkl11234s/mini-taiwan-pulseWrote 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/ianlkl11234s/mini-taiwan-pulse/check-rpc)<a href="https://agentmods.dev/commands/ianlkl11234s/mini-taiwan-pulse/check-rpc"><img src="https://agentmods.dev/badge/commands/ianlkl11234s/mini-taiwan-pulse/check-rpc/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/ianlkl11234s/mini-taiwan-pulse/check-rpc"><img src="https://agentmods.dev/badge/commands/ianlkl11234s/mini-taiwan-pulse/check-rpc.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.00022 | $0.00706 |
| Opus 5 | $0.00011 | $0.00353 |
| Sonnet 5 | $0.00004 | $0.00141 |
| Haiku 4.5 | $0.00002 | $0.00071 |
Grade A, and why
check-rpc 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 11d 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
/check-rpc
檢查某個 Supabase RPC 的執行計畫與實際耗時,判斷是否需要套用 pre-aggregate pattern(詳見 docs/supabase-optimization.md)。
參數
$1(必填): RPC 名稱,例如get_ship_trails$2(選填): 測試參數(通常是日期),預設CURRENT_DATE
執行步驟
- 讀取
SUPABASE_DB_URL(從.env) - 找到 RPC 定義:
psql "$SUPABASE_DB_URL" -c "\sf public.$1" - EXPLAIN ANALYZE(重點看 plan 結構):
psql "$SUPABASE_DB_URL" -c "EXPLAIN (ANALYZE, BUFFERS, COSTS OFF) SELECT * FROM public.$1('${2:-CURRENT_DATE}');" - 測實際 RPC 響應:
time psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.$1('${2:-CURRENT_DATE}');"
判斷準則
| 現況 | 建議 |
|---|---|
| 響應 < 500ms、rows < 5k | ✅ 不需優化 |
| 響應 500ms ~ 1s、plan 穩定 | 🟡 監控即可,加進 audit 報告 |
| 響應 > 1s 或 rows > 10k | 🔴 必須 套 pre-aggregate pattern |
看到 Sort + 大量 rows |
🔴 可能是 plan 問題,先跑 ANALYZE <source_table> |
看到 Parallel Append + Sort global |
🔴 planner 選錯 plan,試圖 force Merge Append + index |
含 string_agg / ST_Union / 複雜 JOIN |
🔴 一律套 pre-aggregate |
套 pre-aggregate 的下一步
使用 skill supabase-optimize 產生 SQL 範本:
使用 supabase-optimize skill 為 $1 產生 pre-aggregate SQL
或手動參考 docs/supabase-optimization.md 與 ../data-collectors/docs/sql/matview_*.sql 範本。
注意事項
- Supabase pooler 強制 2min statement_timeout,若 EXPLAIN ANALYZE 超時,代表現況已不可用,必須優化
- anon role default timeout 3s,前端實際可用時間更短
- 若 plan 有 stale stats 嫌疑,先
ANALYZE realtime.xxx_source_YYYYMMDD;看是否改善 - 大 payload RPC 記得加
SET statement_timeout TO '60s'function 屬性
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.
- 11d ago First seen · 57 lines · 22 tokens per session scan A daea81368cc4
check-rpc is a command published in the GitHub repository ianlkl11234s/mini-taiwan-pulse (504 stars, last pushed today), licensed MIT. It adds 22 tokens to every session and 706 once invoked, about $0.0001 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 commands, from other repositories
psql-query
Run ad-hoc PostgreSQL analytics queries against dev/test database.
cms
Set up Payload CMS in this app, backed by Supabase.
db
Set up or operate Supabase Postgres for this project.
splunk-observability-database-monitoring-setup
Render and validate Splunk Observability Cloud Database Monitoring collector configuration for PostgreSQL, Microsoft SQL Server, and Oracle Database through the Splunk OTel Collector. Keeps secrets out of chat, argv, and rendered files; DB credentials are referenced through Kubernetes Secrets or local env vars.
pg-indexes
Review unused indexes that are safe to drop (pgbot).
rls-plan
Supabase RLS + access-control audit + remediation plan — no SQL until approved.