monte-carlo-data/mc-agent-toolkit / skills/prevent
monte-carlo-prevent
VerifiedShift-left safety net for dbt/SQL model edits. Runs change impact assessment before edits, generates SQL validation queries after, and executes them via `/mc-validate run`. Delegates health and monitor creation to peer skills.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 8.3 KB |
| SKILL.md | skill md | 19.0 KB |
| references/TROUBLESHOOTING.md | markdown | 1.5 KB |
| references/parameters.md | markdown | 1.0 KB |
| references/workflows.md | markdown | 36.6 KB |
| scripts/sandbox/classify_sandbox.py | script | 1.5 KB |
| scripts/sandbox/detect_hardcoded_db.py | script | 1.2 KB |
| scripts/sandbox/parse_profiles.py | script | 3.3 KB |
| scripts/sandbox/readonly_check.py | script | 2.3 KB |
| scripts/sandbox/substitute_placeholders.py | script | 3.7 KB |
| scripts/sandbox/tests/conftest.py | script | 256 B |
| scripts/sandbox/tests/test_classify_sandbox.py | script | 1.1 KB |
| scripts/sandbox/tests/test_detect_hardcoded_db.py | script | 1.6 KB |
| scripts/sandbox/tests/test_integration_smoke.py | script | 2.8 KB |
| scripts/sandbox/tests/test_parse_profiles.py | script | 3.1 KB |
| scripts/sandbox/tests/test_readonly_check.py | script | 3.9 KB |
| scripts/sandbox/tests/test_substitute_placeholders.py | script | 3.7 KB |
scripts/sandbox/tests/test_parse_profiles.py
View on GitHub"""Tests for parse_profiles.py."""
import json
import subprocess
import sys
from pathlib import Path
import pytest
SCRIPT = Path(__file__).resolve().parents[1] / "parse_profiles.py"
def _run(profiles_path: Path, profile_name: str | None = None, target_name: str | None = None) -> tuple[int, dict, str]:
args = [sys.executable, str(SCRIPT), str(profiles_path)]
if profile_name:
args += ["--profile", profile_name]
if target_name:
args += ["--target", target_name]
result = subprocess.run(args, capture_output=True, text=True)
return result.returncode, json.loads(result.stdout or "{}"), result.stderr
SINGLE_TARGET = """
default:
target: prod
outputs:
prod:
type: snowflake
account: dka87615.us-east-1
user: alice@example.com
role: DATA_ANALYST
database: personal_alice
schema: prod
warehouse: research
threads: 2
"""
TWO_TARGET = """
default:
target: dev
outputs:
dev:
type: snowflake
account: hda34492.us-east-1
database: prod
schema: dbt_alice
role: data_analyst
warehouse: dev
local_prod:
type: snowflake
account: dka87615.us-east-1
database: personal_alice
schema: prod
role: developer
warehouse: research
"""
def test_single_target(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text(SINGLE_TARGET)
code, data, _ = _run(path)
assert code == 0
assert data == {
"profile": "default",
"target_name": "prod",
"database": "personal_alice",
"schema": "prod",
"role": "DATA_ANALYST",
"warehouse": "research",
"account": "dka87615.us-east-1",
}
def test_two_target_default_active(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text(TWO_TARGET)
code, data, _ = _run(path)
assert code == 0
assert data["target_name"] == "dev"
assert data["database"] == "prod"
assert data["schema"] == "dbt_alice"
def test_explicit_target_override(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text(TWO_TARGET)
code, data, _ = _run(path, target_name="local_prod")
assert code == 0
assert data["target_name"] == "local_prod"
assert data["database"] == "personal_alice"
def test_missing_file(tmp_path):
code, _, err = _run(tmp_path / "nope.yml")
assert code == 1
assert "not found" in err.lower()
def test_unparseable_yaml(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text("not: [valid: yaml")
code, _, err = _run(path)
assert code == 1
assert "parse" in err.lower() or "yaml" in err.lower()
def test_target_not_defined(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text("default:\n target: ghost\n outputs:\n other:\n database: foo\n")
code, _, err = _run(path)
assert code == 1
assert "ghost" in err
def test_profile_not_found(tmp_path):
path = tmp_path / "profiles.yml"
path.write_text(TWO_TARGET)
code, _, err = _run(path, profile_name="nonexistent_profile")
assert code == 1
assert "nonexistent_profile" in err
assert "not found" in err.lower()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |