Fix Skill
Goal
Close the bug loop fast: capture evidence -> reproduce -> fix root cause -> verify -> watch for recurrence.
Modes
- •
log-first: Start from live error data and incident reports. - •
repro-first: Start from automated reproduction when logs are weak or missing.
Choose log-first when 500s/exceptions are present. Choose repro-first for race conditions, stale UI state, click dead zones, and timing bugs.
Repo-Specific Inputs (TheRxSpot)
- •Live diagnostics endpoint:
auth/api/live-errors.php - •Client error ingest:
auth/api/log-client-error.php - •Structured diagnostics log:
auth/logs/live-errors-YYYY-MM-DD.jsonl - •Auth bootstrap correlation:
auth/auth-helper.php(X-Request-Id) - •Additional reference:
references/therxspot-fix-loop.md
Safety Rules
- •Keep diagnostics gated:
- •
RXSPOT_LIVE_ERROR_API=1only during active triage windows. - •Prefer header token auth (
Authorization: Bearer ...), never query-string tokens.
- •
- •Never modify runtime data files directly (
auth/data/app.db,.db_initialized, sessions). - •Never expose internals in client responses; keep details in logs only.
Workflow
- •Confirm symptom and pick mode (
log-firstorrepro-first). - •Acquire evidence.
- •
log-first:- •Query recent events from
auth/api/live-errors.phpwith filters (limit,lookback_minutes,search,sources). - •Group by signature: endpoint + message + stack fragment.
- •Query recent events from
- •
repro-first:- •Run deterministic probes (API replay or Playwright interaction loops).
- •Capture request IDs, console errors, network failures, and timing windows.
- •Build minimal repro.
- •For API failures: replay exact method/path/headers/body.
- •For UI race failures: script rapid navigation + repeated click/open/close interactions with small randomized delays.
- •Fix root cause minimally.
- •Prefer lifecycle-safe init patterns for SPA/bfcache/turbo navigation.
- •Make handlers idempotent; prevent duplicate listeners; guard stale async responses.
- •Add contextual error logging with request/user/route context.
- •Verify.
- •Required gates:
- •
npm run lint - •
npm run test:php
- •
- •If UI/race issue: rerun targeted Playwright scenario multiple iterations (>=20).
- •Re-query live diagnostics and confirm the failing signature drops or disappears.
- •Report.
- •Include changed files, root cause, verification evidence, and residual risk.
TheRxSpot Command Patterns
- •Pull live errors:
bash
curl -H "Authorization: Bearer $RXSPOT_LIVE_ERROR_API_TOKEN" \ "https://therxspot.com/auth/api/live-errors.php?limit=200&lookback_minutes=180&sources=live,php,client"
- •Submit manual incident:
bash
curl -X POST \
-H "Authorization: Bearer $RXSPOT_LIVE_ERROR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message":"notifications not marking read","severity":"error","type":"manual_report","steps":["open bell","click item"],"actual":"stays unread"}' \
"https://therxspot.com/auth/api/live-errors.php"
- •Verification:
bash
npm run lint npm run test:php
Race-Condition Playbook
Use this when symptoms are "works after refresh" or "buttons dead until reload":
- •Re-initialize page logic on multiple lifecycles (
DOMContentLoaded, SPA navigation events,pageshow). - •Ensure init is idempotent and abort/replace old listeners.
- •Add short-lived diagnostics around event binding and async state transitions.
- •Run repeated navigation/interactions with jitter and collect failures by step index.
Autonomous Long-Run Loop
For unattended stabilization sessions:
- •Poll live diagnostics every N minutes.
- •Rank top recurring signatures by frequency + recency.
- •Attempt one fix at a time (highest-impact first).
- •Run verification gates and targeted repro iterations.
- •Re-poll for regression.
- •Stop when no critical signatures remain for a defined window.
Keep one fix per loop iteration to avoid confounding variables.
Completion Standard
Do not claim fixed unless:
- •Repro exists (or historical signature is clearly captured),
- •Root cause is identified,
- •Verification passes,
- •Post-fix diagnostics show improvement.