Skip to content

borghei/Claude-Skills / data-analytics/analytics-engineer

analytics-engineer

Verified

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.

FileKindSize
REFERENCE.mdmarkdown4.2 KB
SKILL.mdskill md13.4 KB
assets/dbt_project.ymlconfig1.1 KB
assets/macros.sqlother1.5 KB
assets/schema.ymlconfig1.4 KB
assets/source.ymlconfig1.0 KB
references/dbt_style_guide.mdmarkdown2.7 KB
references/modeling_patterns.mdmarkdown3.2 KB
references/optimization.mdmarkdown3.0 KB
references/testing_guide.mdmarkdown2.4 KB
scripts/doc_generator.pyexecutablescript3.2 KB
scripts/impact_analyzer.pyexecutablescript3.5 KB
scripts/quality_scorer.pyexecutablescript3.9 KB
scripts/schema_diff.pyexecutablescript4.0 KB

references/testing_guide.md

View on GitHub
# Testing & CI/CD Guide

Ensuring data pipeline integrity requires rigorous coverage at all execution vectors.

## 1. Generic Tests

Generic tests are globally scalable validations declared within `.yml` schema files.

- **Unique**: Apply to all primary keys to ensure the grain of the model is respected.
- **Not_null**: Apply to all primary keys and critical business fields (e.g. `amount`).
- **Accepted_values**: Use to validate enum-type fields (e.g., ensuring `order_status` can only equal `pending`, `shipped`, `cancelled`).
- **Relationships**: Apply to all foreign keys to validate referential integrity against parent dimension tables.

*Implementation Example:*
```yaml
models:
  - name: fct_orders
    columns:
      - name: order_id
        tests:
          - unique
          - not_null
      - name: customer_id
        tests:
          - relationships:
              to: ref('dim_customers')
              field: customer_id
      - name: status
        tests:
          - accepted_values:
              values: ['placed', 'shipped', 'completed']
```

## 2. Testing Sources First

Do not wait until the transformation is complete to discover bad data. Apply tests directly to the raw sources inside the `_sources.yml` configurations. Isolating upstream drops reduces debug turnaround.

## 3. Singular Tests

When business logic requires complex checks that generic `.yml` blocks can't accommodate, write explicit Singular Tests.
- Store these as `.sql` files within the `tests/` directory.
- The test file should `SELECT` the failing condition. If the query returns `0` rows, the test passes.

*Example:* `tests/assert_positive_amount.sql`
```sql
-- Ensure that the revenue amount is never negative
SELECT
    order_id,
    revenue_amount
FROM {{ ref('fct_orders') }}
WHERE revenue_amount < 0
```

## 4. Continuous Integration (CI/CD)

### Pull Request Workflows
Never merge directly into `main`. The Git workflow should mandate PRs, and the CI environment must automatically run building and testing.

### Slim CI
Running a full `dbt build` against thousands of models on every PR commits is too slow and expensive.
- **Rule**: Utilize Slim CI workflows comparing state against production.
- **Command**: `dbt build --select state:modified+`
- **Result**: Instructs the environment to only build and test models whose code changed in the PR branch, along with any downstream models that depend on them.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall