adding-a-trigger

Guides adding a new TriggerCrud-based trigger type across Windmill backend, frontend, CLI, and capture infrastructure.

17.8k|1.1k|Updated May 5, 2022
One-click install
npx skills add https://github.com/windmill-labs/windmill --skill adding-a-trigger
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-a-trigger
Source: https://github.com/windmill-labs/windmill/tree/main/.agents/skills/adding-a-trigger
Command: npx skills add https://github.com/windmill-labs/windmill --skill adding-a-trigger

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new trigger type to Windmill touches dozens of files across the Rust backend, Svelte frontend, TypeScript CLI, OpenAPI spec, and database migrations, and missing any one of them causes silent regressions like dropped triggers during sync, broken capture buttons, or lost triggers in workspace forks.

Core Features & Use Cases

  • Complete file checklist: Enumerates every file that must change, from SQLx migrations and the windmill-trigger-{kind} crate to sidebar entries, icons, and hardcoded trigger-kind arrays in ACL, offboarding, and trash modules.
  • Reference implementations: Points to GCP, Kafka, and Azure triggers as concrete patterns for push, pull, and streaming trigger architectures.
  • Validation workflow: Provides exact cargo check, ./update_sqlx.sh, and npm run check:fast commands plus a final PR checklist.
  • Use Case: When implementing a new Azure Event Grid trigger, follow the checklist to wire the database migration with correct RLS policies, register the feature-gated backend routes, extend the CLI sync logic, and add the Svelte editor components without missing silent-failure hotspots.

Quick Start

Use the adding-a-trigger skill to walk me through every file I need to change to add a new MQTT-style trigger type to Windmill.

Frequently Asked Questions about adding-a-trigger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new trigger type to Windmill?

Create a SQLx migration for the trigger table, build a windmill-trigger-{kind} crate implementing TriggerCrud, register it in windmill-api behind feature flags, extend the OpenAPI spec, and add CLI plus Svelte frontend components. The skill provides a top-to-bottom checklist covering all required files.

What files change when adding a Kafka-style trigger in Windmill?

Changes span the database migration, backend trigger crate, TriggerKind enum, openapi.yaml, capture.rs, CLI sync and trigger commands, Svelte editor components, sidebar entries, and hardcoded kind arrays in granular_acls.rs, offboarding.rs, and trash.rs.

Why does my new Windmill trigger disappear during CLI sync?

The CLI silently drops trigger kinds not registered in cli/src/types.ts and sync.ts. You must add the kind to TRIGGER_TYPES, getTypeStrFromPath, the file-type filter, getTypeOrder, and the delete-suffix regex for sync round-trips to work.

Does this checklist apply to native triggers like Google Drive?

No. Native triggers wired through windmill-native-triggers, such as Nextcloud and Google Drive, use a different integration path covered by the separate native-trigger skill. This checklist targets TriggerCrud-based triggers like Kafka, GCP, Azure, and SQS.

Why do RLS policies in trigger migrations need scalar sub-selects?

Session GUCs set with SET LOCAL must be wrapped in scalar sub-selects so Postgres hoists them into a one-time InitPlan instead of re-evaluating per scanned row. The ::text[] cast must stay outside the sub-select to avoid an operator type error at CREATE time.