sql-event-pattern-matching
Installation
SKILL.md
SQL Event Pattern Matching
When to use
Event data has an inherent order (timestamp, user, session). Aggregations alone lose that order. Reach for this skill when the question involves sequence: "what did users do before X", "how long between A and B", "which sessions contain pattern P", "where do users drop off", "find runs of consecutive Y".
Pick the right tool
| Problem shape | Tool |
|---|---|
| "Compare each row to its neighbor" (deltas, gaps, prev/next event) | lag/lead + window frames |
| "Group consecutive rows sharing a property" (sessions, runs, status streaks) | Gaps and islands |
| "Did sequence A → B → C happen, with constraints?" | match_recognize if dialect supports; else self-joins + windows |
| "Funnel conversion / drop-off / time-to-convert" | Funnel patterns |
| "Most common paths / Sankey / next-event distribution" | Path analysis |
| "Cohort retention, recurring behavior, churn windows" | Retention |
| "Anomalies / change points / streaks in time series" | Time-series patterns |