Dbt Patterns

Macros are reusable Jinja functions. Use them to DRY up repeated SQL patterns. Override the default schema naming to control where models land: This ensures sch

CROAnalytics
bySamuelca6399861 words

What is Dbt Patterns?

What this skill does

The Dbt Patterns skill provides advanced templates and macros to streamline SQL development within dbt projects. It enables you to write reusable Jinja functions that reduce repetition, customize schema naming to separate production and development environments, and implement common SQL transformations like pivots and surrogate keys. This skill also includes hooks for automating permissions and cache refreshes, custom materializations for incremental loads and snapshots, and CI/CD workflow snippets to optimize your deployment processes.

Who it's for

This skill is designed for analytics engineers and data teams responsible for maintaining complex data transformation pipelines. Growth leads or agency strategists overseeing multi-environment dbt deployments will benefit from schema naming macros that prevent accidental data overwrites. Performance marketers working closely with BI teams can leverage testing macros and CI integration to ensure data accuracy and freshness in reporting models.

Key workflows

A practitioner typically starts by defining reusable macros, such as converting cents to dollars or pivoting rows into columns, to centralize common logic. Next, they customize schema naming conventions using provided macros to isolate development from production schemas, reducing deployment risk. They then implement hooks to automate post-build permissions or cache refreshes, ensuring data access and performance are managed consistently. Finally, the practitioner configures CI/CD pipelines that selectively build changed models and run tests to maintain data integrity while optimizing build time.

Common questions

How do macros improve dbt model maintainability? Macros reduce repeated SQL code by encapsulating logic in reusable functions, making models easier to update and audit. Can I prevent dev models from overwriting production data? Yes, the schema naming macro dynamically adjusts schema names based on the environment to avoid collisions. How do incremental strategies work without MERGE support? The skill provides a delete+insert incremental materialization compatible with warehouses like Redshift that lack native merge functionality.

How to use in Metaflow

Attach the Dbt Patterns skill to a Metaflow agent task responsible for building or testing dbt models to gain access to these advanced macros and hooks during execution. Expect your dbt runs to become more modular and maintainable, with environment-aware schema separation and automated post-build steps. This skill integrates seamlessly with incremental builds and CI/CD workflows, enabling reliable and efficient deployments within Metaflow pipelines.

For broader context, see our roundup of marketing skills claude, and read Claude Code workflows for marketing agencies for related setup guidance.

Related skills

Paywall & Upgrade Flow Optimization

When the user wants to create or optimize in-app paywalls, upgrade screens, upsell modals, or feature gates. Also use when the user mentions "paywall," "upgrade screen," "upgrade modal," "upsell," "feature gate," "convert free to paid," "freemium conversion," "trial expiration screen," "limit reached screen," "plan upgrade prompt," "in-app pricing," "free users won't upgrade," "trial to paid conversion," or "how do I get users to pay." Use this for any in-product moment where you're asking users

View →

ROI Analyzer

Use when preparing executive reports, evaluating investments, or calculating ROI/break-even/payback period. 30-minute analysis (87.5% time saving). Includes scenario analysis.

View →

UTM Builder

Generate UTM-tagged URLs for campaign tracking. Create consistent, organized tracking links for Google Analytics, HubSpot, and other analytics platforms. Supports bulk generation, naming conventions, and campaign documentation. Use when creating tracking links, campaign URLs, or organizing marketing attribution.

View →

User Onboarding & Activation Optimization

When the user wants to optimize post-signup onboarding, user activation, first-run experience, or time-to-value. Also use when the user mentions "onboarding flow," "activation rate," "user activation," "first-run experience," "empty states," "onboarding checklist," "aha moment," "new user experience," "users aren't activating," "nobody completes setup," "low activation rate," "users sign up but don't use the product," "time to value," or "first session experience." Use this whenever users are si

View →

Signup Flow Optimization

When the user wants to optimize signup, registration, account creation, or trial activation flows. Also use when the user mentions "signup conversions," "registration friction," "signup form optimization," "free trial signup," "reduce signup dropoff," "account creation flow," "people aren't signing up," "signup abandonment," "trial conversion rate," "nobody completes registration," "too many steps to sign up," or "simplify our signup." Use this whenever the user has a signup or registration flow

View →

Landing Page Conversion Optimization

When the user wants to optimize, improve, or increase conversions on any marketing page — including homepage, landing pages, pricing pages, feature pages, or blog posts. Also use when the user says "CRO," "conversion rate optimization," "this page isn't converting," "improve conversions," "why isn't this page working," "my landing page sucks," "nobody's converting," "low conversion rate," "bounce rate is too high," "people leave without signing up," or "this page needs work." Use this even if th

View →