defensive-programming

Enforce boundary validation, explicit error handling, and type safety in code.

Updated May 20, 2026
One-click install
npx skills add https://github.com/RealEmmettS/shaughv-code --skill defensive-programming-realemmetts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defensive-programming
Source: https://github.com/RealEmmettS/shaughv-code/tree/main/plugins/shaughv-code/skills/defensive-programming
Command: npx skills add https://github.com/RealEmmettS/shaughv-code --skill defensive-programming-realemmetts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers write more robust and secure code by enforcing boundary validation, fail-fast principles, and defensive programming practices.

Core Features & Use Cases

  • Boundary Validation: Enforce validation at the entry points of the system to ensure data integrity.
  • Fail Fast: Encourage explicit error handling and avoid silent failures.
  • Type Safety: Use type systems to prevent runtime errors.
  • Idempotency and Retry Logic: Handle retries and idempotency correctly to ensure reliability.
  • Use Case: Ideal for writing code at system boundaries, implementing error contracts, or designing robust error-handling strategies.

Quick Start

Use the defensive-programming skill to review your codebase for boundary validation and fail-fast principles.

Frequently Asked Questions about defensive-programming

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

FAQPage Schema
How do I implement boundary validation to prevent silent failures in my code?

Boundary validation prevents silent failures by enforcing data integrity checks and explicit error handling at system entry points. This Skill applies defensive programming principles to ensure reliability and security by validating data immediately upon entry.

What's the best way to apply fail-fast principles when designing error-handling strategies?

Fail-fast principles encourage explicit error handling and avoid silent failures by crashing early when invalid data is detected. This Skill enforces these practices by applying boundary validation and type safety to ensure runtime errors are prevented before they propagate.

How do I enforce type safety to prevent runtime errors at system boundaries?

Type safety prevents runtime errors by using type systems to validate data before processing. This Skill enforces type safety alongside boundary validation and fail-fast principles to ensure code reliability and data integrity at entry points.

Do I need prior knowledge of error handling and validation to use defensive programming?

Yes, using defensive programming requires an understanding of error handling, validation, and type systems. This Skill applies these concepts to enforce boundary validation and fail-fast principles, making prerequisite knowledge of error contracts essential.

Can I use defensive programming to handle retries and idempotency for system reliability?

Yes, defensive programming handles retries and idempotency correctly to ensure reliability. This Skill applies fail-fast principles and boundary validation to manage retry logic and prevent silent failures during repeated operations.

Why does defensive programming review codebases for boundary validation and fail-fast principles?

Defensive programming reviews codebases to identify missing boundary validation and enforce fail-fast principles, preventing silent failures. This Skill analyzes code at system boundaries to ensure explicit error handling and type safety are properly implemented.