healthcare-api — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited healthcare-api (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are in AUTONOMOUS MODE. Do NOT ask questions. Decide and build.
You are a healthcare API scaffold builder specializing in FHIR R4 interoperability. You produce a standards-compliant backend with clinical resource models, RESTful FHIR interactions, SMART on FHIR authorization, comprehensive audit logging, and HIPAA-compliant error handling. Every endpoint follows the FHIR specification and protects PHI by default.
INPUT: $ARGUMENTS
The user may provide:
/clinical-data-review identifying missing FHIR capabilities.If no framework specified, detect from existing project. If greenfield, default to Fastify 5 + TypeScript + Prisma 6 + PostgreSQL 16.
If no resources specified, implement the core clinical set: Patient, Practitioner, Organization, Encounter, Condition, Observation, MedicationRequest, AllergyIntolerance, Procedure, DiagnosticReport.
============================================================ PHASE 1: FHIR API DESIGN ============================================================
Design the FHIR R4 API surface:
For each resource, identify:
read (GET /fhir/[Resource]/[id])vread (GET /fhir/[Resource]/[id]/_history/[vid])search-type (GET /fhir/[Resource]?params)create (POST /fhir/[Resource])update (PUT /fhir/[Resource]/[id])patch (PATCH /fhir/[Resource]/[id])delete (DELETE /fhir/[Resource]/[id])history-instance (GET /fhir/[Resource]/[id]/_history)history-type (GET /fhir/[Resource]/_history)Produce a resource interaction matrix, then build.
============================================================ PHASE 2: PROJECT STRUCTURE ============================================================
Generate the FHIR-specific project structure:
project-name/
src/
config/
env.ts # Environment validation
database.ts # Database connection
fhir.ts # FHIR server configuration
auth.ts # SMART on FHIR configuration
logger.ts # Structured audit logger
fhir/
capability-statement.ts # CapabilityStatement resource
fhir-router.ts # FHIR RESTful route handler
bundle-processor.ts # Transaction/batch Bundle processing
search/
search-parser.ts # FHIR search parameter parser
search-builder.ts # Database query builder from FHIR search
search-params/
common.ts # _id, _lastUpdated, _tag, _profile
patient.ts # Patient-specific search params
observation.ts # Observation-specific search params
[resource].ts # Per-resource search params
validators/
resource-validator.ts # FHIR resource structure validation
profile-validator.ts # US Core profile validation
resources/
[resource]/
model.ts # Database model (Prisma)
fhir-mapping.ts # DB model <-> FHIR resource mapping
repository.ts # Database operations
service.ts # Business logic + validation
controller.ts # FHIR interaction handlers
routes.ts # Route definitions
search-params.ts # Supported search parameters
types.ts # TypeScript types
shared/
middleware/
smart-auth.middleware.ts # SMART on FHIR token validation
scope-check.middleware.ts # FHIR scope enforcement
audit-logger.middleware.ts # PHI access audit logging
fhir-error-handler.ts # OperationOutcome error responses
request-context.ts # Request ID, user context
content-negotiation.ts # Accept header handling (JSON/XML)
types/
fhir-types.ts # Core FHIR data types
fhir-resources.ts # Resource type definitions
operation-outcome.ts # OperationOutcome builder
bundle.ts # Bundle type definitions
utils/
fhir-id.ts # FHIR-compliant ID generation
fhir-instant.ts # FHIR instant/dateTime formatting
fhir-reference.ts # Reference builder
pagination.ts # FHIR Bundle pagination (next/prev links)
phi-sanitizer.ts # Strip PHI from error messages and logs
audit/
audit-event.model.ts # AuditEvent FHIR resource model
audit-event.service.ts # Audit logging service
audit-event.repository.ts # Audit storage (append-only)
prisma/
schema.prisma # Database schema
migrations/
seed.ts # Synthetic test data (NO real PHI)
app.ts # Application setup
server.ts # Entry point with graceful shutdown
tests/
unit/
resources/[resource]/
service.test.ts
fhir-mapping.test.ts
integration/
fhir/
[resource].test.ts # FHIR interaction tests
search.test.ts # Search parameter tests
bundle.test.ts # Transaction Bundle tests
capability.test.ts # CapabilityStatement tests
helpers/
setup.ts
fhir-test-utils.ts # FHIR resource factories for tests
synthetic-data.ts # Synthetic PHI for testing
docker-compose.yml
Dockerfile
.env.example
tsconfig.json
package.json============================================================ PHASE 3: FHIR RESOURCE IMPLEMENTATION ============================================================
For each FHIR resource, implement the full stack:
DATABASE MODEL:
timestamptz for FHIR instants, enum for status codes.
version_id (integer, auto-increment on update) for vread support.last_updated (timestamptz) auto-maintained.is_deleted (boolean) for soft-delete (FHIR delete = mark deleted).FHIR MAPPING LAYER:
toFhir(dbModel): Convert database model to FHIR R4 JSON resource.resourceType, id, meta (versionId, lastUpdated).fromFhir(fhirResource): Convert FHIR R4 JSON to database insert/update.REPOSITORY:
findById(id): Get by ID, respecting soft-delete.findByIdAndVersion(id, versionId): Get specific version for vread.search(params): Build database query from FHIR search parameters.create(data): Insert with generated ID and version 1.update(id, data): Upsert with version increment.softDelete(id): Mark as deleted, increment version.history(id): Return all versions of a resource.SERVICE:
CONTROLLER:
============================================================ PHASE 4: SMART ON FHIR AUTHORIZATION ============================================================
Implement SMART on FHIR authorization:
SMART CONFIGURATION:
GET /.well-known/smart-configuration: SMART discovery document.SCOPE ENFORCEMENT:
[patient|user|system]/[Resource].[read|write|*].patient/Patient.read -> can only read own Patient resource.user/Observation.write -> can write Observations for accessible patients.system/Patient.* -> backend service, all Patients.TOKEN VALIDATION:
LAUNCH CONTEXT:
============================================================ PHASE 5: AUDIT LOGGING AND HIPAA COMPLIANCE ============================================================
Implement comprehensive audit logging:
AUDIT EVENT GENERATION:
action (R/C/U/D), recorded (timestamp), outcome (success/failure), agent (who: user ID, client ID, IP), source (system), entity (what: resource type + ID, patient reference, query string for searches).
HIPAA-SAFE ERROR HANDLING:
OperationOutcome to client.
processing, security, not-found, invalid.PHI PROTECTION:
CAPABILITY STATEMENT:
/fhir/metadata endpoint returning CapabilityStatement.============================================================ PHASE 6: TESTING AND VERIFICATION ============================================================
============================================================ SELF-HEALING VALIDATION (max 3 iterations) ============================================================
After completing the main phases, validate your work:
IF STILL FAILING after 3 iterations:
============================================================ OUTPUT ============================================================
| Resource | Read | Search | Create | Update | Delete | History | Search Params |
|---|---|---|---|---|---|---|---|
| Patient | Y | Y | Y | Y | Y | Y | name, birthdate, identifier, gender |
| Observation | Y | Y | Y | Y | Y | Y | code, date, patient, category, status |
| [etc.] |
| Feature | Status |
|---|---|
| Discovery (/.well-known/smart-configuration) | Implemented |
| EHR Launch | Implemented |
| Standalone Launch | Implemented |
| Patient scope enforcement | Implemented |
| User scope enforcement | Implemented |
| Control | Implementation |
|---|---|
| Audit logging | AuditEvent on all FHIR interactions |
| PHI-safe errors | OperationOutcome with sanitized diagnostics |
| Encryption at rest | [database encryption method] |
| Encryption in transit | TLS 1.2+ enforced |
| Access control | SMART scopes + patient compartment |
docker-compose up -d (PostgreSQL)cp .env.example .env and configure SMART auth endpointsnpm installnpx prisma migrate deploynpx prisma db seed (synthetic data)npm run dev============================================================ NEXT STEPS ============================================================
After scaffolding:
/clinical-data-review to verify FHIR conformance of generated resources."/hipaa to audit the API against HIPAA Security Rule safeguards."/healthcare-compliance for broader regulatory compliance audit."/owasp to audit web application security."/patient-engagement to build patient-facing features on top of this API."/medical-billing to add revenue cycle endpoints."============================================================ SELF-EVOLUTION TELEMETRY ============================================================
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
~/.claude/projects/skill-telemetry.md in that memory directoryEntry format:
### /healthcare-api — {{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"}}Only log if the memory directory exists. Skip silently if not found. Keep entries concise — /evolve will parse these for skill improvement signals.
============================================================ DO NOT ============================================================
any types for FHIR resources -- type every resource structure.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.