monte-carlo-data/mc-agent-toolkit / skills/analyze-root-cause
monte-carlo-analyze-root-cause
VerifiedInvestigate data incidents and find root causes using Monte Carlo's observability data. Guides the agent through systematic investigation: alert lookup, lineage tracing, ETL checks, query analysis, and data profiling. Activates when a user asks about data issues, incidents, alerts, or why data looks wrong.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 4.7 KB |
| SKILL.md | skill md | 15.9 KB |
| references/common-root-causes.md | markdown | 4.0 KB |
| references/data-exploration.md | markdown | 4.8 KB |
| references/etl-failure-investigation.md | markdown | 2.7 KB |
| references/field-anomaly-investigation.md | markdown | 4.0 KB |
| references/freshness-investigation.md | markdown | 3.2 KB |
| references/intake-no-incident.md | markdown | 3.5 KB |
| references/query-change-investigation.md | markdown | 2.2 KB |
| references/schema-investigation.md | markdown | 1.8 KB |
| references/volume-investigation.md | markdown | 2.4 KB |
references/query-change-investigation.md
View on GitHub# Query Change Investigation Playbook
Use this when SQL modifications are suspected of causing a data issue.
## Investigation steps
### 1. Detect query changes
Call `get_query_changes(mcons=[table_mcon], start_time=..., end_time=...)`:
- Look at the time range around when the issue started
- Compare old vs new SQL text — what changed?
- Focus on: WHERE clauses, JOINs, GROUP BY, column selections, CTEs
### 2. Correlate with the incident timeline
Call `get_change_timeline` for a unified view:
- Did the query change happen right before the anomaly?
- Was there also a volume shift at the same time?
- Were there ETL failures immediately after the query change?
### 3. Understand the impact
For each detected query change:
- **Added/removed JOINs**: Can change cardinality (row count) dramatically
- **Changed WHERE clause**: Can include/exclude different data subsets
- **Modified GROUP BY**: Can change aggregation granularity
- **New columns or removed columns**: Schema change
- **Changed UNION**: Can add or remove entire data sources
### 4. Trace to code changes
**If GitHub MCP is available:**
Search for PRs merged around the time of the query change. Look for:
- dbt model modifications (`.sql` files in `models/`)
- Stored procedure changes
- ETL script updates
- Configuration changes (e.g., different source tables)
**If no GitHub MCP:**
The `get_query_changes` output should include enough SQL diff information to understand what changed. Ask the user if they know who made the change.
### 5. Verify the fix
If the root cause is a bad query change:
- Show the user the before/after SQL
- Suggest reverting the change or fixing the query
- If DB connector is available, run the old and new queries on a sample to compare outputs
## Common patterns
- **Accidental filter removal** — WHERE clause removed, producing more rows than expected
- **JOIN type change** — INNER → LEFT JOIN introduces NULLs; LEFT → INNER drops rows
- **Dedup logic change** — DISTINCT or ROW_NUMBER window changed, altering unique row count
- **Source table swap** — query now reads from a different source table
- **Aggregation change** — GROUP BY granularity changed, producing different row counts
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |