- Home
- Skills
- Testing & Debugging
- Root Cause First: Systematic Debugging
More screenshots
Works with the AI Agents you already use
Root Cause First: Systematic Debugging
Debug by diagnosis, not guessing — root cause first, one hypothesis at a time, fix at the source with a regression test.
$5
Root Cause First: Systematic Debugging
Example session with this skill installed
Our monthly usage export keeps dropping the last day of the month. A customer sent us a May export with no May 31 rows in it, and April's export is missing April 30. Exports for weekly ranges look fine. The job is a small Python script that queries Postgres and writes a CSV. Find out what is actually wrong before we change anything.
- Read your context and instructions
- Compiled the root cause first
Evidence read first. The export script builds its range in export.py as start <= created_at < end, where end comes from a helper called month_end(). No errors are logged, and the CSV writer is not dropping rows: the database holds 1,284 events for May 31, and zero of them appear in the file. The query range, not the export step, is excluding that day.
Reproduction. Running the script for May against the staging database reproduces it exactly: output covers May 1 to May 30 only. Weekly ranges ending mid-month are unaffected, which fits a boundary problem rather than data loss.
What changed. git log on export.py shows one relevant commit from last month: "store timestamps in UTC", which also changed month_end() to return a date built with datetime(year, month + 1, 1) minus one day, then compare it against a timestamp column. That is the suspect.
Hypothesis (one, written down): month_end() now returns midnight at the START of the last day of the month, and because the comparison is created_at < end, everything on the last day after 00:00 is excluded. Weekly ranges use a different helper, which is why they look fine.
Minimal test. Printing the computed range for May gives end = 2026-05-31 00:00:00. Confirmed: the range ends before the last day begins. Root cause established, no other changes needed.
Fix at the source. Change month_end() to return the first moment of the following month and keep the < end comparison, so the full last day is included. One function changed, nothing downstream touched.
Regression test (written first, failed before the fix, passes after):
def test_may_export_includes_last_day():
rows = run_export("2026-05")
assert any(r.created_at.day == 31 for r in rows)
Verification. May export now includes all 1,284 May 31 events, April includes April 30, and the existing suite passes (42 tests). Diagnosis closed: one boundary bug, introduced by the UTC commit, fixed at its source.
Connects securely to your tools. The creator never sees your data.
About this skill
The rule is simple and most agents break it: no fix before a root cause. This skill enforces a diagnostic loop — reproduce, localize across component boundaries with evidence, test one hypothesis at a time, fix at the source, add the regression test that would have caught it. And after three failed fixes, it stops and questions the design instead of stacking a fourth guess.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.
It will not propose a fix before the root cause is established with evidence, so it is deliberately slower than guessing when a bug is purely cosmetic. It also depends on what you can show it: without a reproduction, logs, or history to inspect, it will ask for more data instead of naming a cause.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 25 days ago
- Software
Git