Skip to main content

Marcos Souza

Product Engineer · HealthTech Scale, Loop Engineering & AI Systems

I don't start with code. I start by asking whose pain it is, what the true business constraint is, and what is not worth building.

Engineering exists at the service of the product — not the other way around. At ProABA (HealthTech SaaS), I have been a core builder from day zero to enterprise maturity, scaling platforms for ~100 clinics (+1,850 commits, 230+ merged PRs). I take raw user feedback directly, evaluate solutions, and close the loop end-to-end with contract-first architectures and deterministic AI safeguards.

// Principles & Operating Stance

Fall in Love with the Problem

Start with whose pain it is, the true business constraint, and what is NOT worth building before touching the editor. Escaping the build trap means eliminating waste upfront.

Ref: Uri Levine · Marty Cagan

Full-Cycle Product Ownership

Triage raw user reports and clinic escalations directly: frame the problem, evaluate the solution, design the seam, and deliver the fix end-to-end.

Ref: High Agency & Problem Triaging

Immediate Action on Feedback

Shortest possible feedback loops. When feedback lands from users or technical reviews, turn it into working systems and measurable improvements immediately.

Ref: Steep Learning Slope · Fast Iteration

Contract-First & Deterministic AI

Validate user workflows with throwaway mockups before production code. In mission-critical HealthTech, contain probabilistic AI within strict deterministic safety nets.

Ref: Zero Rework · Zero Hallucination
// Technical Writing

Essays & Tactical Notes

Published on Dev.to — lessons from production on Contract-First design and AI test harnesses.

View all on dev.to →
9 min read #webdev #portuguese #ai

Testes E2E como harness de AI: de 1h de QA manual a 10 min

DB efêmero com Docker, contas por role, BDD + Playwright e QA automatizado no preview do PR: a infra que reduziu QA de 1h manual para 5-10 min e virou o harness que deixa a AI programar com segurança.

// Production Work

Case Studies & Architectural Post-Mortems

Six production war stories — structured as the constraint, the architecture, trade-offs made, and measured impact.

01 / Agentic Workflow Automation

Autonomous Help Center Generation via Custom AI Agent Skill

The Constraint

Maintaining user documentation and onboarding tutorials manually (taking screenshots, recording steps, and updating help articles) consumed dozens of engineering and product hours after every release, creating stale guides and heavy support ticket loads.

The Architecture

Created a custom AI agent skill that reads canonical Markdown user-journey scripts as the single source of truth. The AI agent executes the entire loop: boots a local web instance in development, autonomously navigates through the exact user flow via browser automation, captures step-by-step screenshots and videos at critical interaction points, and compiles the official 22-tutorial interactive Help Center.

Architectural Trade-off

Invested upfront in deterministic script definitions and browser automation tooling in exchange for near-zero ongoing documentation maintenance.

Measured Production Impact
  • 80% reduction in manual documentation and tutorial maintenance time
  • 22 interactive clinical tutorials generated and kept in sync automatically
  • Immediate drop in routine onboarding support tickets from partner clinics
#Agentic AI #AI Skills #Browser Automation #Loop Engineering #DevEx
02 / HealthTech SaaS · AI Agents

Clinical AI Agent Pipelines & Human-in-the-Loop Safeguards

The Constraint

Autism (ABA) clinic therapists spent 1+ hours daily transcribing voice notes and formatting clinical session evolution reports, causing clinician burnout. Unconstrained LLMs risked dangerous medical hallucinations in clinical charts.

The Architecture

Asynchronous FastAPI microservices combining Whisper audio transcription with Claude reasoning. Enforced strict Pydantic output schemas matching ABA clinical taxonomy, paired with an intuitive Human-in-the-Loop review queue where clinicians review side-by-side diffs and explicitly approve records before database persistence.

Architectural Trade-off

Sacrificed fully automated 1-click publishing in exchange for 100% clinician auditability and zero liability risk in regulated medical records.

Measured Production Impact
  • 75% reduction in manual note charting time per session
  • 100% human-verified clinical audit trail with zero unverified hallucinations
  • Dozens of partner clinics scaled with zero latency degradation
#FastAPI #AI Agents #Human-in-the-Loop #Python #Pydantic
03 / Testing & AI Containment Net

Playwright E2E Test Harness as Containment Net for AI Coding

The Constraint

Manual QA before releases created 1-hour bottlenecks, slowing deployment cadence. Furthermore, using AI coding assistants without rigid verification risked silent business regressions ('vibe coding').

The Architecture

Engineered an automated E2E test harness using Playwright with ephemeral Docker Compose database fixtures, pre-seeded role accounts, and strict Page Object Models. Zero retries allowed in CI to enforce zero tolerance for flaky tests, creating a deterministic containment net for human and AI-assisted implementation.

Architectural Trade-off

Maintained strict fixture isolation in exchange for an unshakeable safety net enabling autonomous agents to safely propose verified PRs.

Measured Production Impact
  • 1h → 10min reduction in end-to-end regression validation cycle
  • Zero flaky test tolerance with unified Monocart trace reporting
  • Safe AI development loop with instant deterministic verification gates
#Playwright #Test Harness #AI Guardrails #Docker #CI/CD
04 / Cloud Infrastructure

Direct-to-Cloud Media Storage & Pre-Signed URL Security

The Constraint

Routing multi-megabyte therapy audio/video recordings through web application API servers caused severe server memory exhaustion, high bandwidth egress costs, and 504 timeouts on slow clinic cellular connections.

The Architecture

Designed an edge pre-signed direct upload pipeline with Cloudflare R2. Locked maximum file size constraints (20MB) and cryptographic integrity checks directly into pre-signed URL extensionHeaders, completely bypassing application server memory during media transit.

Architectural Trade-off

Added client-side direct upload orchestration complexity to eliminate backend memory exhaustion and achieve zero egress costs.

Measured Production Impact
  • Zero application server memory overhead for media transfers
  • $0 egress bandwidth costs via Cloudflare R2 S3-compatible architecture
  • Sub-second upload handshakes and elimination of proxy timeouts
#Cloudflare R2 #Presigned URLs #Signed Headers #Zero Egress
05 / Production Reliability

Next.js Production Resiliency & Deployment Skew Mitigation

The Constraint

During rolling zero-downtime production deployments, active users with open browser tabs triggered Server Actions pointing to stale build hashes, resulting in fatal 'Failed to find Server Action' errors and lost form state.

The Architecture

Implemented a client-side error boundary interceptor that detects deployment skew signatures, serializes dirty user inputs into temporary storage, and triggers a seamless state-preserving page reload. Middleware suppresses internal Next.js control-flow exceptions in Sentry.

Architectural Trade-off

Intercepted framework-level routing errors at runtime rather than forcing hard maintenance windows or user session cutoffs.

Measured Production Impact
  • Zero user-perceived downtime during active mid-day deployments
  • 100% elimination of lost user form data across releases
  • High-SNR Sentry error streams with zero false alarm exceptions
#Next.js #Server Actions #Resilience #Sentry #Error Boundaries
06 / Multi-Tenant Security

Multi-Tenant RBAC & Anti-IDOR Domain Security

The Constraint

In a multi-tenant healthcare SaaS, an Insecure Direct Object Reference (IDOR) could expose confidential patient evolutions between competing clinics or unauthorized staff.

The Architecture

Layered authorization barriers at the service/BFF level with explicit organization ownership guards. Built visual permission matrix UI on staff forms, prevented duplicate organization memberships, and enforced strict therapist-to-patient assignment checks.

Architectural Trade-off

Enforced defense-in-depth permission verification on every query rather than relying solely on frontend route protection.

Measured Production Impact
  • Zero data leakage across multi-tenant boundaries
  • 100% auditability of permission assignments per clinic role
  • Anti-IDOR guarantees across all API endpoints and server actions
#RBAC #Anti-IDOR #Multi-Tenant #Security #Prisma
// Workflow Architecture

Contract-First & Loop Engineering

Compare traditional feature delivery against high-leverage Contract-First design and autonomous Loop Engineering.

Workflow Pattern 0% UX Rebuilds
01

Problem & Seam Framing

Identify whose pain it is and the real business constraint. Define what is NOT worth building.

02

Disposable UX Mockup & Schema

Validate UI ergonomics and data contracts (Zod/Pydantic) before touching production tables.

03

Stakeholder Consensus

Confirm actual clinician/user behavior on throwaway code. Adjust for zero cost.

04

Deterministic Production Build

Write production code once on top of locked contracts, covered by Playwright E2E suites.

// Get in Touch

Let's Build Resilient Systems & Products

Operating at the intersection of product discovery, autonomous AI tooling, and complex software architectures. Open to high-leverage Product Engineer roles, consulting, and collaboration.

© 2026 Marcos Souza · Product Engineer