Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analytics engineering across data modeling, dbt, transformation, and semantic layers. Use when building dbt models, designing star schemas, writing staging or mart SQL, configuring data tests, or optimizing warehouse queries.
.claude/skills/borghei-analytics-engineer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -23% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 311% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 242% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 210% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 72% | 0% |
The agent operates as a senior analytics engineer, building scalable dbt transformation layers, designing dimensional models, writing tested SQL, and managing semantic-layer metric definitions.
Before building the models, confirm these inputs. If any is unknown or vague, ASK — do not assume:
Stop rule: ask only the 2-3 that most change the output. If the user says "just draft it," proceed and list your assumptions at the top of the artifact.
stg_ model per source table. Rename columns, cast types, filter soft-deletes, and add metadata columns. Validate: dbt build --select stg_*.int_ models (e.g., int_orders_enriched). Keep each CTE single-purpose.dim_ and fct_ models for consumption. Configure materialization (view for staging, incremental for large facts, table for small marts).unique + not_null. Foreign keys get relationships. Add accepted_values for enums. Write model descriptions in YAML.dbt build, confirm test pass rate = 100%, check row counts against source, and verify dashboard numbers match.analytics/
dbt_project.yml
models/
staging/ # stg_<source>__<table>.sql (one per source table)
intermediate/ # int_<entity>_<verb>.sql (reusable logic)
marts/
core/ # dim_*.sql, fct_*.sql (consumption-ready)
marketing/
finance/
macros/ # Reusable Jinja helpers
tests/ # Custom generic + singular tests
seeds/ # Static CSV lookups
snapshots/ # SCD Type 2 capturesStaging model (models/staging/crm/stg_crm__customers.sql):
sqlWITH source AS ( SELECT * FROM {{ source('crm', 'customers') }} ), renamed AS ( SELECT id AS customer_id, TRIM(LOWER(name)) AS customer_name, TRIM(LOWER(email)) AS email, created_at::timestamp AS created_at, updated_at::timestamp AS updated_at, is_active::boolean AS is_active, _fivetran_synced AS _loaded_at FROM source WHERE _fivetran_deleted = false ) SELECT * FROM renamed
Mart model (models/marts/core/dim_customer.sql):
sqlWITH customers AS ( SELECT * FROM {{ ref('stg_crm__customers') }} ), customer_orders AS ( SELECT customer_id, MIN(order_date) AS first_order_date, MAX(order_date) AS most_recent_order_date, COUNT(*) AS lifetime_orders, SUM(order_amount) AS lifetime_value FROM {{ ref('stg_orders__orders') }} GROUP BY customer_id ), final AS ( SELECT c.customer_id, c.customer_name, c.email, c.created_at, co.first_order_date, co.most_recent_order_date, co.lifetime_orders, co.lifetime_value, CASE WHEN co.lifetime_value >= 10000 THEN 'platinum' WHEN co.lifetime_value >= 5000 THEN 'gold' WHEN co.lifetime_value >= 1000 THEN 'silver' ELSE 'bronze' END AS customer_tier FROM customers c LEFT JOIN customer_orders co ON c.customer_id = co.customer_id ) SELECT * FROM final
Test configuration (models/marts/core/_core__models.yml):
yamlversion: 2 models: - name: dim_customer description: Customer dimension with lifetime order metrics and tier classification. columns: - name: customer_id tests: [unique, not_null] - name: email tests: [unique, not_null] - name: customer_tier tests: - accepted_values: values: ['platinum', 'gold', 'silver', 'bronze'] - name: lifetime_value tests: - dbt_utils.expression_is_true: expression: ">= 0"
sql-- models/marts/core/fct_orders.sql {{ config( materialized='incremental', unique_key='order_id', partition_by={'field': 'order_date', 'data_type': 'date'}, cluster_by=['customer_id', 'product_id'] ) }} WITH orders AS ( SELECT * FROM {{ ref('stg_orders__orders') }} {% if is_incremental() %} WHERE order_date >= (SELECT MAX(order_date) FROM {{ this }}) {% endif %} ), order_items AS ( SELECT * FROM {{ ref('stg_orders__order_items') }} ), final AS ( SELECT o.order_id, o.order_date, o.customer_id, oi.product_id, o.store_id, oi.quantity, oi.unit_price, oi.quantity * oi.unit_price AS line_total, o.discount_amount, o.tax_amount, o.total_amount FROM orders o INNER JOIN order_items oi ON o.order_id = oi.order_id ) SELECT * FROM final
| Layer | Materialization | Rationale | |-------|----------------|-----------| | Staging | View | Thin wrappers; no storage cost | | Intermediate | Ephemeral / View | Business logic; referenced multiple times | | Marts (small) | Table | Query performance for BI tools | | Marts (large) | Incremental | Efficient appends for large fact tables |
yaml# models/marts/core/_core__metrics.yml metrics: - name: revenue label: Total Revenue model: ref('fct_orders') calculation_method: sum expression: total_amount timestamp: order_date time_grains: [day, week, month, quarter, year] dimensions: [customer_tier, product_category, store_region] filters: - field: is_cancelled operator: '=' value: 'false' - name: average_order_value label: Average Order Value model: ref('fct_orders') calculation_method: average expression: total_amount timestamp: order_date time_grains: [day, week, month]
sql-- macros/cents_to_dollars.sql {% macro cents_to_dollars(column_name) %} ({{ column_name }} / 100.0)::decimal(18,2) {% endmacro %} -- macros/get_incremental_filter.sql {% macro get_incremental_filter(column_name, lookback_days=3) %} {% if is_incremental() %} WHERE {{ column_name }} >= ( SELECT DATEADD(day, -{{ lookback_days }}, MAX({{ column_name }})) FROM {{ this }} ) {% endif %} {% endmacro %}
bash# Only run modified models and their downstream dependents dbt run --select state:modified+ --defer --state ./target-base dbt test --select state:modified+ --defer --state ./target-base
For full CI/CD pipeline configuration, see REFERENCE.md.
REFERENCE.md -- Extended patterns: source config, custom tests, CI/CD workflows, exposures, documentation templatesreferences/modeling_patterns.md -- Data modeling best practicesreferences/dbt_style_guide.md -- SQL and dbt conventionsreferences/testing_guide.md -- Testing strategiesreferences/optimization.md -- Performance tuningbashpython scripts/impact_analyzer.py --model dim_customer python scripts/schema_diff.py --source prod --target dev python scripts/doc_generator.py --format markdown python scripts/quality_scorer.py --model fct_orders
| Tool | Purpose | Key Flags | |------|---------|-----------| | impact_analyzer.py | Trace downstream impact of a dbt model via BFS on the manifest DAG | --model <name>, --manifest <path>, --json | | schema_diff.py | Compare two dbt catalog.json files to detect column additions, removals, and type changes | --source <path>, --target <path>, --json | | doc_generator.py | Generate markdown documentation (column dictionary, dependencies, tests) for a dbt model | --model <name>, --manifest <path>, --catalog <path> | | quality_scorer.py | Score a dbt model 0-100 based on documentation, testing, and layer-convention adherence | --model <name>, --manifest <path>, --json |
| Problem | Likely Cause | Resolution | |---------|-------------|------------| | dbt build fails with "relation does not exist" | Upstream model was not run or materialization changed | Run dbt build --select +<model> to build the full upstream chain | | Incremental model produces duplicates | unique_key does not match the actual grain | Verify the unique_key config matches the primary key columns; run a full refresh with --full-refresh | | Test failures on not_null after deployment | Source data introduced unexpected NULLs in a previously clean column | Add a staging-layer COALESCE or adjust the test to warn severity while investigating upstream | | Schema drift detected by schema_diff.py | Upstream source changed column types or removed columns | Coordinate with the data engineering team; update staging model casts and regenerate documentation | | Semantic-layer metric values differ from dashboard | Dashboard applies its own filters or calculations outside the semantic layer | Move all calculation logic into the semantic layer; audit dashboard-level computed fields | | Slow dbt run on large incremental models | Lookback window is too wide or partition pruning is not engaged | Narrow the incremental filter, verify partition_by config, and check warehouse query plan | | quality_scorer.py reports low score despite good coverage | Staging model contains JOINs or GROUP BY operations triggering layer-violation penalties | Refactor aggregation logic into intermediate or mart models; keep staging models as thin wrappers |
dbt build with a 100% test pass rate before merging to production.unique + not_null).quality_scorer.py reports >= 80/100 for every mart model.In scope: dbt project design, dimensional modeling (Kimball methodology), SQL transformation logic, data testing, semantic-layer metric definition, CI/CD for dbt, and warehouse query optimization.
Out of scope: Raw data ingestion and extraction (ELT/ETL orchestration tools like Fivetran or Airbyte), data infrastructure provisioning, BI tool configuration beyond semantic-layer integration, and real-time streaming pipelines.
Limitations: The Python tools operate on dbt manifest/catalog JSON artifacts and do not query the warehouse directly. Scoring heuristics in quality_scorer.py use rule-based deductions that may not cover every project convention. All scripts use the Python standard library only -- no external dependencies required.
engineering/senior-data-engineer): Coordinates on source table contracts, ingestion SLAs, and schema change notifications.data-analytics/business-intelligence): Consumes mart models and semantic-layer metrics; dashboard specs reference model outputs.data-analytics/data-analyst): Writes ad-hoc queries against mart models; reports data quality issues back to the analytics engineer.data-analytics/ml-ops-engineer): Feature engineering pipelines may depend on intermediate or mart models as upstream inputs.templates/): Slim CI patterns (state:modified+) integrate into GitHub Actions or similar runners for automated PR validation.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | pass→pass | 5,677 | 3,039 | -46% | 1 | 1 | 0% | 955 | 3,846 | +303% | 0 | 0 | — |
case-01 | fail→pass | 28,078 | 8,405 | -70% | 1 | 1 | 0% | 6,159 | 4,766 | -23% | 0 | 0 | — |
case-02 | fail→fail | 20,134 | 19,447 | -3% | 1 | 1 | 0% | 4,021 | 7,232 | +80% | 0 | 0 | — |
case-03 | fail→fail | 14,597 | 19,718 | +35% | 1 | 1 | 0% | 2,875 | 7,431 | +158% | 0 | 0 | — |
case-04 | fail→pass | 6,543 | 8,632 | +32% | 1 | 1 | 0% | 1,208 | 4,969 | +311% | 0 | 0 | — |
case-06 | pass→pass | 5,533 | 4,377 | -21% | 1 | 1 | 0% | 776 | 4,090 | +427% | 0 | 0 | — |
case-07 | pass→pass | 14,704 | 9,004 | -39% | 1 | 1 | 0% | 2,301 | 4,840 | +110% | 0 | 0 | — |
case-08 | pass→pass | 10,002 | 7,315 | -27% | 1 | 1 | 0% | 1,543 | 4,575 | +197% | 0 | 0 | — |
case-09 | pass→pass | 6,174 | 7,015 | +14% | 1 | 1 | 0% | 1,073 | 4,602 | +329% | 0 | 0 | — |
case-10 | pass→pass | 8,381 | 6,505 | -22% | 1 | 1 | 0% | 1,418 | 4,479 | +216% | 0 | 0 | — |
case-11 | pass→pass | 3,425 | 3,070 | -10% | 1 | 1 | 0% | 539 | 3,833 | +611% | 0 | 0 | — |
case-12 | pass→pass | 3,857 | 5,506 | +43% | 1 | 1 | 0% | 649 | 4,307 | +564% | 0 | 0 | — |
case-13 | pass→pass | 3,500 | 2,971 | -15% | 1 | 1 | 0% | 571 | 3,843 | +573% | 0 | 0 | — |
case-14 | fail→pass | 6,974 | 6,630 | -5% | 1 | 1 | 0% | 1,316 | 4,496 | +242% | 0 | 0 | — |
case-15 | pass→pass | 8,128 | 5,816 | -28% | 1 | 1 | 0% | 1,423 | 4,320 | +204% | 0 | 0 | — |
case-16 | fail→pass | 7,293 | 2,362 | -68% | 1 | 1 | 0% | 1,197 | 3,715 | +210% | 0 | 0 | — |
case-17 | fail→pass | 13,082 | 2,349 | -82% | 1 | 1 | 0% | 2,157 | 3,707 | +72% | 0 | 0 | — |
case-18 | fail→pass | 7,141 | 2,425 | -66% | 1 | 1 | 0% | 1,185 | 3,735 | +215% | 0 | 0 | — |
case-19 | pass→pass | 11,935 | 12,220 | +2% | 1 | 1 | 0% | 1,973 | 5,492 | +178% | 0 | 0 | — |
case-20 | fail→fail | 10,296 | 10,037 | -3% | 1 | 1 | 0% | 1,920 | 5,186 | +170% | 0 | 0 | — |
case-21 | fail→fail | 10,343 | 10,842 | +5% | 1 | 1 | 0% | 2,038 | 5,300 | +160% | 0 | 0 | — |
case-22 | fail→fail | 12,938 | 13,063 | +1% | 1 | 1 | 0% | 2,133 | 5,503 | +158% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.