From braze
Building SQL queries with variables, templates, and AI-assisted generation for data exploration.
How this skill is triggered — by the user, by Claude, or both
Slash command
/braze:analyst-queriesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`★ Insight ─────────────────────────────────────`
★ Insight ─────────────────────────────────────
SKILL.md) rather than a personal skill — the writing-skills TDD methodology applies to personal skills, but here we're generating synthesized reference content from source topics.─────────────────────────────────────────────────Here is the generated skill file body:
This skill covers how to construct, parameterize, and generate SQL queries in the Braze Query Builder. It serves as a reference for the braze-analyst role, with a specific lens on data extraction and custom analysis through SQL query composition — helping you pull meaningful segments, events, and user-level data from Braze's Snowflake-backed storage.
Use this skill when you need to:
| Topic | What It Covers |
|---|---|
| Query Builder Overview | How the Query Builder works, what data it exposes, and how SQL variables fit into the report authoring workflow |
| SQL Variables | Syntax, variable types, and how to define reusable parameters in queries |
| Query Templates | Pre-built templates available in the Query Builder, data window constraints, and how to adapt them |
| Building Queries | Composing queries from scratch, selecting tables, joining datasets, and structuring for analyst reuse |
| AI SQL Query Generation | Using Braze's AI-assisted query authoring to generate SQL from natural language prompts |
| AI SQL Segment Extensions | Extending segments using AI-generated SQL logic to identify similar or related users |
As a braze-analyst, your primary concern is extracting actionable data — not configuring campaigns or writing message copy. This skill applies that lens throughout:
Braze Query Builder supports Liquid-style SQL variables to parameterize reports without hardcoding values.
{{variable_type.${custom_label}}}
variable_type — the data type (e.g., string, number, date, array)${custom_label} — your human-readable label for the variable (shown in the report UI)SELECT
user_id,
event_name,
time
FROM USERS_BEHAVIORS_CUSTOMEVENT_SHARED
WHERE
event_name = {{string.${Event Name}}}
AND time >= {{date.${Start Date}}}
AND time <= {{date.${End Date}}}
This query exposes three inputs in the report UI — the analyst fills them in without touching SQL.
| Type | Use For |
|---|---|
string | Event names, campaign IDs, channel values |
number | Thresholds, counts, numeric filters |
date | Time range bounds |
array | Multi-value filters (IN clauses) |
When creating a report, select Query Template to access Braze's pre-built SQL patterns.
Key constraints to know:
FROM clauses and WHERE filters before runningAnalyst pattern: Use a template to validate the table structure and column names, then copy the query into a custom report and extend it.
When building from scratch, orient around Braze's Snowflake table naming convention:
USERS_<DOMAIN>_<EVENT>_SHARED
Examples:
USERS_BEHAVIORS_CUSTOMEVENT_SHARED — custom eventsUSERS_MESSAGES_EMAIL_SEND_SHARED — email sendsUSERS_CAMPAIGNS_CONVERSION_SHARED — campaign conversionsAnalyst tips:
user_id as the join key across tablestime early to avoid full-table scansBraze provides an AI query generation tool inside the Query Builder. Provide a natural language description of the data you want, and the AI generates an initial SQL query.
When to use it:
Always validate:
Segment extensions powered by AI SQL allow you to define a user cohort through SQL logic, then use that cohort as a targeting or analysis input.
Analyst use case: Identify users who share a behavioral pattern (e.g., "purchased within 7 days of receiving a push notification") without manually constructing the full query.
Key boundary: The SQL must return a list of user_id values. Keep the logic focused on behavioral criteria, not message or campaign metadata unless the analysis explicitly requires it.
| Mistake | Fix |
|---|---|
| Hardcoding dates or IDs | Use {{date.${...}}} or {{string.${...}}} variables |
| Assuming templates cover all 60 days | Templates default to 60 days but the window is editable — verify before drawing conclusions |
| Trusting AI-generated SQL without review | Always inspect table names and WHERE clauses before running |
Using SELECT * in production queries | Select only the columns you need — Snowflake costs scale with data scanned |
Forgetting to filter by time | Add a time range filter on every query to avoid full-table scans |
★ Insight ─────────────────────────────────────
{% multi_lang_include %} tags — the content above fills those gaps with idiomatic Braze Query Builder patterns inferred from the available context and the SQL variables/templates topics that were resolved.braze-engineer role would emphasize SDK integration and data validation, whereas this analyst lens foregrounds reusability, cost efficiency, and AI-as-scaffold patterns.
─────────────────────────────────────────────────Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub delta-and-beta-marchi/braze-agency --plugin braze