Agent Instructions — FedSpeak
Context
FedSpeak is a Federal Acronym Decoder maintained by MetaPhase. The core data lives in src/shared/data/acronyms.json. The API runs as Netlify Functions, the website is Vite + React.
When Adding Acronyms
- Read the existing file first —
src/shared/data/acronyms.jsonhas 600+ entries. Do not create duplicates. - Follow the exact schema:
"ACRONYM": { "full": "Full Name", "description": "Brief 1-2 sentence description.", "agency": "Parent agency acronym or 'General'", "category": "department|agency|office|bureau|program|process|regulation|system|general" } - Optional fields:
url(official website),aliases(alternate spellings/abbreviations) - Keep keys sorted alphabetically in the JSON file.
- Descriptions should be concise — what the thing IS or DOES, not its full history.
- Agency field — use the parent department acronym (e.g.,
"DOD"for DISA,"DHS"for TSA,"General"for cross-cutting terms). - Category choices:
department— Cabinet-level departments (DOD, HHS, etc.)agency— Independent agencies or major sub-agenciesoffice— Named offices within agenciesbureau— Named bureaus within departmentsprogram— Government programs (SNAP, TRICARE, etc.)process— Acquisition processes, reviews, milestonesregulation— Laws, acts, regulations, standardssystem— IT systems, databases, platformsgeneral— Everything else (titles, terms, concepts)
When Modifying Code
- Run
npm run lint && npm run typecheck && npm run test:runbefore committing. - The shared logic in
src/shared/is used by the API functions, the website, and the npm package. - Changes to
types.tsaffect all three consumers. - The
truncate.tsmodule has function overloads for both DecodeResponse and EncodeResponse.
When Working on the API
- Functions are in
netlify/functions/using Netlify Functions v2 format. - Both decode and encode support GET (query params) and POST (JSON body).
- Always include CORS headers in responses.
- Responses are progressively truncated to stay under 2000 chars (handled by truncate).
When Working on the Website
- React 18 + React Router 7 + Tailwind 3.4
- Components in
src/components/, pages insrc/pages/ - The TryItDemo component uses the decoder directly (client-side), not the API.
- Swagger UI is loaded from CDN in ApiReference.tsx.
Git Workflow
- Work in
devbranch (default). - PR to
mainfor production deploys to Netlify. - Commit messages: imperative mood with prefix (
feat:,fix:,docs:,chore:).