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/YuDefine/nuxt-supabase-starterWrote 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/yudefine/nuxt-supabase-starter/trigger)<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/trigger"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/trigger.svg" alt="Measured on agentmods" 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.00887 |
| Opus 5 | $0.00000 | $0.00443 |
| Sonnet 5 | $0.00000 | $0.00177 |
| Haiku 4.5 | $0.00000 | $0.00089 |
Grade A, and why
trigger 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 3d 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.
How it starts
The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Trigger
本檔是 clade 投影,NEVER 就地編輯。專案特化寫進自家
.cursor/rules/local/;要改本檔請回 clade 源檔並 propagate。
新增 trigger 前先問:真的需要 trigger 嗎?
- MUST 優先考慮在 server API handler 處理業務邏輯
- MUST 只在以下情境用 trigger:
- 跨 table 資料同步(denormalization、cache)
updated_at自動更新(標準模式)- 必須在 DB 層保證的 invariant
- NEVER 在 trigger 裡寫複雜業務邏輯(多表查詢、對外通知、複雜驗證)— 放 API handler
命名規約
- Prefix 按用途:
trg_<table>_<event>_<purpose>(如trg_posts_before_insert_set_slug) updated_at統一命名:set_<table>_updated_at+ 對應 functionpublic.set_updated_at()- 有順序依賴時:用
a_/b_/c_前綴明確表達執行順序(a_set_context在b_audit_log之前,字母序)
核心陷阱
- 同一事件多個 trigger 按名稱字母序執行 — 命名時注意順序依賴
FOR EACH ROW在大量操作時效能差 — 批量操作考慮FOR EACH STATEMENT+transition tables- Trigger function 中的
RAISE EXCEPTION會 rollback 整個呼叫端 transaction — 謹慎使用,寫清楚 error message - 受限 schema 中的 trigger 無法直接 DROP — 要 drop 其依賴的 function 並加
CASCADE - Trigger function MUST
SET search_path = ''— 防止 search_path injection SECURITY DEFINERtrigger function 需特別小心 — function 內做的操作會以 owner 權限執行,bypass RLS
檢查多 trigger 執行順序
select tgname, tgrelid::regclass, tgtype
from pg_trigger
where tgrelid = 'public.<table>'::regclass
and not tgisinternal
order by tgname; -- 實際執行順序
標準 Template:updated_at
create or replace function public.set_updated_at()
returns trigger
language plpgsql
as $$
begin
new.updated_at = now();
return new;
end;
$$;
create trigger set_<table>_updated_at
before update on public.<table>
for each row
execute function public.set_updated_at();
通用 Template:業務 trigger
create or replace function public.<function_name>()
returns trigger
language plpgsql
security definer
set search_path = ''
as $$
begin
-- 業務邏輯
return new; -- BEFORE / INSTEAD OF
-- or: return null; -- AFTER(回傳值會被忽略)
end;
$$;
comment on function public.<function_name>() is '<中文描述>';
create trigger trg_<table>_<event>_<purpose>
after insert or update on public.<table>
for each row
execute function public.<function_name>();
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.
- 3d ago First seen · 94 lines · 0 tokens per session scan A b5deeb74f718
trigger is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 887 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-09-03.
Other cursor rules, from other repositories
rulesforconvex
description: Convex guidelines globs: alwaysApply: true.
redis_rate_limiting
Complete guide for implementing Redis-based rate limiting with authentication troubleshooting and FastAPI integration.
nestjs-6-database-performance
USE WHEN working with databases, implementing repositories, optimizing queries, caching, or performance tuning.
api-supabase-astro-init
This document provides a reproducible guide to create the necessary file structure for integrating Supabase with your Astro project.
django-orm-for-database-operations
Specifies that Django's ORM should be used for interacting with the database when defining models. This encourages a consistent approach to database operations across the project.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.