mini-taiwan-pulse: Skill for Claude Code

.agents/skills/supabase-optimize/SKILL.md

supabase-optimize is a skill for Claude Code, Codex from ianlkl11234s/mini-taiwan-pulse. It costs 91 tokens per session (1,294 once invoked), scanned A, original, MIT.

A SQL template generator for Supabase RPCs that prepares grouped results in ordinary database tables before an API query reads them. Supabase is a hosted PostgreSQL service, and RPCs are database functions called through an API.

In plain words
What is it for?
Use it to generate SQL for the table, refresh and cleanup functions, scheduled jobs, rewritten RPC, backfill, schema reload, and verification steps.
Why use it?
It reduces slow queries caused by large result sets, complex joins, or aggregations such as combining text or geographic shapes. It provides a repeatable setup for refreshing prepared data and removing old records.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is ianlkl11234s/mini-taiwan-pulse's own configuration. It tells Claude Code and Codex how to work on mini-taiwan-pulse 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 mini-taiwan-pulse configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/ianlkl11234s/mini-taiwan-pulse/master/.agents/skills/supabase-optimize/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ianlkl11234s/mini-taiwan-pulse

Made for: Claude Code, Codex.

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 supabase-optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/ianlkl11234s/mini-taiwan-pulse/supabase-optimize/github.svg)](https://agentmods.dev/skills/ianlkl11234s/mini-taiwan-pulse/supabase-optimize)
Your own site
<a href="https://agentmods.dev/skills/ianlkl11234s/mini-taiwan-pulse/supabase-optimize"><img src="https://agentmods.dev/badge/skills/ianlkl11234s/mini-taiwan-pulse/supabase-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.

agentmods 80×15 button for supabase-optimize

Your own site · 80×15
<a href="https://agentmods.dev/skills/ianlkl11234s/mini-taiwan-pulse/supabase-optimize"><img src="https://agentmods.dev/badge/skills/ianlkl11234s/mini-taiwan-pulse/supabase-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,294 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 89
    Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.
    Fix: Set explicit rate limits, timeouts, and resource quotas for API calls, file operations, and compute. Implement circuit breakers for runaway loops.
How audits are shown
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.1 $0.00091 $0.01294
Opus 5 $0.00046 $0.00647
Sonnet 5 $0.00018 $0.00259
Haiku 4.5 $0.00009 $0.00129

Measured 11d ago against content hash adecde700e1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

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

.agents/skills/supabase-optimize/SKILL.md · 90 lines

How it starts

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

Supabase Pre-aggregate Pattern Generator

依照 Mini Taiwan Pulse 專案規則產生 pre-aggregate SQL。完整 pattern 說明見 docs/supabase-optimization.md

何時使用

符合 任一 條件:

  • 響應時間 > 1 秒
  • 回傳 > 10,000 rows
  • string_agg / ST_Union / 複雜 JOIN
  • 看到 pooler 2min timeout(Supabase Supavisor 強制)

輸入

使用前請確認收集:

  1. RPC 名稱 (例:get_ship_trails)
  2. 原始大表 (例:realtime.ship_positions)
  3. 分組維度 (例:(day, mmsi))
  4. 聚合欄位 (例:string_agg(...))
  5. 時間欄位 (例:collected_at)
  6. 是否需要 ±1h overlap(跨日 timeline 銜接)
  7. Cron 頻率 (通常 */10 * * * *,溫度資料 */30)
  8. Cleanup 保留天數 (通常 7)

產生的 SQL 區塊

  1. Table 定義(普通 table,不是 MV)
  2. Refresh function(含 pg_advisory_xact_lock + SET statement_timeout TO '0'
  3. Cleanup function
  4. RPC rewrite(薄 SELECT,SET statement_timeout TO '60s'GRANT EXECUTE TO anon)
  5. pg_cron 排程(refresh today + yesterday;cleanup 每日 18:00 UTC)
  6. Backfill 指令
  7. PostgREST schema reload (NOTIFY pgrst, 'reload schema')
  8. 驗證指令

範本結構

詳見 data-collectors/docs/sql/matview_*.sql,有 10 個現成範本可參考:

  • matview_ship_trails.sql — per-day trail aggregation with ±1h overlap
  • matview_flight_trails.sql — 同上,含 altitude filter
  • matview_freeway_congestion.sql — 含 JOIN 靜態 sections
  • matview_youbike_h3.sql — 含 resolution 維度
  • matview_temperature_frames.sql — per-observed_at aggregation
  • matview_temperature_dates.sql — 全量 cache(非 per-day)
  • matview_disaster_alerts.sql — 預存 ST_Union 幾何
  • reference_temperature_grid.sql — 靜態 reference 表
  • cwa_imagery_rpcs.sql — 批次 RPC pattern

執行流程

  1. 讀取最接近的範本檔案
  2. 依用戶需求改 table schema、GROUP BY、聚合函式
  3. 產出到 data-collectors/docs/sql/matview_<new>.sql
  4. 告知用戶執行指令:
    psql "$SUPABASE_DB_URL" -f data-collectors/docs/sql/matview_<new>.sql
    psql "$SUPABASE_DB_URL" -c "SELECT public.refresh_<new>_daily(d::date) FROM generate_series(current_date - 6, current_date, '1 day') d;"
    psql "$SUPABASE_DB_URL" -c "NOTIFY pgrst, 'reload schema';"
    
  5. 驗證:
    time psql "$SUPABASE_DB_URL" -c "SELECT count(*) FROM public.get_<new>_day(current_date);"
    psql "$SUPABASE_DB_URL" -c "SELECT * FROM cron.job_run_details WHERE jobid = (SELECT jobid FROM cron.job WHERE jobname = 'refresh-<new>') ORDER BY start_time DESC LIMIT 3;"
    
  6. 更新 docs/supabase_rpc_audit.md

Read the full file on GitHub · 90 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. 11d ago First seen · 90 lines · 91 tokens per session scan A adecde700e1f

Subscribe to this mod's changes

supabase-optimize is a skill published in the GitHub repository ianlkl11234s/mini-taiwan-pulse (504 stars, last pushed today), licensed MIT. It adds 91 tokens to every session and 1,294 once invoked, about $0.0005 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.

Related

Other skills, from other repositories

azure-postgres-ts

Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…

microsoft/skills · 94 tokens

butterbase

AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.

butterbase-ai/butterbase · 34 tokens

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

supabase-cli

This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.

fcakyon/claude-codex-settings · 60 tokens

supabase-js

This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

fcakyon/claude-codex-settings · 64 tokens

supabase-node

Express/Hono with Supabase and Drizzle ORM.

alinaqi/maggy · 14 tokens