Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/godatadriven/dbt-bouncer --skill new-check명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | new-check |
| description | Scaffold a new dbt-bouncer check class with tests |
Follow these steps to add a new check to dbt-bouncer.
src/dbt_bouncer/checks/<category>/.Use the @check decorator, passing the rule code. Everything else is inferred from the function signature:
from dbt_bouncer.check_framework.decorator import check, fail
@check(code="XX000")
def check_model_xxx(model):
"""Check description."""
if some_condition:
fail(f"`{model.unique_id}` failed because ...")
code is the only argument @check takes. All other metadata is inferred from the function signature:
MO048. See "Assign a rule code" below.name: value in YAML config).ctx). If there are none, the check is global (runs once with context only).*) become user-configurable Pydantic fields.(resource, ctx, *, params). Resource first, ctx second. Putting ctx before the resource breaks iterate_over inference. For context-only checks, use (ctx, *, params).@check(code="MO021")
def check_model_description_populated(model):
"""Models must have a populated description."""
if not model.description or len(model.description.strip()) < 4:
fail(f"`{model.unique_id}` does not have a populated description.")
@check(code="MO038")
def check_model_names(model, *, model_name_pattern: str):
"""Models must have a name matching the supplied regex."""
import re
if not re.match(model_name_pattern, model.name, re.IGNORECASE):
fail(f"`{model.unique_id}` does not match pattern `{model_name_pattern}`.")
@check(code="MO044")
def check_model_test_coverage(ctx, *, min_model_test_coverage_pct: float = 100):
"""Set the minimum percentage of models that have at least one test."""
...
fail() — raises DbtBouncerFailedCheckErrorfail("message")
Every check needs a unique rule code: a 2-letter resource prefix plus a 3-digit number, e.g. MO048. Two steps:
Pass it to the decorator: @check(code="MO048").
Add the matching member to the resource's *RuleCode enum in src/dbt_bouncer/enums.py, keeping alphabetical order:
class ModelRuleCode(StrEnum):
CHECK_MODEL_XXX = "MO048"
Use the next free number for the prefix — read the enum to find it. Never reuse or renumber a published code; users reference codes in their config.
Prefixes: CA catalog, EX exposure, LI lineage, MA macro, ME metadata, MO model, RR run results, SE seed, SM semantic model, SN snapshot, SO source, TE test, UT unit test.
dbt-bouncer-example.ymldbt-bouncer --config-file dbt-bouncer-example.ymlUse check_passes / check_fails from dbt_bouncer.testing:
from dbt_bouncer.testing import check_fails, check_passes
def test_pass():
check_passes("check_model_xxx", model={"name": "valid"}, my_param="value")
def test_fail():
check_fails("check_model_xxx", model={"name": "invalid"}, my_param="value")
# For context-dependent checks:
def test_with_context():
check_passes("check_model_xxx",
model={"name": "m1"},
ctx_models=[{"name": "m1"}, {"name": "m2"}])
ctx_* kwargs build the CheckContext automatically__init__.py exists in the test subdirectorymise run generate-schema
mise run generate-rule-codes-doc
mise run test-unit
prek run --all-files
The rule-codes-doc-check hook fails if a check has no code, if a declared code is unused, or if docs/checks/rule_codes.md has drifted.