borghei/Claude-Skills / data-analytics/analytics-engineer
analytics-engineer
VerifiedAnalytics 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.
| File | Kind | Size |
|---|---|---|
| REFERENCE.md | markdown | 4.2 KB |
| SKILL.md | skill md | 13.4 KB |
| assets/dbt_project.yml | config | 1.1 KB |
| assets/macros.sql | other | 1.5 KB |
| assets/schema.yml | config | 1.4 KB |
| assets/source.yml | config | 1.0 KB |
| references/dbt_style_guide.md | markdown | 2.7 KB |
| references/modeling_patterns.md | markdown | 3.2 KB |
| references/optimization.md | markdown | 3.0 KB |
| references/testing_guide.md | markdown | 2.4 KB |
| scripts/doc_generator.pyexecutable | script | 3.2 KB |
| scripts/impact_analyzer.pyexecutable | script | 3.5 KB |
| scripts/quality_scorer.pyexecutable | script | 3.9 KB |
| scripts/schema_diff.pyexecutable | script | 4.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.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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: 197k | Updated | Claude CodeCodex | Verified | Install |