ralph-dbt-scope
Skill3 starsChanged 6 months agoMITView on GitHub
Run the dbt-scope regression testing loop. Iteratively install, lint, build, test, and debug the dbt-scope adapter until all targets pass.
- Reads credentials
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 9 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 98
If NO code changes are detected (only docs/images, no untracked code files), skip to the completion signal with Succeeded.
- Very specific: line 111
If it completes with === All targets completed.
- Distinctive: line 112
If any target fails, proceed to Step 2.
- Distinctive: line 118
When a target fails, analyze the error and fix the code.
- Very specific: line 122
Check pyproject.toml for dependency issues
- Very specific: line 123
Check for import errors in dbt/adapters/scope/__init__.py
- Very specific: line 128
Check pyproject.toml build config
- Very specific: line 129
Check for missing __init__.py files
- Distinctive: line 135
If unfixable issues remain, manually fix them in the source files
- Distinctive: line 142
Read the pytest output to identify which test(s) failed
- Very specific: line 143
Check the test file in tests/unit/ and the code under test in dbt/adapters/scope/
- Very specific: line 156
Check dbt/adapters/scope/connections.py for REST API issues
- Very specific: line 157
Check tests/integration/dbt_project/ for profiles/project config
- Very specific: line 162
If az login is not authenticated, .env is missing required values, or ADLA/ADLS resources are unavailable — these are environment problems, …
- Very specific: line 171
Check tests/integration/conftest.py for fixtures and tests/integration/datagen.py for test data generation
- Distinctive: line 189
If any target regresses, go back to Step 2 and fix the new failure.
- Distinctive: line 191
Only proceed to Step 4 when the full pipeline completes successfully.
- Distinctive: line 199
If ALL targets passed (venv + install + build + lint + unit-test + debug + integration-test):
- Distinctive: line 205
If you were unable to fix all failures after exhausting your approaches:
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
dbt-scope Regression Testing Loop
Iterative development loop to make the dbt-scope adapter bulletproof against regressions.
CRITICAL: Fix Code First, Never Skip Tests
NEVER git add or git commit, ANY changes you made will be reviewed, committed and pushed by a human.
When tests fail, they represent REAL logic or integration issues. The failures are not noise — something is broken and needs a code fix.
You MUST follow this order:
- Analyze diffs — understand what changed (Step 0)
- Run the full pipeline —
.scripts/run.sh all(Step 1) - Fix failures — diagnose errors, fix code, re-run failing target (Step 2)
- Confirm green — re-run
allto verify no regressions (Step 3) - Signal completion — only after ALL targets are green (Step 4)
NEVER emit { "status": "Succeeded" } if any target is still failing. Work through the failures systematically.
The Job
Execute the regression testing loop: analyze diffs → run full pipeline → fix failures → confirm all green → emit completion signal.
Context
- Project:
dbt-scope— a dbt adapter that generates SCOPE scripts and submits them as ADLA jobs via REST API - Build system:
uvwithpyproject.toml, bash dev script - Python: 3.10+
- Auth:
az loginrequired for debug/integration targets - Config:
.envfile required (copy from.env.example) - Logs: Bash transcript + pytest logs in
.logs/
Key directories
| Path | Purpose |
dbt/adapters/scope/ | Adapter core (impl.py, connections.py, script_builder.py, credentials.py, relation.py, column.py) |
dbt/include/scope/macros/ | Jinja macros for materializations |
tests/unit/ | Unit tests (fast, no credentials) |
tests/integration/ | Integration tests (ADLA + az login + .env) |
.scripts/run.sh | Dev script — all targets |
pyproject.toml | Project config and dependencies |
Pipeline targets (run by .scripts/run.sh all)
| Target | What it does | Cloud? |
venv | Create a fresh uv-managed .venv | No |
install | uv sync --extra dev | No |
build | Build wheel to dist/ | No |
lint | ruff check + format --check (auto-fixes first) | No |
unit-test | pytest tests/unit/ (fast, no credentials) | No |
debug | dbt debug against test project | Yes |
integration-test | pytest tests/integration/ (datagen + dbt run) | Yes |
Step 0: Analyze Git Diffs
cd ~/dbt-scope
# Committed changes vs main
git --no-pager diff main...HEAD -- dbt/ tests/ .scripts/ pyproject.toml
# Uncommitted changes (tracked + staged)
git --no-pager diff -- dbt/ tests/ .scripts/ pyproject.toml
git --no-pager diff --cached -- dbt/ tests/ .scripts/ pyproject.toml
# Untracked files (new files not yet in git)
git ls-files --others --exclude-standard -- dbt/ tests/ .scripts/Classify changed files (including untracked):
| Path pattern | Classification | Action required |
dbt/adapters/scope/*.py | Adapter code | Full pipeline |
dbt/include/scope/macros/* | Macros | Full pipeline |
tests/unit/* | Unit tests | Unit tests + lint |
tests/integration/* | Integration tests | Integration tests |
pyproject.toml | Dependencies | Reinstall + full pipeline |
.scripts/* | Tooling | Full pipeline |
If NO code changes are detected (only docs/images, no untracked code files), skip to the completion signal with Succeeded.
Step 1: Run the Full Pipeline
cd ~/dbt-scope
.scripts/run.sh allThis runs all targets in sequence: venv → install → build → lint → unit-test → debug → integration-test.
- If it completes with
=== All targets completed. ===, proceed to Step 4 (completion signal). - If any target fails, proceed to Step 2.
Step 2: Diagnose and Fix Failures
When a target fails, analyze the error and fix the code.
If install fails
- Check
pyproject.tomlfor dependency issues - Check for import errors in
dbt/adapters/scope/__init__.py - Re-run:
.scripts/run.sh install
If build fails
- Check
pyproject.tomlbuild config - Check for missing
__init__.pyfiles - Re-run:
.scripts/run.sh build
If lint fails
- The lint target auto-fixes first (
ruff check --fix+ruff format), then verifies - If unfixable issues remain, manually fix them in the source files
- Ruff config: line length 100, double quotes, rule set: E, W, F, I, N, UP, B, SIM, T20, RUF
print()is forbidden in library code (allowed in tests)- Re-run:
.scripts/run.sh lint
If unit-test fails
- Read the pytest output to identify which test(s) failed
- Check the test file in
tests/unit/and the code under test indbt/adapters/scope/ - Fix either the implementation or the test (prefer fixing implementation unless the test expectation is wrong)
- Re-run a single test for fast iteration:
uv run pytest tests/unit/test_script_builder.py -v uv run pytest tests/unit/test_script_builder.py::TestClass::test_method -v - Once the individual test passes, re-run:
.scripts/run.sh unit-test
If debug fails
- Requires
az login— verify Azure CLI auth - Requires
.envwith ADLA/storage values - Check
dbt/adapters/scope/connections.pyfor REST API issues - Check
tests/integration/dbt_project/for profiles/project config - Re-run:
.scripts/run.sh debug
If a failure is caused by missing prerequisites (not code)
If az login is not authenticated, .env is missing required values, or ADLA/ADLS resources are unavailable — these are environment problems, not code bugs. Do NOT waste iterations trying to "fix" code for environment issues. Instead:
- Clearly describe the missing prerequisite in your output
- Emit
{ "status": "Failed" }immediately
If integration-test fails
- Read the pytest output to identify which test(s) failed
- Integration tests in
tests/integration/test_dbt_scope.pyrun the full dbt pipeline: datagen → dbt run → verify Delta tables - Check
tests/integration/conftest.pyfor fixtures andtests/integration/datagen.pyfor test data generation - Fix the adapter code, macros, or test expectations as appropriate
- Re-run:
.scripts/run.sh integration-test
Key conventions to follow when fixing code
Scan the existing codebase to get an understanding of the coding style, project structure, and testing patterns.
Step 3: Confirm All Green
Once individual targets pass, re-run the full pipeline to confirm no regressions:
.scripts/run.sh allIf any target regresses, go back to Step 2 and fix the new failure.
Only proceed to Step 4 when the full pipeline completes successfully.
Step 4: Completion Signal
CRITICAL: You MUST emit exactly one of these JSON objects as the absolute last line of your output.
If ALL targets passed (venv + install + build + lint + unit-test + debug + integration-test):
{ "status": "Succeeded" }If you were unable to fix all failures after exhausting your approaches:
{ "status": "Failed" }The Ralph loop script parses your final output for this signal. If neither is found, the loop assumes the task is incomplete and will re-invoke you for another iteration. Always emit a status as a single line of plain text — no code fences, no trailing output after the signal.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

