Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

adding-a-trigger

БесплатноБез исполняемых скриптовНе проверен

Checklist for adding a new TriggerCrud-based trigger type to Windmill (Azure, GCP, Kafka, etc.). Use when wiring a new trigger kind across backend, frontend…

windmill-labsот windmill-labs★ 18 798 звёзд на GitHub

Об этом скилле

Skill: Adding a New Trigger Type

Use this skill when adding a trigger kind that implements TriggerCrud (Kafka, GCP, Azure, MQTT, SQS, NATS, Postgres, Email…). For native triggers (Nextcloud, Google Drive — things wired through windmill-native-triggers), use the native-trigger skill instead.

The goal of this doc is to enumerate every file that needs to change. Missing any one of them leads to silent regressions: sync drops the trigger, capture button does nothing, workspace forks lose it, sidebar counters undercount. Follow the checklist top-to-bottom — each section is independent enough to be validated on its own.

Throughout this doc, substitute {kind} for the new trigger kind (azure, kafka, …), {Kind} for PascalCase (Azure, Kafka), {KIND} for SCREAMING (AZURE, KAFKA).

Reference implementations

  • GCP — closest analogue to Azure. Has push + pull, OIDC auth, ARM-like resource paths, capture handler. Grep for gcp_trigger / GcpTrigger.
  • Kafka — simpler (pull-only, streaming). Good for trivial integrations.
  • Azure — most recently added (2026). Shared-secret push auth, Event Grid namespaces + basic topics, ARM resource discovery, Namespace-pull data-plane. Grep for azure_trigger / AzureTrigger.

1. Database migration

Create a migration: cargo sqlx migrate add -r add_{kind}_trigger from backend/. Never write timestamps manually.

The up.sql usually defines:

  • An optional enum type (e.g. AZURE_MODE) if the trigger has sub-kinds
  • The {kind}_trigger table with at minimum these columns (mirrored from kafka/gcp):
    • primary: (workspace_id, path)
    • script_path, is_flow, enabled, mode, permissioned_as, edited_by, email
    • edited_at, error, server_id, last_server_ping
    • error_handler_path, error_handler_args jsonb, retry jsonb
    • trigger-specific fields
  • Indexes on foreign keys + any frequently-filtered columns
  • Foreign key to workspace
  • The RLS policies (see_own, see_member, see_folder_extra_perms_user_*, see_extra_perms_user_*, see_extra_perms_groups_*), copied from an existing trigger table

RLS: wrap every session GUC read in a scalar sub-select. Write the session reads as (select current_setting('session.user')), = any((select regexp_split_to_array(current_setting('session.groups'), ','))::text[]), ?| (select regexp_split_to_array(current_setting('session.pgroups'), ','))::text[], ? (select concat('u/', current_setting('session.user'))), etc. — not the bare current_setting(...). The GUCs are set with SET LOCAL, so the sub-select hoists them to a one-time InitPlan instead of re-evaluating per scanned row. Put the ::text[] cast outside the sub-select for the array cases: in an = any (...) context, casting inside — = any((select ...::text[])) — makes Postgres parse the operand as a row-returning subquery and fails at CREATE with operator does not exist: text = text[]. The outside cast keeps it in array-operand form. See migration 20260714230440_wrap_session_gucs_in_rls_policies for the canonical wrapped forms.

Down migration drops the table and any enum types.

2. Backend crate (windmill-trigger-{kind})

Create a new crate under backend/windmill-trigger-{kind}/ with:

  • Cargo.toml: features enterprise, private if EE, standard deps
  • src/lib.rs: pub use mod_ee::*; behind #[cfg(all(feature = "enterprise", feature = "private"))]
  • src/mod_ee.rs: core types + helpers
  • src/handler_ee.rs: TriggerCrud impl + route handlers
  • src/listener_ee.rs: (only if streaming/pull-based) Listener trait impl. Retrying is the framework's job (listening in windmill-trigger/src/listener.rs): open the connection in get_consumer and return its error, which disables the trigger only when is_transient_error says no retry can fix it (map a retryable failure with no natural kind to transient_error); have consume write the reason to its status lock and return when the connection drops, and call disable_with_error only for a permanent failure. No retry loop or alerting of its own.

Required in mod_ee.rs:

  • {Kind}Config struct (persisted shape, FromRow)
  • {Kind}ConfigRequest struct (what API receives — usually similar to Config but with validation fields)
  • {Kind}Trigger unit struct (implements the traits)
  • impl TriggerJobArgs for {Kind}Trigger — sets TRIGGER_KIND, Payload, v1_payload_fn

Required in handler_ee.rs:

  • #[async_trait] impl TriggerCrud for {Kind}Trigger with:
    • type Trigger = Trigger<{Kind}Config>
    • type TriggerConfigRequest = {Kind}ConfigRequest
    • const ROUTE_PREFIX: &'static str = "/{kind}_triggers";
    • const TABLE_NAME, ADDITIONAL_SELECT_FIELDS
    • get_deployed_object, validate_config, create_trigger, update_trigger, delete_trigger, test_connection
    • additional_routes (optional — mount extra endpoints for things like ARM resource listing, topic discovery)
    • `config_runnable
Полный SKILL.md на GitHub

Установить adding-a-trigger в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл adding-a-trigger?

Checklist for adding a new TriggerCrud-based trigger type to Windmill (Azure, GCP, Kafka, etc.). Use when wiring a new trigger kind across backend, frontend, CLI, and capture infrastructure.

Как установить скилл adding-a-trigger?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл adding-a-trigger запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить adding-a-trigger с