在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用new-check
星标119
分支7
更新时间2026年6月19日 13:56
Scaffold a new dbt-bouncer check class with tests
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Scaffold a new dbt-bouncer check class with tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| 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 (bare, no arguments). Everything is inferred from the function signature:
from dbt_bouncer.check_framework.decorator import check, fail
@check
def check_model_xxx(model):
"""Check description."""
if some_condition:
fail(f"`{model.unique_id}` failed because ...")
@check is a bare decorator — it takes no arguments. All metadata is inferred from the function signature:
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
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
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
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")
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 subdirectorymake generate-schema
make test-unit
prek run --all-files