- Home
- Skills
- Code Quality & Review
- tenacity exception classifier
tenacity exception classifier
Audit and fix dangerous Tenacity retry logic to prevent infinite loops and swallowed exceptions.
$10
Works with the AI tools you already use
tenacity exception classifier
Example session with this skill installed
Review the retry logic in my service layer. I'm seeing 404 errors causing infinite retry loops and I'm losing the original stack traces.
- Read your context and instructions
- Compiled the tenacity exception classifier
- Generated the document
I have completed the audit of your retry logic. I identified 3 critical issues where permanent failures were being retried and root causes were being swallowed by Tenacity's default behavior.
Tenacity Exception Audit Report
| Finding ID | Severity | Location | Issue |
|---|---|---|---|
| EXC-3-4a1b | Critical | services/api_client.py:42 | Retrying on all HTTPStatusError including 404/401 |
| EXC-5-9f2d | High | services/orders.py:112 | Missing reraise=True hiding root cause |
| EXC-1-c3e8 | Critical | gateways/stripe.py:15 | Bare @retry decorator (infinite, no backoff) |
Detailed Findings & Fixes
Finding EXC-3-4a1b: Dangerous HTTP Retries
The current implementation retries on any httpx.HTTPStatusError. This includes 404 Not Found and 401 Unauthorized, which will never succeed on a retry and may trigger security lockouts.
Recommended Fix:
Use a transient-only predicate. I have generated a patch that implements a status-code filter.
# Generated Patch: ./output/patches/EXC-3-4a1b.py
import httpx
from tenacity import retry, retry_if_exception, stop_after_attempt, wait_exponential_jitter
_TRANSIENT_CODES = {408, 429, 500, 502, 503, 504}
def is_transient_http_error(exc: BaseException) -> bool:
if isinstance(exc, httpx.ConnectError):
return True
if isinstance(exc, httpx.HTTPStatusError):
return exc.response.status_code in _TRANSIENT_CODES
return False
@retry(
retry=retry_if_exception(is_transient_http_error),
stop=stop_after_attempt(3),
wait=wait_exponential_jitter(initial=1, max=10),
reraise=True
)
def fetch_data():
...
Next steps
- Review the full report in
./output/tenacity-exception-classifier-report.md. - Apply the specific fixes from
./output/patches/. - Verify that your logging captures the
is_transient_http_errorpredicate logic.
tenacity-exception-classifier.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
The problem
Improper retry logic leads to infinite loops, account lockouts from 401/403 errors, and swallowed root causes. Developers often use broad decorators that retry on programming bugs or permanent API failures, wasting resources and masking critical defects.
What it does
- Identifies dangerous bare
@retrydecorators and over-broadExceptioncatches. - Flags incorrect retry behavior on HTTP 4xx errors, authentication failures, and logic errors like
KeyErrororValueError. - Detects hidden root causes where
reraise=Trueis missing from Tenacity configurations. - Generates precise, named transient-error predicates and refactored retry logic tailored to your specific HTTP client and exception hierarchy.
Frameworks & tools
Python, Tenacity, Requests, HTTPX.
Why this beats prompting it yourself
General LLMs often suggest generic retry blocks that don't account for the difference between transient network blips and permanent logic errors. This skill performs a deep static analysis of your project's exception hierarchy to ensure custom exceptions are classified correctly before suggesting a fix.
Use cases
- Auditing a legacy codebase for fragile or unbounded retry loops.
- Hardening API clients against rate limits and authentication failures.
- Debugging
RetryErrorstacks that hide the original exception.
Known limitations
Analysis is read-only and static. It does not execute code, handle non-UTF-8 files, or support Python 2 syntax.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 14 days ago
- Passed all security checks, Safe to install