agentleFS
dcs-sonidcs-soni/skills/empty-catch-finder/SKILL.md

finding-empty-catches

Skill1 starsChanged 10 months agoMITView on GitHub

Detect silent error handlers that cause mysterious production failures. Empty catch blocks are silent killers: This skill finds them before they cause production incidents. Find all empty/silent catch blocks: Each catch is categorized by risk: Get suggested fixes: Fix patterns: See PATTERNS.md for full pattern reference. User: "Find silent error handlers in my codebase" After fixing, prevent new empty catches: Python (Ruff):

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when user mentions silent failures, error swallowing, empty catch, ignored exceptions, or debugging mysterious production issues.

    line 5
  2. Distinctive:

    After fixing, prevent new empty catches:

    line 145

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Empty Catch Block Finder

Detect silent error handlers that cause mysterious production failures.

Why This Matters

Empty catch blocks are silent killers:

try {
  await saveOrder(order);
} catch (e) {
  // Silent failure - order lost, no evidence
}

This skill finds them before they cause production incidents.

Quick Start

Empty Catch Analysis:
- [ ] Step 1: Scan for empty catch blocks
- [ ] Step 2: Assess risk level
- [ ] Step 3: Generate fix suggestions

Workflow

Step 1: Scan for Empty Catches

Find all empty/silent catch blocks:

python scripts/find_empty_catches.py <directory>

Detects:

  • catch (e) {} - completely empty
  • catch (e) { /* comment */ } - only comments
  • except: pass - Python silent pass
  • if err != nil { } - Go ignored errors
  • catch { return; } - silent returns

Step 2: Assess Risk Level

Each catch is categorized by risk:

RiskPatternWhy Dangerous
🔴 CriticalEmpty catch in async/database codeData loss, corruption
🟠 HighEmpty catch in API handlersSilent failures to users
🟡 MediumEmpty catch in utilitiesHidden bugs
🟢 LowEmpty catch in tests/scriptsUsually intentional

Step 3: Generate Fix Suggestions

Get suggested fixes:

python scripts/generate_fixes.py <directory> --output fixes.md

Fix patterns:

// ❌ Before: Silent failure
catch (e) {}

// ✅ After: Logged + handled
catch (e) {
  logger.error('Order save failed', { error: e, orderId: order.id });
  throw new OrderSaveError('Failed to save order', { cause: e });
}

Utility Scripts

ScriptPurpose
find_empty_catches.pyFind empty catch blocks
generate_fixes.pySuggest proper error handling

Language Support

LanguagePatterns Detected
JavaScript/TypeScriptcatch (e) {}, catch {}
Pythonexcept: pass, except Exception: ...
Javacatch (Exception e) {}
Goif err != nil { } (empty body)
C#catch (Exception) {}

See PATTERNS.md for full pattern reference.


Example

User: "Find silent error handlers in my codebase"

Output:

Found 8 empty catch blocks

🔴 CRITICAL (2)
  src/services/payment.ts:45
    catch (e) {} // In async payment processing!

  src/db/users.ts:112
    catch (e) { return null; } // Hides DB errors

🟠 HIGH (3)
  src/api/orders.ts:78
    catch (error) { /* TODO: handle */ }

  ...

Integration with Linting

After fixing, prevent new empty catches:

ESLint:

{ "rules": { "no-empty": ["error", { "allowEmptyCatch": false }] } }

Python (Ruff):

[tool.ruff]
select = ["E722"]  # bare-except

Related Skills

  • incident-response-helper — Debug issues caused by silent failures
  • stale-todo-finder — Find // TODO: handle error comments

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.