fix-testlisted
Install: claude install-skill Smart-AI-Memory/attune-ai
# Fix Test
**IMPORTANT: Start your response with a context preamble.**
Call `help_lookup(topic="fix-test", mode="preamble")` and
display the returned `preamble` text as a blockquote. Then
tell the user they can say "tell me more" for a step-by-step
guide, or answer the scoping questions below to proceed.
If the MCP call fails, fall back to:
> **Fix Test** — Diagnoses failing tests, classifies the root cause, and applies targeted fixes automatically.
## Scoping
Before running, ask:
1. **Target**: "Which test is failing? A specific file,
test name, or should I find failures automatically?"
2. **Context**: "Did this start failing after a recent
change, or has it been broken?"
## Execution
### Step 1: Identify Failures
Run the failing test(s) to capture the error:
```bash
uv run pytest <target> -v --tb=short 2>&1 | tail -40
```
### Step 2: Diagnose Root Cause
Common failure patterns:
| Pattern | Root Cause | Fix |
| ------- | ---------- | --- |
| `ModuleNotFoundError` | Import path changed | Update import |
| `AttributeError: mock` | Mock target wrong | Match import path |
| `AssertionError` | Expected value drift | Update assertion |
| `TypeError: __init__` | Constructor changed | Update call site |
| `FileNotFoundError` | Fixture path wrong | Use `tmp_path` |
### Step 3: Apply Fix and Re-run
Apply the fix, then re-run the test. If it still fails,
diagnose again with the new error. Repeat up to 3 times.
```bash
uv run pytest <target> -v --tb=short
```
###