cleanup-defensive

Remove useless try/catch blocks and defensive null-checks from code bases.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/raintree-technology/agent-starter --skill cleanup-defensive
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleanup-defensive
Source: https://github.com/raintree-technology/agent-starter/tree/main/templates/.claude/skills/cleanup-defensive
Command: npx skills add https://github.com/raintree-technology/agent-starter --skill cleanup-defensive

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill identifies and removes try/catch blocks and defensive null-checks that do not add value, improving error handling and code readability.

Core Features & Use Cases

  • Identify and Remove Try/Catch Blocks: Scans code for and removes try/catch blocks that do not serve a useful role.
  • Preserve Boundary Code: Keeps try/catch blocks in system boundary files like HTTP handlers and CLI entry points.
  • Use Case: When you want to clean up defensive code, stop swallowing errors, or remove pointless try/catch blocks.

Quick Start

Analyze and clean up defensive code in the current directory.

Frequently Asked Questions about cleanup-defensive

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove useless try/catch blocks from my codebase?

This Skill removes useless try/catch blocks by scanning your codebase and deleting error handling that adds no value, while preserving boundary catches in HTTP handlers and CLI entry points to maintain system stability.

Why does my code keep swallowing errors with empty try/catch blocks?

Your code swallows errors because of defensive try/catch blocks that catch exceptions without handling them. This Skill identifies and removes these empty blocks, allowing errors to propagate naturally for better debugging and error handling.

Does this defensive code cleanup tool preserve try/catch blocks at system boundaries?

Yes, this defensive code cleanup tool preserves try/catch blocks in system boundary files like HTTP handlers and CLI entry points. It only removes defensive guards and error handling that do not serve a useful role in the core logic.

What's the best way to clean up defensive null-checks across multiple programming languages?

The best way to clean up defensive null-checks across multiple languages is to run this Skill in your project directory. It automatically detects and removes unnecessary null-checks while supporting multiple programming languages.

When should I not remove try/catch blocks from my code?

You should not remove try/catch blocks from system boundary files like HTTP handlers and CLI entry points. This Skill automatically preserves these boundary catches and only targets defensive guards and error handling that lack a useful role.