<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Regulatory-Compliance on Damian Galarza | Software Engineering &amp; AI Consulting</title><link>https://www.damiangalarza.com/tags/regulatory-compliance/</link><description>Recent posts from Damian Galarza | Software Engineering &amp; AI Consulting</description><generator>Hugo</generator><language>en-us</language><managingEditor>Damian Galarza</managingEditor><atom:link href="https://www.damiangalarza.com/tags/regulatory-compliance/feed.xml" rel="self" type="application/rss+xml"/><item><title>The AI Prompt I Wish I Had While Documenting SaMD Systems in Rails</title><link>https://www.damiangalarza.com/posts/2025-06-22-generate-sds-docs-samd-ai/</link><pubDate>Sat, 21 Jun 2025 00:00:00 -0400</pubDate><author>Damian Galarza</author><guid>https://www.damiangalarza.com/posts/2025-06-22-generate-sds-docs-samd-ai/</guid><description>How AI could have helped me generate FDA audit-ready SDS documentation faster while building regulated software.</description><content:encoded><![CDATA[<p>At Buoy Software, I led the design and development of our first <strong>Software as a Medical Device (SaMD)</strong>, which was my first experience operating within an FDA-regulated environment. It was a great learning experience, but it came with a lot of heavy documentation. One of the most time-consuming parts was compiling the Design History File (DHF) — the set of artifacts that describe how the system was built and tested. A central piece of that file is the Software Design Specification (SDS), which describes the behavior, design, and rationale for each component in the system.</p>
<p>For every Rails class we shipped, we had to trace requirements, detail business logic and interfaces, and map out risk controls — all in a format that is audit-ready for FDA review.</p>
<p>This post kicks off a series called ‘AI Prompts I Wish I Had’, sharing prompts that could’ve made our engineering workflows smoother while building regulated software.</p>
<p>The goal of this series is to offer <strong>practical, high-context AI prompts</strong> that help teams move faster toward an FDA submission — without compromising quality, traceability, or compliance.</p>
<hr>
<h2 id="-the-prompt">🧠 The Prompt</h2>
<div class="highlight"><pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-markdown" data-lang="markdown"><span style="display:flex;"><span><span style="color:#fab387;font-weight:bold"># SDS Documentation Prompt
</span></span></span><span style="display:flex;"><span><span style="color:#fab387;font-weight:bold"></span>
</span></span><span style="display:flex;"><span>You are a SaMD software engineer generating regulatory documentation.
</span></span><span style="display:flex;"><span>I will provide you with one or more Ruby/Rails classes used in a regulated
</span></span><span style="display:flex;"><span>Software as a Medical Device (SaMD) product.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Based on the code I provide, generate a <span style="font-weight:bold">**Software Design Specification (SDS)**</span> entry suitable
</span></span><span style="display:flex;"><span>for inclusion in a Design History File (DHF).
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Your output should include:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">1.</span> <span style="font-weight:bold">**Component Name**</span>  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">2.</span> <span style="font-weight:bold">**Purpose / Role in the System**</span>  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">3.</span> <span style="font-weight:bold">**Description of Logic / Behavior**</span> – Provide detailed explanations including:
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Specific business rules with exact criteria and thresholds  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> All possible status values/enums with definitions of what each represents  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Step-by-step process flows with decision points  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Data validation rules and constraints  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Error handling and edge cases  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">4.</span> <span style="font-weight:bold">**External Interfaces**</span> – Include:
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Specific API endpoints and GraphQL mutations/queries  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Database table names and key fields  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Session storage keys and data structures  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Third-party service integrations  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">5.</span> <span style="font-weight:bold">**How It Satisfies Specific SRS Requirements**</span> – Expand on:
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Security controls with implementation details  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Audit logging mechanisms and what data is captured  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Regulatory compliance features  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Data integrity safeguards  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">6.</span> <span style="font-weight:bold">**Design Considerations**</span> – Detail:
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Security flags and their enforcement mechanisms  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Session state management and validation logic  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Performance optimizations and their rationale  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Safety mechanisms and fail-safes  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">7.</span> <span style="font-weight:bold">**Traceability Notes**</span> – Include:
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Specific risk control implementations  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Audit trail mechanisms (PaperTrail, analytics events, etc.)  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Logging infrastructure for regulatory compliance  
</span></span><span style="display:flex;"><span>   <span style="color:#cba6f7">-</span> Known technical limitations with business impact  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="font-weight:bold">**Additional Requirements:**</span>
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">-</span> **No abbreviations or “etc.”** – List all status values, rules, and conditions explicitly  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">-</span> **Implementation details** – Show actual code snippets for critical security or compliance logic  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">-</span> **Business rule explanations** – Explain the medical/regulatory rationale behind complex rules  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">-</span> **Security deep-dive** – Cover authentication, authorization, session management, and data protection  
</span></span><span style="display:flex;"><span><span style="color:#cba6f7">-</span> **Audit compliance** – Document all logging, tracking, and audit trail mechanisms required for regulatory review
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Format the output in Markdown with headers for each section. Be comprehensive, technical, and audit-ready.
</span></span></code></pre></div><p><strong>Example usage:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-markdown" data-lang="markdown"><span style="display:flex;"><span>The system we are documenting is located within <span style="color:#a6e3a1">`packs/authentication`</span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>I want documentation covering the login and session management flow for users.  
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>How does the system validate credentials?
</span></span><span style="display:flex;"><span>How is the session established and managed?
</span></span><span style="display:flex;"><span>What audit trails are recorded for access attempts?
</span></span></code></pre></div><p>Like anything generated with AI it requires a careful review, but this prompt can help you quickly generate a starting point for a comprehensive SDS entry that meets FDA requirements. It ensures that you cover all necessary aspects of the system&rsquo;s design and behavior, making it easier to compile your Design History File.</p>
<p>Let me know if this is helpful — and if you want me to share the next prompt in this series.</p>
<p>If you&rsquo;re building a SaMD or working in a regulated domain and want help tuning your dev workflows with AI, <a href="/services/">let&rsquo;s talk</a>.</p>
]]></content:encoded></item></channel></rss>