# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Repository Overview This is TripSit's Drug Database - a comprehensive harm reduction resource containing drug information, dosages, and drug combination safety data. The repository serves as both a TypeScript library and a data source for TripSit's combo chart and other harm reduction tools. ## Core Data Files - `drugs.json` - Primary drug database with detailed information for each substance - `combos.json` - Drug combination safety data and interactions - `combo_definitions.json` - Definitions for combination safety levels - `translations/` - Internationalization files for multiple languages - `schemas/` - JSON schemas for data validation ## Development Commands - `npm run compare` - Compare and sync data between combos.json and drugs.json - `npx ts-node ./scripts/combosToDrugs.ts` - Run the data synchronization script locally - `npx ts-node ./scripts/combosToDrugs.ts --github-check` - Validate data for CI (used in GitHub Actions) ## Architecture ### Data Synchronization The core architecture revolves around maintaining consistency between `combos.json` and `drugs.json`. The `scripts/combosToDrugs.ts` script ensures: - Bidirectional consistency of drug combination interactions - Alphabetical ordering of all JSON data - Schema validation using AJV with JSON schemas - Automatic updates to drugs.json when combos.json changes ### TypeScript Structure - `types/tripsit.d.ts` - TypeScript definitions for all data structures - `scripts/index.ts` - Main export file for the library - TypeScript configuration targets ES2022 with strict mode enabled - Compiles to `build/` directory ### Validation Pipeline The repository uses a three-tier validation system: 1. Schema validation against JSON schemas in `schemas/` 2. Alphabetical ordering validation for consistent data structure 3. Data consistency validation between combos.json and drugs.json ## GitHub Integration ### Continuous Integration - `.github/workflows/validate.yml` - Runs validation on all PRs - Automatically assigns PRs to @LunaUrsa - Uses Node.js 21 for validation ### VS Code Configuration - JSON schema integration for real-time validation of data files - Custom spell checker dictionary with drug/chemistry terminology - Configured file associations for combos.json, drugs.json, and combo_definitions.json ## Important Notes - All data changes require reliable sources (studies, .edu/.gov sites, PubMed, books, journals) - Changes should be made via pull requests with proper citations - The data synchronization script must pass before merging - Maintain alphabetical ordering in all JSON files - Drug combination safety is the primary focus for new additions ## Contributing Workflow 1. Make changes to appropriate JSON files 2. Run `npm run compare` to sync data and validate 3. Ensure all validation passes before committing 4. Reference reliable sources in PR descriptions 5. Follow the established JSON schema structure