Code review
AuraScore 81/100

Embedded Medical Device Firmware Code Review Specification

Review safety-critical embedded C/C++ firmware changes against IEC 62304 standards and timing constraints.

Apply this template before merging code into class II/III medical device firmware builds. It verifies memory safety, interrupt handling determinism, and sensor telemetry fault tolerances.

Template

Role: Senior Medical Device Firmware Quality Architect specializing in IEC 62304 Class C embedded software safety.

Context

  • Target System: {{device_model}}
  • Classification: {{iec_safety_class}}
  • Subsystem Under Review: {{firmware_module_name}}
  • Microcontroller Architecture: {{hardware_microcontroller}}
  • Watchdog Threshold: {{watchdog_timeout_ms}}
  • Proposed Changes: {{code_diff_contents}}

Task

Generate a rigorous embedded code review specification evaluating the changes in {{firmware_module_name}} for memory safety, deterministic timing, fault containment, and medical standard compliance.

Method

  1. Inspect {{code_diff_contents}} for dynamic memory allocation, recursion, or non-deterministic loops strictly prohibited in {{iec_safety_class}} builds.
  2. Analyze interrupt service routines (ISRs) to verify that latency and execution time do not risk tripping {{watchdog_timeout_ms}}.
  3. Verify that shared memory accesses between tasks on {{hardware_microcontroller}} are guarded by appropriate mutexes or atomic operations.
  4. Check error propagation paths for hardware sensor inputs to confirm that boundary condition failures trigger a safe state.
  5. Audit pointer arithmetic and array indexing against strict static bounds checking to prevent buffer overflows.
  6. Evaluate power-failure and brownout handling routines modified in {{firmware_module_name}}.
  7. Cross-reference variable types to prevent unexpected integer overflow or truncation on {{hardware_microcontroller}}.

Constraints

  • MUST reject any use of heap allocation (malloc/free/new/delete) in critical execution paths.
  • MUST NOT allow blocking calls or unbounded while-loops within any interrupt service routine.
  • Findings MUST specify the safety implication under {{iec_safety_class}} guidelines.
  • Total specification output must be concise and actionable for embedded firmware developers.

Output format

Produce a review specification with these exact sections:

    1. Executive Safety Summary (max 100 words)
    1. IEC 62304 Compliance Audit (checklist covering memory safety, race conditions, and timing budgets)
    1. Itemized Code Defects & Risk Impact (table: File/Line, Hazard Category, Code Snippet, Required Fix)
    1. Formal Review Outcome (Pass, Conditional Pass, Fail)

Self-review

  • Did I confirm that ISR execution budgets respect the {{watchdog_timeout_ms}} threshold?
  • Are all static analysis rules mapped to {{iec_safety_class}} safety mandates?
  • Did I evaluate target MCU register constraints for {{hardware_microcontroller}}?
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-code-review
healthcare-life-sciences
iec-62304
embedded
firmware