supabase
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
hipaa-guardian
This skill should be used when the user asks to "scan for PHI", "detect PII", "HIPAA compliance check", "audit for protected health information", "find sensitive healthcare data", "generate HIPAA audit report", "check code for PHI leakage", "scan logs for PHI", "check authentication on PHI endpoi...
Full skill instructions
A comprehensive PHI/PII detection and HIPAA compliance skill for AI agents, with a strong focus on developer code security patterns. Detects all 18 HIPAA Safe Harbor identifiers in data files and source code, provides risk scoring, maps findings to HIPAA regulations, and generates audit reports with remediation guidance.
/hipaa-guardian [command] [path] [options]
scan <path> - Scan files or directories for PHI/PIIscan-code <path> - Scan source code for PHI leakagescan-auth <path> - Check API endpoints for missing authentication before PHI accessscan-logs <path> - Detect PHI patterns in logging statementsscan-response <path> - Check API responses for unmasked PHI exposureaudit <path> - Generate full HIPAA compliance audit reportcontrols <path> - Check security controls in a projectreport - Generate report from existing findings--format <type> - Output format: json, markdown, csv (default: markdown)--output <file> - Write results to file--severity <level> - Minimum severity: low, medium, high, critical--include <patterns> - File patterns to include--exclude <patterns> - File patterns to exclude--synthetic - Treat all data as synthetic (default for safety)When invoked, follow this workflow:
Ask the user to specify:
Use Glob to find relevant files:
# For data files
Glob: **/*.{json,csv,txt,log,xml,hl7,fhir}
# For source code
Glob: **/*.{py,js,ts,tsx,java,cs,go,rb,sql,sh}
# For config files
Glob: **/*.{env,yaml,yml,json,xml,ini,conf}
For each file, scan for the 18 HIPAA identifiers using patterns from references/detection-patterns.md:
Classify each finding:
Calculate risk score (0-100) using methodology from references/risk-scoring.md:
Risk Score = (Sensitivity × 0.35) + (Exposure × 0.25) +
(Volume × 0.20) + (Identifiability × 0.20)
Map findings to HIPAA rules from references:
references/privacy-rule.md - 45 CFR 164.500-534references/security-rule.md - 45 CFR 164.302-318references/breach-rule.md - 45 CFR 164.400-414Create structured output following examples/sample-finding.json format:
{
"id": "F-YYYYMMDD-NNNN",
"timestamp": "ISO-8601",
"file": "path/to/file",
"line": 123,
"field": "field.path",
"value_hash": "sha256:...",
"classification": "PHI|PII|sensitive_nonPHI",
"identifier_type": "ssn|mrn|dob|...",
"confidence": 0.95,
"risk_score": 85,
"hipaa_rules": [...],
"remediation": [...],
"status": "open"
}
When scanning source code, look for:
.env files with PHISee references/code-scanning.md for detailed patterns.
Verify these controls are in place:
.gitignore excludes sensitive filesStructured array of all findings with full metadata.
Human-readable report with:
Step-by-step remediation guide:
references/hipaa-identifiers.md - All 18 HIPAA Safe Harbor identifiersreferences/detection-patterns.md - Regex patterns for PHI detectionreferences/code-scanning.md - Code scanning patterns and rulesreferences/privacy-rule.md - HIPAA Privacy Rule (45 CFR 164.500-534)references/security-rule.md - HIPAA Security Rule (45 CFR 164.302-318)references/breach-rule.md - Breach Notification Rule (45 CFR 164.400-414)references/risk-scoring.md - Risk scoring methodologyreferences/auth-patterns.md - Authentication gate patterns for PHI endpointsreferences/logging-safety.md - PHI-safe logging patterns and filtersreferences/api-security.md - API response masking and field-level authexamples/sample-finding.json - Example finding output formatexamples/sample-audit-report.md - Example audit reportexamples/synthetic-phi-data.json - Test data for validationscripts/detect-phi.py - PHI detection scriptscripts/scan-code.py - Code scanning scriptscripts/generate-report.py - Report generation scriptscripts/validate-controls.sh - Control validation scriptCRITICAL: Any code that exposes PHI MUST check authentication first.
# BAD: No authentication check before returning PHI
@app.route('/api/patient/<patient_id>')
def get_patient(patient_id):
patient = db.query(Patient).filter_by(id=patient_id).first()
return jsonify({
'name': patient.name,
'ssn': patient.ssn, # PHI exposed!
'dob': patient.dob, # PHI exposed!
'diagnosis': patient.diagnosis
})
# GOOD: Authentication + authorization + audit logging
@app.route('/api/patient/<patient_id>')
@require_auth # Authentication required
@require_role(['doctor', 'nurse']) # Role-based access
@audit_log('patient_access') # Audit trail
def get_patient(patient_id):
user = get_current_user()
# Verify user has access to THIS patient
if not user.can_access_patient(patient_id):
audit.log_unauthorized_access(user.id, patient_id)
abort(403)
patient = db.query(Patient).filter_by(id=patient_id).first()
# Log successful access
audit.log_phi_access(
user_id=user.id,
patient_id=patient_id,
action='view',
fields_accessed=['name', 'dob', 'diagnosis']
)
return jsonify({
'name': patient.name,
'dob': mask_date(patient.dob), # Mask when possible
'diagnosis': patient.diagnosis
# SSN excluded - minimum necessary
})
# BAD: PHI in logs - HIPAA violation
logger.info(f"Processing patient: {patient.name}, SSN: {patient.ssn}")
logger.debug(f"Patient DOB: {patient.date_of_birth}")
logger.error(f"Failed to process: {patient_record}") # Full record in logs!
# BAD: Exception with PHI in stack trace
try:
process_patient(patient_data)
except Exception as e:
logger.exception(f"Error processing {patient_data}") # PHI leaked!
# GOOD: Use identifiers only, never PHI values
logger.info(f"Processing patient_id={patient.id}")
logger.debug(f"Patient record hash: {hash_patient_id(patient.id)}")
# GOOD: Mask/redact sensitive data before logging
logger.info(f"Processing patient: {mask_name(patient.name)}, SSN: ***-**-{patient.ssn[-4:]}")
# GOOD: Structured logging with PHI filter
class PHIFilter(logging.Filter):
"""Filter that redacts PHI patterns from log messages."""
PHI_PATTERNS = [
(r'\b\d{3}-\d{2}-\d{4}\b', '[SSN-REDACTED]'),
(r'\b\d{2}/\d{2}/\d{4}\b', '[DOB-REDACTED]'),
(r'\b[A-Z]{2}\d{6,}\b', '[MRN-REDACTED]'),
]
def filter(self, record):
for pattern, replacement in self.PHI_PATTERNS:
record.msg = re.sub(pattern, replacement, str(record.msg))
return True
# Apply filter to all handlers
logging.getLogger().addFilter(PHIFilter())
// BAD: Full patient object returned without filtering
app.get('/api/patients/:id', (req, res) => {
const patient = await Patient.findById(req.params.id);
res.json(patient); // Exposes ALL fields including PHI!
});
// BAD: GraphQL without field-level auth
const PatientType = new GraphQLObjectType({
name: 'Patient',
fields: {
id: { type: GraphQLID },
ssn: { type: GraphQLString }, // No auth check!
diagnosis: { type: GraphQLString } // No auth check!
}
});
// GOOD: Explicit field selection with auth
app.get('/api/patients/:id', authenticate, authorize('view_patient'), async (req, res) => {
const patient = await Patient.findById(req.params.id)
.select('id name dateOfBirth') // Only select needed fields
.lean();
// Apply field-level masking based on role
const response = applyPHIMasking(patient, req.user.role);
// Audit log the access
await AuditLog.create({
userId: req.user.id,
action: 'patient_view',
resourceId: patient.id,
fieldsAccessed: Object.keys(response),
timestamp: new Date(),
ipAddress: req.ip
});
res.json(response);
});
// GOOD: GraphQL with field-level authorization
const PatientType = new GraphQLObjectType({
name: 'Patient',
fields: {
id: { type: GraphQLID },
ssn: {
type: GraphQLString,
resolve: (patient, args, context) => {
// Field-level auth check
if (!context.user.hasPermission('view_ssn')) {
auditLog.unauthorized(context.user.id, 'ssn_access');
return null;
}
auditLog.phiAccess(context.user.id, patient.id, 'ssn');
return maskSSN(patient.ssn); // Return masked
}
}
}
});
# BAD: Raw SQL with PHI in query strings
cursor.execute(f"SELECT * FROM patients WHERE ssn = '{ssn}'")
# BAD: Full record fetch without need
patient = Patient.query.get(patient_id) # Gets ALL columns
# BAD: PHI in error messages
try:
patient = get_patient(ssn)
except PatientNotFound:
raise ValueError(f"Patient with SSN {ssn} not found") # PHI in error!
# GOOD: Parameterized queries
cursor.execute("SELECT id, name FROM patients WHERE id = %s", (patient_id,))
# GOOD: Select only needed columns
patient = Patient.query.with_entities(
Patient.id,
Patient.name,
Patient.appointment_date
).filter_by(id=patient_id).first()
# GOOD: Safe error handling
try:
patient = get_patient(patient_id)
except PatientNotFound:
logger.warning(f"Patient lookup failed for id={patient_id}")
raise ValueError("Patient not found") # No PHI in message
// BAD: PHI in browser console/state
console.log('Patient data:', patientData);
// BAD: PHI in localStorage
localStorage.setItem('currentPatient', JSON.stringify(patient));
// BAD: PHI visible in React DevTools
const [patient, setPatient] = useState(fullPatientRecord);
// GOOD: Never log PHI
if (process.env.NODE_ENV === 'development') {
console.log('Patient loaded:', { id: patient.id }); // ID only
}
// GOOD: Session storage with encryption (if needed at all)
const encryptedData = encrypt(JSON.stringify(minimalData));
sessionStorage.setItem('session_data', encryptedData);
// GOOD: Minimal state, masked display
const [patient, setPatient] = useState({
id: data.id,
displayName: maskName(data.name),
// No SSN, full DOB, or diagnosis in state
});
// GOOD: Mask PHI in UI
function PatientCard({ patient }) {
return (
<div>
<p>Name: {patient.displayName}</p>
<p>DOB: **/**/****</p> {/* Masked by default */}
<button onClick={() => revealWithAuth()}>Reveal DOB</button>
</div>
);
}
When reviewing code, check for these anti-patterns:
SCAN FOR: API endpoints without @require_auth, authenticate, or auth middleware
RISK: Unauthenticated PHI access
SEVERITY: Critical
SCAN FOR: logger.*, console.log, print() containing patient.*, ssn, dob, mrn
RISK: PHI in log files, SIEM systems
SEVERITY: High
SCAN FOR: res.json(patient), return patient.*, jsonify(patient)
RISK: Full PHI objects exposed
SEVERITY: High
SCAN FOR: raise.*{patient, raise.*{ssn, throw.*patient
RISK: PHI in error logs and responses
SEVERITY: High
SCAN FOR: Real SSN/DOB patterns in /test/, /spec/, fixtures/
RISK: Real PHI in source control
SEVERITY: Critical
SCAN FOR: PHI access without audit.log, AuditLog.create
RISK: No access trail for compliance
SEVERITY: Medium
SCAN FOR: localStorage.setItem.*patient, sessionStorage.*ssn
RISK: PHI persisted in browser
SEVERITY: High
IF code_accesses_phi() THEN
require_authentication()
check_authorization()
log_access_to_audit()
mask_output()
never_log_phi_values()
END
| Check | Python Example | JavaScript Example |
|---|---|---|
| Auth | @require_auth | authenticate() middleware |
| Authz | @require_role(['doctor']) | authorize('view_patient') |
| Audit | audit.log_access(user, patient_id) | AuditLog.create({...}) |
| Mask | mask_ssn(patient.ssn) | maskPHI(data) |
| ❌ Never | Why It's Bad | ✅ Instead |
|---|---|---|
logger.info(f"Patient: {patient}") | PHI in logs | logger.info(f"patient_id={patient.id}") |
return jsonify(patient) | Full PHI exposed | return jsonify(mask_phi(patient)) |
raise Error(f"SSN {ssn} invalid") | PHI in errors | raise Error("Invalid identifier") |
localStorage.setItem(patient) | PHI in browser | Use session-only + encrypt |
GET /patient/:id without auth | Public PHI | Add @require_auth |
# Anti-patterns to search for in code review:
DANGEROUS_PATTERNS = [
# PHI in logs
r'(log|print|console)\.(info|debug|error|warn).*patient',
r'(log|print|console)\.(info|debug|error|warn).*(ssn|dob|mrn)',
# Unprotected endpoints
r'@(app|router)\.(get|post|put).*patient.*\n(?!.*@require_auth)',
# PHI in error messages
r'raise.*Exception.*\{.*patient',
r'throw.*Error.*patient',
# Client storage
r'localStorage\.setItem.*patient',
r'sessionStorage\.setItem.*ssn',
# Full object returns
r'return.*jsonify\(patient\)',
r'res\.json\(patient\)',
]
"""Template for PHI-safe endpoint."""
from auth import require_auth, require_role
from audit import audit_log
from masking import mask_phi
@app.route('/api/patient/<patient_id>')
@require_auth # 1. Authentication
@require_role(['doctor', 'nurse']) # 2. Authorization
@audit_log('patient_access') # 3. Audit logging
@rate_limit(100, per='hour') # 4. Rate limiting
def get_patient(patient_id):
user = get_current_user()
# 5. Resource-level authorization
if not user.can_access_patient(patient_id):
audit.log_unauthorized(user.id, patient_id)
abort(403)
# 6. Minimum necessary - select only needed fields
patient = Patient.query.with_entities(
Patient.id,
Patient.name,
Patient.appointment_date
).filter_by(id=patient_id).first()
# 7. Mask before return
return jsonify({
'id': patient.id,
'name': mask_name(patient.name),
'appointment': patient.appointment_date.isoformat()
})
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.
Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
Send, read, and manage Gmail messages, drafts, labels, and account settings.
Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.
Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.
Discover your celebrity doppelgänger with StarByFace!
GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams
Detect AI-generated voices to protect against audio fraud.
Ensure Your Content's Originality with AI Plagiarism Checker
Upscale images by 400% without quality loss
Protect your social media from copyright disputes
Accurately Detect AI-Generated Content with TheChecker.AI
Chrome extension that detects and flags AI-generated content