refactor: extract skills from commands across 8 plugins
Refactored commands to extract reusable skills following the Commands → Skills separation pattern. Each command is now <50 lines and references skill files for detailed knowledge. Plugins refactored: - claude-config-maintainer: 5 commands → 7 skills - code-sentinel: 3 commands → 2 skills - contract-validator: 5 commands → 6 skills - data-platform: 10 commands → 6 skills - doc-guardian: 5 commands → 6 skills (replaced nested dir) - git-flow: 8 commands → 7 skills Skills contain: workflows, validation rules, conventions, reference data, tool documentation Commands now contain: YAML frontmatter, agent assignment, skills list, brief workflow steps, parameters Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
# /dbt-test - Run dbt Tests
|
||||
|
||||
## Skills to Load
|
||||
- skills/dbt-workflow.md
|
||||
- skills/mcp-tools-reference.md
|
||||
- skills/visual-header.md
|
||||
|
||||
## Visual Output
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 📊 DATA-PLATFORM · dbt Tests │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Then proceed with the tests.
|
||||
|
||||
Execute dbt tests with formatted pass/fail results.
|
||||
Display header: `DATA-PLATFORM - dbt Tests`
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -22,75 +17,17 @@ Execute dbt tests with formatted pass/fail results.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Pre-validation** (MANDATORY):
|
||||
- Use `dbt_parse` to validate project first
|
||||
- If validation fails, show errors and STOP
|
||||
Execute `skills/dbt-workflow.md` test workflow:
|
||||
|
||||
2. **Execute tests**:
|
||||
- Use `dbt_test` with provided selection
|
||||
- Capture all test results
|
||||
|
||||
3. **Format results**:
|
||||
- Group by test type (schema vs. data)
|
||||
- Show pass/fail status with counts
|
||||
- Display failure details
|
||||
|
||||
## Report Format
|
||||
|
||||
```
|
||||
=== dbt Test Results ===
|
||||
Project: my_project
|
||||
Selection: tag:critical
|
||||
|
||||
--- Summary ---
|
||||
Total: 24 tests
|
||||
PASS: 22 (92%)
|
||||
FAIL: 1 (4%)
|
||||
WARN: 1 (4%)
|
||||
SKIP: 0 (0%)
|
||||
|
||||
--- Schema Tests (18) ---
|
||||
[PASS] unique_dim_customers_customer_id
|
||||
[PASS] not_null_dim_customers_customer_id
|
||||
[PASS] not_null_dim_customers_email
|
||||
[PASS] accepted_values_dim_customers_status
|
||||
[FAIL] relationships_fct_orders_customer_id
|
||||
|
||||
--- Data Tests (6) ---
|
||||
[PASS] assert_positive_order_amounts
|
||||
[PASS] assert_valid_dates
|
||||
[WARN] assert_recent_orders (threshold: 7 days)
|
||||
|
||||
--- Failure Details ---
|
||||
Test: relationships_fct_orders_customer_id
|
||||
Type: schema (relationships)
|
||||
Model: fct_orders
|
||||
Message: 15 records failed referential integrity check
|
||||
Query: SELECT * FROM fct_orders WHERE customer_id NOT IN (SELECT customer_id FROM dim_customers)
|
||||
|
||||
--- Warning Details ---
|
||||
Test: assert_recent_orders
|
||||
Type: data
|
||||
Message: No orders in last 7 days (expected for dev environment)
|
||||
Severity: warn
|
||||
```
|
||||
|
||||
## Selection Syntax
|
||||
|
||||
| Pattern | Meaning |
|
||||
|---------|---------|
|
||||
| (none) | Run all tests |
|
||||
| `model_name` | Tests for specific model |
|
||||
| `+model_name` | Tests for model and upstream |
|
||||
| `tag:critical` | Tests with tag |
|
||||
| `test_type:schema` | Only schema tests |
|
||||
| `test_type:data` | Only data tests |
|
||||
1. **Pre-validation** (MANDATORY): Run `dbt_parse` first
|
||||
2. **Execute tests**: Use `dbt_test` with selection
|
||||
3. **Format results**: Group by test type, show pass/fail/warn counts
|
||||
|
||||
## Options
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--warn-only` | Treat failures as warnings (don't fail CI) |
|
||||
| `--warn-only` | Treat failures as warnings |
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -98,34 +35,9 @@ Severity: warn
|
||||
/dbt-test # Run all tests
|
||||
/dbt-test dim_customers # Tests for specific model
|
||||
/dbt-test tag:critical # Run critical tests only
|
||||
/dbt-test +fct_orders # Test model and its upstream
|
||||
```
|
||||
|
||||
## Test Types
|
||||
## Required MCP Tools
|
||||
|
||||
### Schema Tests
|
||||
Built-in tests defined in `schema.yml`:
|
||||
- `unique` - No duplicate values
|
||||
- `not_null` - No null values
|
||||
- `accepted_values` - Value in allowed list
|
||||
- `relationships` - Foreign key integrity
|
||||
|
||||
### Data Tests
|
||||
Custom SQL tests in `tests/` directory:
|
||||
- Return rows that fail the assertion
|
||||
- Zero rows = pass, any rows = fail
|
||||
|
||||
## Exit Codes
|
||||
|
||||
| Code | Meaning |
|
||||
|------|---------|
|
||||
| 0 | All tests passed |
|
||||
| 1 | One or more tests failed |
|
||||
| 2 | dbt error (parse failure, etc.) |
|
||||
|
||||
## Available Tools
|
||||
|
||||
Use these MCP tools:
|
||||
- `dbt_parse` - Pre-validation (ALWAYS RUN FIRST)
|
||||
- `dbt_test` - Execute tests (REQUIRED)
|
||||
- `dbt_build` - Alternative: run + test together
|
||||
|
||||
Reference in New Issue
Block a user