Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Healthcare Phi Compliance

  • 4.6k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/everything-claude-code

Implement three-layer healthcare data protection: classify PHI and PII, enforce Row-Level Security for access control, and maintain tamper-proof audit trails.

About

This skill provides patterns for protecting Protected Health Information (PHI) and Personally Identifiable Information (PII) in healthcare applications across HIPAA, GDPR, and DISHA jurisdictions. It covers three-layer protection: data classification (PHI vs PII identification), access control via Row-Level Security (RLS) for multi-facility isolation, and audit logging with tamper-proof insert-only policies. Developers use this when building patient record systems, APIs returning clinical data, or access control for clinical staff. Key workflows include schema tagging columns as PHI/PII, enforcing facility-level data isolation through RLS policies, logging access with opaque record IDs, and eliminating common leak vectors (error messages, console output, URL parameters, browser storage, service keys). Data classification framework distinguishing PHI (patient name, DOB, diagnoses, national IDs) from PII (clinician salary, vendor payments) Row-Level Security patterns for multi-facility isolation: doctors at Facility

  • Data classification framework distinguishing PHI (patient name, DOB, diagnoses, national IDs) from PII (clinician salary
  • Row-Level Security patterns for multi-facility isolation: doctors at Facility A cannot query Facility B patients
  • Tamper-proof audit trail design using insert-only policies; audit logs cannot be updated or deleted
  • Leak vector prevention: no PHI in error messages, console logs, URL parameters, localStorage, or service_role keys
  • Pre-deployment checklist covering RLS enablement, session timeout, API authentication, and cross-facility isolation veri

Healthcare Phi Compliance by the numbers

  • 4,641 all-time installs (skills.sh)
  • +224 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #133 of 2,203 Security skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

healthcare-phi-compliance capabilities & compatibility

Capabilities
classify phi and pii columns in healthcare schem · design multi tenant rls policies for facility is · build tamper proof audit logging with insert onl · prevent common data leak vectors in code review · generate pre deployment compliance checklists
Works with
postgres · supabase
Use cases
security audit · code review
Platforms
macOS · Windows · Linux
Runs
Runs locally
Pricing
Free
From the docs

What healthcare-phi-compliance says it does

Never include patient-identifying data in error messages thrown to the client. Log details server-side only.
healthcare-phi-compliance.md
npx skills add https://github.com/affaan-m/everything-claude-code --skill healthcare-phi-compliance

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4.6k
repo stars238k
Security audit3 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryaffaan-m/everything-claude-code

What it does

Implement HIPAA, GDPR, and DISHA-compliant data protection patterns for patient records, audit trails, and role-based access control in healthcare systems.

Who is it for?

Building patient record systems, clinical APIs, multi-tenant healthcare platforms, and systems requiring HIPAA or GDPR compliance.

Skip if: Non-healthcare applications or systems without sensitive personal or medical data.

When should I use this skill?

Designing database schemas for healthcare apps, implementing access control for clinical staff, building APIs returning patient data, or reviewing code for data exposure vulnerabilities.

What you get

Developers deploy healthcare systems with classified PHI columns, RLS policies isolating multi-facility data, opaque logging, and audit trails preventing data leaks.

  • Access-controlled PHI handlers
  • Audit trail and encryption patterns

By the numbers

  • Three protection layers: data classification, access control (RLS), and audit logging
  • Seven common PHI leak vectors documented: error messages, console output, URL parameters, browser storage, service keys,

Files

SKILL.mdMarkdownGitHub ↗

Healthcare PHI/PII Compliance Patterns

Patterns for protecting patient data, clinician data, and financial data in healthcare applications. Applicable to HIPAA (US), DISHA (India), GDPR (EU), and general healthcare data protection.

When to Use

  • Building any feature that touches patient records
  • Implementing access control or authentication for clinical systems
  • Designing database schemas for healthcare data
  • Building APIs that return patient or clinician data
  • Implementing audit trails or logging
  • Reviewing code for data exposure vulnerabilities
  • Setting up Row-Level Security (RLS) for multi-tenant healthcare systems

How It Works

Healthcare data protection operates on three layers: classification (what is sensitive), access control (who can see it), and audit (who did see it).

Data Classification

PHI (Protected Health Information) — any data that can identify a patient AND relates to their health: patient name, date of birth, address, phone, email, national ID numbers (SSN, Aadhaar, NHS number), medical record numbers, diagnoses, medications, lab results, imaging, insurance policy and claim details, appointment and admission records, or any combination of the above.

PII (Non-patient-sensitive data) in healthcare systems: clinician/staff personal details, doctor fee structures and payout amounts, employee salary and bank details, vendor payment information.

Access Control: Row-Level Security

ALTER TABLE patients ENABLE ROW LEVEL SECURITY;

-- Scope access by facility
CREATE POLICY "staff_read_own_facility"
  ON patients FOR SELECT TO authenticated
  USING (facility_id IN (
    SELECT facility_id FROM staff_assignments
    WHERE user_id = auth.uid() AND role IN ('doctor','nurse','lab_tech','admin')
  ));

-- Audit log: insert-only (tamper-proof)
CREATE POLICY "audit_insert_only" ON audit_log FOR INSERT
  TO authenticated WITH CHECK (user_id = auth.uid());
CREATE POLICY "audit_no_modify" ON audit_log FOR UPDATE USING (false);
CREATE POLICY "audit_no_delete" ON audit_log FOR DELETE USING (false);

Audit Trail

Every PHI access or modification must be logged:

interface AuditEntry {
  timestamp: string;
  user_id: string;
  patient_id: string;
  action: 'create' | 'read' | 'update' | 'delete' | 'print' | 'export';
  resource_type: string;
  resource_id: string;
  changes?: { before: object; after: object };
  ip_address: string;
  session_id: string;
}

Common Leak Vectors

Error messages: Never include patient-identifying data in error messages thrown to the client. Log details server-side only.

Console output: Never log full patient objects. Use opaque internal record IDs (UUIDs) — not medical record numbers, national IDs, or names.

URL parameters: Never put patient-identifying data in query strings or path segments that could appear in logs or browser history. Use opaque UUIDs only.

Browser storage: Never store PHI in localStorage or sessionStorage. Keep PHI in memory only, fetch on demand.

Service role keys: Never use the service_role key in client-side code. Always use the anon/publishable key and let RLS enforce access.

Logs and monitoring: Never log full patient records. Use opaque record IDs only (not medical record numbers). Sanitize stack traces before sending to error tracking services.

Database Schema Tagging

Mark PHI/PII columns at the schema level:

COMMENT ON COLUMN patients.name IS 'PHI: patient_name';
COMMENT ON COLUMN patients.dob IS 'PHI: date_of_birth';
COMMENT ON COLUMN patients.aadhaar IS 'PHI: national_id';
COMMENT ON COLUMN doctor_payouts.amount IS 'PII: financial';

Deployment Checklist

Before every deployment:

  • No PHI in error messages or stack traces
  • No PHI in console.log/console.error
  • No PHI in URL parameters
  • No PHI in browser storage
  • No service_role key in client code
  • RLS enabled on all PHI/PII tables
  • Audit trail for all data modifications
  • Session timeout configured
  • API authentication on all PHI endpoints
  • Cross-facility data isolation verified

Examples

Example 1: Safe vs Unsafe Error Handling

// BAD — leaks PHI in error
throw new Error(`Patient ${patient.name} not found in ${patient.facility}`);

// GOOD — generic error, details logged server-side with opaque IDs only
logger.error('Patient lookup failed', { recordId: patient.id, facilityId });
throw new Error('Record not found');

Example 2: RLS Policy for Multi-Facility Isolation

-- Doctor at Facility A cannot see Facility B patients
CREATE POLICY "facility_isolation"
  ON patients FOR SELECT TO authenticated
  USING (facility_id IN (
    SELECT facility_id FROM staff_assignments WHERE user_id = auth.uid()
  ));

-- Test: login as doctor-facility-a, query facility-b patients
-- Expected: 0 rows returned

Example 3: Safe Logging

// BAD — logs identifiable patient data
console.log('Processing patient:', patient);

// GOOD — logs only opaque internal record ID
console.log('Processing record:', patient.id);
// Note: even patient.id should be an opaque UUID, not a medical record number

Related skills

Forks & variants (1)

Healthcare Phi Compliance has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.

How it compares

Use for healthcare PHI engineering patterns; use cli-printing-press PII polish for CLI publish gate scrubbing, not clinical compliance design.

FAQ

What is PHI and how do I identify it?

PHI is any data that identifies a patient AND relates to their health: name, DOB, address, national ID, diagnoses, medications, lab results, insurance details, and appointment records.

How do I implement facility-level data isolation?

Use RLS policies to scope access by facility_id: staff can only SELECT patients where facility_id matches their assigned facilities via a staff_assignments lookup table.

Why should I use insert-only audit logs?

Insert-only policies prevent tampering: audit entries cannot be updated or deleted, creating an immutable record of who accessed or modified PHI and when.

Is Healthcare Phi Compliance safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Securityauditcompliance

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.