Audit codebases for cross-industry regulatory compliance across SOX, GDPR, HIPAA, PCI-DSS, CCPA/CPRA, FedRAMP, FISMA, COPPA, and FERPA. Use when the user asks whether a codebase meets GDPR, HIPAA, SOX, or PCI-DSS, or needs a compliance gap review before an audit or enterprise deal.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Regulatory Compliance?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tinh2-regulatory-compliance)
---
name: regulatory-compliance
description: "Audit codebases for cross-industry regulatory compliance across SOX, GDPR, HIPAA, PCI-DSS, CCPA/CPRA, FedRAMP, FISMA, COPPA, and FERPA. Use when the user asks whether a codebase meets GDPR, HIPAA, SOX, or PCI-DSS, or needs a compliance gap review before an audit or enterprise deal."
version: "2.0.3"
category: review
platforms:
- CLAUDE_CODE
---
Audit the codebase for cross-industry regulatory requirements: audit trails, data retention, access control, change management, regulatory reporting, breach notification, and whistleblower protections. Evaluate implementation correctness and gap coverage. Work autonomously.
INPUT: $ARGUMENTS (optional): a regulation or area to focus on (e.g. "GDPR data retention", "breach notification flow"); otherwise do a full cross-regulation review.
IMPORTANT: For every finding, cite the exact file path and line number. First determine which regulations actually apply to the project before auditing — do not flag requirements for non-applicable regulations. Score each regulation on a 0-100 scale. For each gap, specify the regulatory reference, the concrete risk (fine amount, audit failure, breach liability), and provide a prioritized remediation with effort estimate (S/M/L).
## PHASE 1: STACK DETECTION & REGULATORY SCOPE
1. Identify the stack from manifests (package.json, requirements.txt, go.mod, Cargo.toml, Gemfile, pom.xml, pubspec.yaml): frameworks, auth, ORM/database, cloud services, logging/audit infra (Winston, Pino, log4j, ELK, Datadog, Splunk, custom), access control libs (casbin, CASL, ory/keto, custom RBAC/ABAC), encryption (bcrypt, argon2, AES, KMS, TLS).
2. Determine applicable regulatory frameworks:
- Indicators: financial data -> SOX, PCI-DSS, GLBA; health data -> HIPAA, HITECH; EU personal data -> GDPR; CA personal data -> CCPA/CPRA; government contracts -> FedRAMP, FISMA, NIST 800-53; public company reporting -> SOX; payment processing -> PCI-DSS; children's data -> COPPA; education records -> FERPA.
- Also check compliance config files, docs, and regulatory references in comments.
- If no indicators found, review against a general compliance baseline
(SOX + GDPR + HIPAA as the broadest common set).
3. Build the compliance scope:
| Regulation | Applicability Signal | Key Requirements | Modules Affected |
|-----------|---------------------|-----------------|-----------------|
## PHASE 2: AUDIT TRAIL COMPLETENESS
AUDIT EVENT COVERAGE:
- Scan every endpoint, service method, and data mutation point.
- For each, check that an audit event records: who (user ID, role, IP), what (action, resource, fields changed), when (UTC timestamp), where (service, server ID, request ID), why (business justification, e.g. override reason), and outcome (success/failure/partial with error details).
- Flag data mutations without corresponding audit events.
- Flag authentication events without audit logging (login, logout, failed login,
password change, MFA enrollment, session creation/destruction).
AUDIT TRAIL INTEGRITY:
- Is the audit trail stored in an append-only manner? (no updates, no deletes).
- Is there separation between the application database and the audit store?
(prevents application admins from tampering with audit logs).
- Is there tamper detection? (hash chain, merkle tree, digital signatures, WORM storage).
- Are audit records encrypted at rest?
- Is there a separate backup of audit data?
- Can audit records be exported in a court-admissible format?
AUDIT TRAIL RETENTION:
- How long are audit records retained?
- Meets minimums? SOX 7 years (financial records); HIPAA 6 years; GDPR purpose-limited (security audit logs exempt from deletion); PCI-DSS 1 year; otherwise 3-7 years by jurisdiction.
- Is there an automated retention/purge policy? Or do logs grow unbounded?
- Are purged records documented? (what was purged, when, by what policy).
AUDIT SEARCH & REPORTING:
- Can audit trails be searched by user, resource, time range, action type?
- Can audit trails be exported for external auditors?
- Are there pre-built compliance reports? (who accessed what data in a time range,
all admin actions, all data deletions).
- Is there real-time alerting on suspicious audit patterns?
| Audit Area | Events Logged | Integrity | Retention | Searchable | Score |
|-----------|-------------|-----------|-----------|-----------|-------|
## PHASE 3: DATA RETENTION & LIFECYCLE
RETENTION POLICY IMPLEMENTATION:
- Is there a documented data retention policy? Where is it defined?
- Per data category: retention period, legal basis (regulation, business need, consent), deletion method (hard/soft delete, anonymization, aggregation), deletion trigger (time, event, user request).
- Are retention policies enforced automatically or manually?
- Is there a retention schedule job? What is its frequency?
DATA DELETION:
- Is deleted data truly gone from: database (hard vs soft delete), file storage (removed vs pending GC), backups (required for GDPR erasure), all cache layers, search indexes, log entries, and third-party systems?
- Is there a data lineage map showing everywhere a data element flows?
RIGHT TO ERASURE (GDPR Article 17):
- Is there a data subject deletion endpoint or workflow?
- Does the deletion cascade to all dependent records?
- Is the deletion verified? (post-deletion check that data is gone from all stores).
- Is the deletion logged? (paradox: must log that data was deleted without logging the data itself).
- Are exceptions handled? (legal hold, regulatory retention requirement overrides erasure).
DATA MINIMIZATION:
- Is only necessary data collected? (check forms, API payloads, database schemas).
- Are there fields collected but never used? (data hoarding).
- Is there data that persists beyond its stated purpose?
- Are analytics/tracking collecting more than needed?
| Data Category | Retention Period | Legal Basis | Deletion Method | Automated | Verified |
|--------------|-----------------|-------------|-----------------|-----------|---------|
## PHASE 4: ACCESS CONTROL (RBAC/ABAC)
ACCESS CONTROL MODEL:
- What model is implemented? (RBAC, ABAC, ACL, custom, none).
- Where are roles/permissions defined? (database, config file, code constants, external IdP).
- Are roles documented with their permission sets?
- Is there a role hierarchy? (admin > manager > user > guest).
RBAC IMPLEMENTATION:
- Are roles enforced at every access point? (API middleware, service layer, database layer).
- Can roles be assigned and revoked? Is revocation immediate?
- Are role assignments audited? (who granted what role, when, by what authority).
- Is there separation of duties? (no single role can both create and approve).
- Are there overprivileged roles? (roles with more permissions than needed).
- Is there a least-privilege analysis? (compare actual permission usage to granted permissions).
ABAC IMPLEMENTATION (if applicable):
- Which attributes drive decisions (role, department, location, time, classification, owner)?
- Are policies defined declaratively? (policy engine vs scattered if-statements).
- Are attribute sources trusted? (can users modify their own attributes to escalate access?).
- Are policies version-controlled and auditable?
PRIVILEGED ACCESS MANAGEMENT:
- How are admin/superuser accounts managed?
- Is there just-in-time (JIT) privileged access? (temporary elevation with expiry).
- Are privileged actions logged with enhanced detail?
- Is there multi-person approval for high-risk actions? (two-person rule).
- Are service accounts inventoried? (non-human accounts with elevated privileges).
- Are service account credentials rotated? How often?
ACCESS REVIEWS:
- Is there a periodic access review process? (quarterly, semi-annual, annual).
- Can the system generate an access review report? (who has access to what).
- Are orphaned accounts detected? (accounts for departed personnel).
- Is there automated de-provisioning? (integration with HR/identity systems).
| Access Control Area | Implementation | Gaps | Regulatory Alignment | Score |
|-------------------|---------------|------|---------------------|-------|
## PHASE 5: CHANGE MANAGEMENT & VERSION CONTROL
CODE CHANGE CONTROLS:
- Is there a formal change approval process? (PR reviews, approval gates).
- Are all changes tracked in version control? (no direct production edits).
- Is there branch protection? (cannot push directly to main/production branch).
- Are changes linked to tickets/requirements? (traceability).
- Are changes tested before deployment? (CI/CD pipeline with tests).
CONFIGURATION CHANGE CONTROLS:
- Are infrastructure-as-code changes reviewed and approved?
- Are database schema changes tracked in migration files?
- Are environment variable changes logged?
- Are feature flag changes audited? (who enabled what, when, for what population).
DEPLOYMENT CONTROLS:
- Is there a deployment approval workflow? (manual gate before production).
- Are deployments logged? (what was deployed, when, by whom, which commit).
- Is there a rollback mechanism? (can revert to previous version quickly).
- Are production access controls separate from development access?
EMERGENCY CHANGE PROCESS:
- Is there a documented emergency change process? (hotfix without full approval cycle).
- Are emergency changes retroactively reviewed?
- Are emergency changes audited with justification?
- Is the emergency process rate tracked? (frequent emergency changes indicate process problems).
SEGREGATION OF ENVIRONMENTS:
- Are development, staging, and production environments separated?
- Is production data not accessible from development environments?
- Are test data sets sanitized? (no real PII in test/dev environments).
| Change Control Area | Process Defined | Enforced | Audited | Regulatory Alignment |
|-------------------|----------------|----------|---------|---------------------|
## PHASE 6: REGULATORY REPORTING
FINANCIAL REPORTING (SOX):
- Are financial data transformations auditable? (every calculation traceable to source data).
- Are there controls around financial report generation? (approval workflow, reconciliation).
- Is there a control matrix? (which controls mitigate which risks).
- Are control test results tracked? (effective, ineffective, not tested).
PRIVACY REPORTING (GDPR/CCPA):
- Can the system generate a Record of Processing Activities (ROPA): categories, purposes, legal bases, recipients, retention?
- Can DSARs be fulfilled: locate all of a subject's data across stores, export portably (JSON, CSV), track the deadline (GDPR 30 days, CCPA 45 days)?
- Is there a Data Protection Impact Assessment (DPIA) for high-risk processing?
- Is consent management implemented? (capture, store, withdraw, prove consent).
HEALTH DATA REPORTING (HIPAA):
- Is there an accounting of disclosures capability?
(log every time PHI is shared outside the covered entity).
- Are Business Associate Agreements (BAA) tracked?
- Is there a risk assessment documented and current?
- Are workforce training records maintained?
SECURITY INCIDENT REPORTING:
- Incident classification (severity, category) and timelines (detection through lessons learned) tracked?
- Can the system generate the data needed for regulatory notification?
(number of records affected, types of data involved, remediation steps taken).
| Reporting Area | Capability | Automated | Timeline Tracked | Tested |
|---------------|-----------|-----------|-----------------|--------|
## PHASE 7: BREACH NOTIFICATION & INCIDENT RESPONSE
BREACH DETECTION:
- Automated detection of: unusual access (bulk exports, off-hours), failed-auth spikes, privilege escalation attempts, exfiltration indicators (large downloads, external transfers)?
- Are detection rules tunable? (thresholds, exclusions, false positive management).
- Is there real-time alerting vs batch detection?
BREACH NOTIFICATION PIPELINE:
- Is there a notification workflow that triggers when a breach is confirmed?
- Are timelines enforced? GDPR: 72h to supervisory authority; HIPAA: 60 days to individuals, annual to HHS for < 500 records; state laws vary (some 30 days); PCI-DSS: immediate to payment brands and acquiring bank.
- Pre-built templates per regulation/audience? Records of who was notified, when, and what was said?
- Is there a public disclosure mechanism? (website notice for large breaches).
INCIDENT RESPONSE:
- Is there a documented incident response plan in the codebase or linked documentation?
- Are incident response roles defined? (incident commander, communications, technical lead).
- Is there a containment mechanism? (disable compromised accounts, revoke tokens, isolate systems).
- Is there a forensic preservation capability? (snapshot systems before remediation destroys evidence).
- Are post-incident reviews tracked? (root cause, timeline, remediation, prevention).
WHISTLEBLOWER PROTECTIONS:
- Is there an anonymous reporting mechanism? (hotline, web form, email alias).
- Is reporter identity protected in the system? (not stored alongside the report,
or stored with access restricted to compliance officers only).
- Are reports tracked through investigation to resolution?
- Anti-retaliation monitoring? Records kept separate from general HR records?
- Is there an escalation path if the reported party is in management?
| Incident Feature | Implemented | Automated | Regulatory Timeline | Tested |
|-----------------|-------------|-----------|--------------------| -------|
## SELF-HEALING VALIDATION (max 2 iterations)
After producing the review, validate completeness and consistency:
1. Verify all required output sections are present and non-empty.
2. Verify every finding references a specific file or code location.
3. Verify recommendations are actionable (not vague).
4. Verify severity ratings are justified by evidence.
IF VALIDATION FAILS:
- Identify which sections are incomplete or lack specificity
- Re-analyze the deficient areas
- Repeat up to 2 iterations
## OUTPUT
Write the report using the template in `references/report-template.md` (read it before writing the report; if it is not installed locally, fetch https://raw.githubusercontent.com/tinh2/skills-hub-registry/main/review/regulatory-compliance/references/report-template.md ). Required sections: header (stack, scope, applicable regulations, overall score /100), compliance matrix (regulation x audit trail/retention/access control/reporting/breach notify, with score), findings summary by severity, critical findings (ID RC-NNN, severity, regulation, requirement reference, `file:line`, issue, impact, fix), audit trail coverage by data domain (CRUD + admin actions + integrity), access control assessment, data retention compliance table, breach notification readiness, and recommendations ranked by regulatory risk with effort S/M/L.
DO NOT:
- Provide legal advice or definitive regulatory interpretations -- this is a code review, not legal counsel.
- Assume all regulations apply to every project -- check for applicability signals first.
- Flag missing compliance features for regulations that do not apply to the project.
- Treat compliance as binary -- partial implementation still reduces risk and should be credited.
- Ignore compensating controls -- if one control is weak but another mitigates the same risk, note both.
- Overlook the human element -- technical controls without process documentation are incomplete.
- Recommend over-engineering compliance for early-stage projects with no regulatory obligation.
NEXT STEPS: `/security-review` (auth and data exposure), `/soc2` (SOC 2 Type II controls), `/gdpr` (GDPR deep dive), `/contract-risk` (audit trails vs contractual obligations), `/iterate` (implement fixes for critical gaps).
## SELF-EVOLUTION TELEMETRY
If a project memory directory exists under `~/.claude/projects/`, append to its `skill-telemetry.md` (skip silently otherwise):
```
### /regulatory-compliance — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
```