Vibe Coding Isn't Production Ready for Patients. Here's the Checklist.

A vibe coding production-ready checklist for patient apps: PHI leak tests, WCAG 2.1 AA in CI, SMART auth expiry and stale-data states.

Clint JohnsonPublished 8 min read

Key takeaways

  • A vibe-coded patient app isn't production ready until PHI leaks, WCAG 2.1 AA, SMART auth and failure states are enforced by lint rules and CI tests, not reminders.
  • Test for PHI after logout with a synthetic canary patient, and search web storage, IndexedDB, Cache Storage, the query cache, URLs and page titles for it.
  • Never show a stale med list as current, and track the share of agent PRs that pass every gate before a human looks.

Karpathy built HackerTube in about two hours with Claude. It gives "excellent recs without any logins" because, in his words, "state is kept in local browser session." For a list of Hacker News videos, that's the right call. Copy the same pattern into a patient portal and you've built a PHI leak.

That's my problem with vibe coding for patients. The speed is real. The agent can build the app. It can't decide the app is done. For anything a patient logs into, done means the app passes checks it can't argue with. Every one of those checks is a lint rule or a CI test. A reminder in a README doesn't count.

Vibe-coded apps already leak at scale. A March 2025 scan of 1,645 apps from Lovable's showcase found 170 leaking user data because Supabase row-level security was off. That was a backend miss. The front end has its own list.

I run agents the same way I run my support loop. The agent opens the PR, waits on the real gates and never merges. Merging is mine. For a patient-facing React front end, here are the gates.

The production-ready checklist starts with PHI in the browser

PHI leaks from the browser in five places:

  • Web storage. localStorage and sessionStorage. Agents reach for them because they're easy and the demo works.
  • The query cache. React Query or SWR holds every patient response in memory. If the agent wired up a persister, those responses also land in web storage or IndexedDB. Unless logout clears both, the next person at a shared family laptop hits Back and sees a med list.
  • Session replay. Replay tools like Sentry and LogRocket record the screen, and on a portal the screen is the chart. HHS names session replay scripts as tracking technology. What gets masked depends on your version and config, so don't trust a default you haven't read. My preference: don't load replay on authenticated pages at all.
  • Pixels and analytics. HHS says trackers on authenticated pages like a patient portal "generally have access to PHI". That can include IP address, MRN, appointment dates, diagnosis and prescriptions. A vendor receiving that data is a business associate and needs a BAA. The 2024 AHA v. Becerra ruling only vacated the part about unauthenticated public pages. Logged-in portal pages are untouched.
  • URLs and page titles. /patients/Jane-Doe/hiv-results lands in browser history, server logs and referrer headers. A title like "Jane Doe – Lab Results" shows up in tabs and screen shares.

Lint stops the first two before the code exists:

// eslint.config.js (excerpt)
const msg = 'No PHI or tokens in web storage.';
export default [{
  rules: {
    'no-restricted-globals': ['error',
      { name: 'localStorage', message: msg },
      { name: 'sessionStorage', message: msg }],
    'no-restricted-properties': ['error',
      { object: 'window', property: 'localStorage', message: msg },
      { object: 'window', property: 'sessionStorage', message: msg },
      { object: 'document', property: 'title', message: 'Use safeTitle().' }],
    'no-restricted-imports': ['error', { paths: [
      '@tanstack/query-sync-storage-persister',
      '@tanstack/query-async-storage-persister',
      '@tanstack/react-query-persist-client'] }],
  },
}];

Lint can't see what happens at runtime. So the other check is a test. Seed a synthetic patient with a name nobody real has. Log in, load PHI, log out, then go looking for the name:

// e2e/phi-after-logout.spec.ts
const CANARY = 'Zzcanary'; // synthetic patient in the sandbox EHR

test('no PHI survives logout', async ({ page }) => {
  await loginAsSyntheticPatient(page);
  await page.goto('/medications');
  await expect(page.getByText(CANARY)).toBeVisible();
  expect(page.url()).not.toContain(CANARY);
  expect(await page.title()).not.toContain(CANARY);

  await page.getByRole('button', { name: 'Sign out' }).click();
  // helper: serializes web storage, every IndexedDB store, Cache Storage bodies
  const left = await dumpBrowserStorage(page);
  expect(left).not.toContain(CANARY);

  await page.goBack(); // in-memory query cache
  await expect(page.getByText(CANARY)).toHaveCount(0);
});

The test searches contents, not counts. If the app uses IndexedDB or a service worker cache for something harmless, it still passes. If the canary shows up anywhere, it fails.

I've seen a front-end PHI leak at a client we consulted for, not in my own code. I don't trust a reviewer skimming a diff to catch this class of bug. I trust a test that checks the real browser after logout on every PR.

One more trap. Whether the coding agent runs under a BAA tells you nothing about what the app it wrote sends to a pixel. Covered isn't compliant.

For healthcare organizations that take HHS money, accessibility is a legal requirement. The HHS Section 504 rule took effect July 8, 2024, and adopts WCAG 2.1 AA for websites and mobile apps. OCR pushed the technical deadline back a year in May 2026. It is now May 11, 2027 for recipients with 15 or more employees, and May 2028 for smaller ones. Sources differ on the exact day for smaller recipients, so check the Federal Register notice. The extension moved one date. The non-discrimination obligation already applies.

Agent-built UIs fail this in predictable ways. Clickable divs instead of buttons. Modals that trap focus or drop it on the body. Form errors shown in red text that a screen reader never announces. The demo looks fine because nobody demos with a keyboard.

Two things go in the agent's definition of done:

  1. axe in CI. Run @axe-core/playwright on every route with the wcag2a, wcag2aa, wcag21a and wcag21aa tags. Fail the build on any violation from day one. Don't start with "warn." Warnings pile up and turn into wallpaper.
  2. Keyboard and screen-reader smoke tests. axe catches what a machine can see. It can't tell you whether focus lands somewhere sensible after a dialog closes. Write Playwright tests that log in, fill the intake form and submit using only the keyboard. Assert that each error message is linked to its field and announced through a live region.

SMART auth: PKCE, no tokens in storage, and expiry mid-form

SMART App Launch v2.2.0 is blunt about PKCE. All apps SHALL support it, and servers must support S256 and must not support plain. An agent that copies an older tutorial may write a flow without it. Add a test that inspects the authorize request and fails without code_challenge_method=S256.

Tokens never go in localStorage. The lint rule above already blocks it. Keep access tokens in memory, or better, behind a backend that holds them in an httpOnly cookie session.

Then there's the problem demos never hit: the token dies while a patient is halfway through a long form. Years ago this was a big problem for us. The fix we landed on was getting permission to use longer-lived tokens. That was a policy win, not an engineering fix. I'd still build the expiry path as if I'd never get it, because tokens still expire:

  • Refresh silently before expiry. When refresh fails, say so plainly. Don't throw a generic error.
  • Decide where the draft lives before the token dies. Memory survives a silent refresh. It does not survive a full-page redirect to the authorization server. If the draft has to survive re-auth, save it server-side under the user's session. Not in web storage.
  • Test it. Force-expire the token mid-form and assert the patient's answers are still there after they sign back in.

Never show a stale med list as current

Agents build the happy path because the happy path is what the prompt describes. A real portal sits in front of an EHR that is sometimes slow and sometimes down, and the patient is sometimes on hospital Wi-Fi.

The dangerous case is a screen that looks fine. Stale-while-revalidate is a great default for a video site. On a med list, it means a failed refetch quietly leaves yesterday's list on screen looking current. If a medication was stopped this morning, that's a patient safety problem.

The rules I'd hold an agent to:

  • Error boundaries per panel, not per app. A failed allergies call shouldn't blank the whole chart. It also shouldn't render an empty list, because "no allergies" and "couldn't load allergies" mean very different things.
  • Show freshness on clinical data. TanStack Query gives you dataUpdatedAt and isRefetchError. Render them. "As of 9:14 AM. We couldn't refresh this list." is honest. A silent cached list is not.
  • Slow and offline are states. After 3 seconds, tell the patient the record system is slow. Offline, show what's cached, marked as cached, and block anything that writes.
  • Test the failures. Use Playwright route interception to return a 503 or a 20-second delay from the FHIR endpoint. Assert the stale-data banner appears and that empty-list text never renders on an error.

Package the checklist as a Skill the agent runs itself

None of this means slowing down. It means you move fast in the right direction, and that only works if no human has to remember to run the checks. Put them where the agent can run them before it asks for review: a Skill at .claude/skills/patient-frontend-gates/SKILL.md. It tells the agent to run the lint rules, the axe pass, the PHI-after-logout test, the expiry and failure-state tests, and a network egress allowlist:

// e2e/fixtures.ts — every e2e test fails on unapproved egress
const ALLOWED = new Set(['portal.example.org', 'fhir.example-ehr.org']);
let blocked: string[];

test.beforeEach(({ page }) => {
  blocked = [];
  page.on('request', (req) => {
    const u = new URL(req.url());
    if (u.protocol.startsWith('http') && !ALLOWED.has(u.hostname)) blocked.push(u.hostname);
  });
});
test.afterEach(() => expect(blocked).toEqual([]));

The allowlist is how a pixel or a replay script gets caught, whatever its masking settings. Adding a new host is a one-line change in a PR, and that change is exactly what a human should review. A host nobody approved never gets in quietly.

It's the same principle as Claude Code for FHIR and HL7v2: the agent doesn't get to say done. The checks do.

The number to watch

Track the share of agent PRs that pass every gate before a human looks. Make it countable. Have the Skill end every run by posting one line to the PR: each gate, pass or fail. Tally it weekly.

The gate that fails most tells you where the agent needs better instructions. If the pass rate isn't climbing, fix the Skill or the prompts. If it's high and review still finds problems, you're missing a gate. Write it, and add it to the Skill.

Questions people ask

Is vibe coding production ready for healthcare apps?

Not by default. An agent can build the app, but lint rules and CI tests should decide when it's done: PHI leak checks, axe accessibility checks, SMART auth and expiry tests, and failure-state tests.

Where do React apps leak PHI in the browser?

In localStorage and sessionStorage, in a React Query or SWR cache that outlives logout, in session replay tools, in analytics and tracking pixels, and in URLs and page titles. HHS says trackers on authenticated pages like patient portals generally have access to PHI.

When do patient portals need to meet WCAG 2.1 AA under Section 504?

After OCR's May 2026 extension, the technical deadline is May 11, 2027 for HHS funding recipients with 15 or more employees and May 2028 for smaller ones. Sources differ on the exact day for smaller recipients, so check the Federal Register notice. The non-discrimination obligation already applies.

Does SMART on FHIR require PKCE?

Yes. SMART App Launch v2.2.0 says all SMART apps SHALL support PKCE, and servers must support S256 and must not support the plain method.