openfda: Instructions file for Claude Code

CLAUDE.md

openfda CLAUDE.md is an instructions file for Claude Code from ythalorossy/openfda. It costs 8,785 tokens per session, scanned A, original, MIT.

Repository instructions for an OpenFDA Model Context Protocol server that queries drug information from the OpenFDA API. They document the project structure, required API key, commands, tests, and architecture.

In plain words
What is it for?
Use them when working on the OpenFDA server, especially for running builds, tests, type checks, linting, or investigating its TypeScript files and API handlers.
Why use it?
They give a coding agent the project-specific context needed to build, test, lint, and modify the server safely.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is ythalorossy/openfda's own configuration. It tells Claude Code how to work on openfda itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything openfda configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ythalorossy/openfda. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ythalorossy/openfda/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/ythalorossy/openfda

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for openfda CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/ythalorossy/openfda/claude-md/github.svg)](https://agentmods.dev/instructions/ythalorossy/openfda/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/ythalorossy/openfda/claude-md"><img src="https://agentmods.dev/badge/instructions/ythalorossy/openfda/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for openfda CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/ythalorossy/openfda/claude-md"><img src="https://agentmods.dev/badge/instructions/ythalorossy/openfda/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 8,785 This file is loaded in full into every session.
When invoked 8,785 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.08785 $0.08785
Opus 5.5 $0.03514 $0.03514
Sonnet 5.5 $0.01757 $0.01757
Haiku 4.5 $0.00878 $0.00878

Measured 1mo ago against content hash 323c2be11cb0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

openfda CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 193 lines

How it starts

The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is a Model Context Protocol (MCP) server that provides tools for querying drug information from the OpenFDA API. The server communicates over stdio and requires an OPENFDA_API_KEY environment variable.

Commands

npm run build      # Compile TypeScript to dist/
npm run build:cli  # Build + add shebang for bin entry (required for CLI)
npm run dev        # Start development server
npm run test       # Run Vitest tests
npm run test:ci    # Run tests in CI mode (no watch)
npm run typecheck  # TypeScript type checking
npm run lint       # Run ESLint
npm run smoke      # Manual end-to-end check against the built dist/ (hits the live API)
npm run probe:faers-codes  # Manual, live-API check that re-validates the FAERS code maps against openFDA's published field reference
npm run fields:sync      # Manual, live-API script that downloads FDA's published field reference and writes the committed src/catalog/drug-*.json files
npm run fields:coverage  # Manual, live-API script that measures what fraction of records populate each catalog field, writing src/catalog/drug-*.coverage.json
npm run fields:countable # Manual, live-API script that measures which declared count fields openFDA can actually aggregate, writing src/catalog/drug-*.countable.json
npm run probe:fields     # Manual, live-API script that checks every path every descriptor exposes actually returns data (not merely published)

For single test file: npx vitest run tests/ApiHandler.test.ts

.github/workflows/fields-drift.yml re-downloads FDA's field references every Monday and re-probes every exposed field, opening an issue on failure. It needs the OPENFDA_API_KEY repository secret. Run it by hand from the Actions tab after changing any descriptor's field list.

Key Files

  • vite.config.ts: Vite build configuration; externalizes the SDK for StdioServerTransport compatibility, and injects __APP_VERSION__ from package.json at build time so the version reported in serverInfo cannot drift from the published version
  • tests/: Vitest test suite (528 tests across 42 files: ApiHandler, bundle-size, catalog-conformance, catalog-coverage, catalog-shape, core/budget, core/codes, core/descriptor, core/envelope, core/escape, core/executor, core/http, core/project, core/query, core/registry, core/resources, core/strategy, datasets/drug-drugsfda, datasets/drug-enforcement, datasets/drug-event, datasets/drug-label, datasets/drug-ndc, datasets/drug-orangebook, datasets/drug-shortages, datasets/faers, docs-currency, drift-guard, env, faers-codes, format, label-fields, ndc, ndc-formats, no-raw-query, no-url-in-output, OpenFDABuilder, redact, registration, schema-budget, ToolManager, ToolManager.keyguard, version)
  • docs/superpowers/notes/2026-09-20-field-selection.md: The authoritative record of which fields each drug-* descriptor exposes in its field enum, and why — including every field that was seeded but deliberately dropped. No code reads this file; it is the rationale behind src/datasets/drug/*.ts.
  • scripts/capture-fixtures.mjs: Manual, live-API script that captures trimmed label fixtures into tests/fixtures/ (not run in CI)
  • scripts/smoke-local.mjs (npm run smoke): Manual end-to-end check that drives the built dist/index.js over stdio as a real MCP client would, asserting the behaviours the 1.1.0 through 2.0.0 fixes introduced. Hits the live API, so it is deliberately NOT part of npm test; run it after npm run build:cli and before publishing. npm run smoke -- --no-key exercises the missing-key path instead.
  • scripts/probe-faers-codes.mjs (npm run probe:faers-codes): Manual, live-API script that re-validates the FAERS code maps in src/datasets/drug/faers.ts (SERIOUSNESS, PATIENT_SEX, REACTION_OUTCOMES) against openFDA's published field reference (https://open.fda.gov/fields/drugevent.yaml). Hits the live API, so it is deliberately NOT part of npm test; run it whenever faers.ts's code maps change.
  • scripts/fields-sync.mjs (npm run fields:sync): Manual, live-API script that downloads openFDA's published field reference for every drug endpoint and writes the trimmed, committed src/catalog/drug-<endpoint>.json files — the offline source of truth tests/catalog-conformance.test.ts checks every descriptor path against.
  • scripts/fields-coverage.mjs (npm run fields:coverage): Manual, live-API script that asks openFDA how many records actually populate each catalog field (_exists_:<path>) and writes src/catalog/drug-<endpoint>.coverage.json. This is the evidence behind the exposed-field selection recorded in docs/superpowers/notes/2026-09-20-field-selection.md.
  • scripts/fields-countable.ts (npm run fields:countable): Manual, live-API script that asks openFDA whether every declared countFields path (and its .exact alternate) can actually be aggregated, and writes src/catalog/drug-<endpoint>.countable.json. Countability is a property of openFDA's index mapping with no derivable rule — of the 30 count fields declared at 2.0.0, 14 were rejected upstream while 16 near-identical ones were accepted — so it has to be measured and committed for tests/catalog-conformance.test.ts to guard offline. Unlike fields-sync.mjs, it derives its endpoint list from DRUG_ENDPOINTS rather than a hardcoded map, so a new group needs only the drug- filename prefix parameterized, not its slugs listed separately. Hits the live API, so it is deliberately NOT part of npm test; run it whenever a descriptor's countFields change, and weekly via fields-drift.yml.
  • scripts/probe-fields.ts (npm run probe:fields): Manual, live-API script that checks every path every DRUG_ENDPOINTS descriptor exposes (fields + countFields) with an _exists_:<path> count. tests/catalog-conformance.test.ts already proves a path is published, offline; this proves it is populated — a published-but-empty field presents as a valid search that always finds nothing, indistinguishable from absent data. Run through tsx against src/ directly, not dist/: vite.config.ts bundles a single dist/index.js with preserveModules: false, so dist/datasets/... does not exist for anything to import. Hits the live API, so it is deliberately NOT part of npm test; run it whenever a descriptor's fields or countFields change.

Read the full file on GitHub · 193 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +107 lines · +5,865 tokens per session 323c2be11cb0
  2. 1mo ago Changed · +8 lines · +1,235 tokens per session 63d2535f1317
  3. 1mo ago Changed · +9 lines · +875 tokens per session 60aa49fc8bd0
  4. 2mo ago First seen · 69 lines · 810 tokens per session scan A 3f5f84716447

Subscribe to this mod's changes

openfda CLAUDE.md is an instructions file published in the GitHub repository ythalorossy/openfda (4 stars, last pushed 1mo ago), licensed MIT. It adds 8,785 tokens to every session, about $0.0351 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

openfda CLAUDE.md compared with instructions from other repositories

openfda CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
openfda CLAUDE.mdythalorossy/openfdaInstructions file41mo agoMITA8,785Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,649GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode ai-customization.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA1,907GitHub Copilot