Defensive Programming for Medical Devices

Enforces defensive programming practices for medical device software development.

26|6|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/AminAlam/meddev-agent-skills --skill defensive-programming-for-medical-devices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Defensive Programming for Medical Devices
Source: https://github.com/AminAlam/meddev-agent-skills/tree/main/architecture/defensive-design
Command: npx skills add https://github.com/AminAlam/meddev-agent-skills --skill defensive-programming-for-medical-devices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps prevent, detect, and safely handle abnormal conditions in safety-relevant medical device software, reducing the risk of hazardous behavior and system failures.

Core Features & Use Cases

  • Input Validation: Ensures all external inputs meet defined criteria, preventing invalid data from causing issues.
  • Output Bounds Checking: Prevents unsafe outputs by enforcing limits and triggering alarms when exceeded.
  • Error Handling: Promotes robust error propagation and handling to avoid silent failures.
  • Use Case: When developing a critical function that reads sensor data, this Skill guides you to validate the input range, check for timeouts on the read operation, and ensure any out-of-bounds data is handled gracefully, preventing a potential patient safety incident.

Quick Start

Apply defensive programming techniques to the sensor reading module, ensuring all inputs are validated and errors are propagated.

Frequently Asked Questions about Defensive Programming for Medical Devices

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

FAQPage Schema
How do I implement defensive programming for medical device software?

Defensive programming for medical device software is implemented by enforcing input validation, output bounds checking, assertions, error propagation, and timeouts. These practices ensure predictable system responses under abnormal conditions to prevent hazardous behavior.

What is the best way to handle errors in safety-critical Class B and C medical devices?

Handling errors in safety-critical Class B and C medical devices requires robust error propagation and handling to avoid silent failures. You must enforce strict output bounds checking and trigger alarms when predefined safety limits are exceeded.

How do I validate sensor data inputs to prevent memory faults in medical devices?

Validating sensor data inputs requires ensuring all external inputs meet defined criteria before processing. Applying timeout checks on read operations and handling out-of-bounds data gracefully prevents potential patient safety incidents and memory faults.

Does defensive programming satisfy IEC 62304 requirements for robust error handling?

Defensive programming satisfies IEC 62304 requirements for robust error handling by preventing, detecting, and safely handling abnormal conditions in safety-relevant software. It enforces predictable system responses required for safety-critical modules.

When do I need output bounds checking in medical device software development?

Output bounds checking is needed in medical device software development when generating outputs that impact patient safety. It prevents unsafe outputs by enforcing strict operational limits and triggering alarms when those bounds are exceeded.