jg-exception
Errors
TypeScript packages for coding agents
Errors, HTTP requests, storage, files, processes, and more, as small packages that share one set of conventions. Each ships its full API reference, so your agent writes less code and you review less of it.
The packages
Each one does one job, with the same error handling, naming, and docs as the others. Pick the ones you need; siblings depend on each other only where it saves you code.
Typechecked against both runtimes, so they use only the globals both have.
Errors
API envelopes
Utilities
Decimal math
HTTP requests
Environment
For pages and service workers, and safe to import during server rendering.
Browser storage
Service workers
Clipboard
React hooks
Server data
React Router
For servers, command-line tools, and build scripts.
Filesystem
Child processes
PostgreSQL
Redis
NestJS
Crypto
Why agents use them
Agents write code faster than anyone can review it. Each package replaces code an agent would otherwise generate with code that's already tested, documented, and consistent with the rest.
Your agent imports a tested function instead of writing a new one, so there’s less code to generate, review, and maintain.
Every failure is an Exception with a stable code and JSON data. APIs send it in one envelope and jg-fetch reads it back, so code checks codes, not messages.
Every package ships its full API reference as API.md, and every export has TSDoc, so an agent reads the docs of the installed version from node_modules.
Every example in the docs typechecks against the published package, and the ones without I/O run on every release, with their stated results asserted.
Each release is packed and installed into a new project before it ships, and browser code is tested in Chromium, Firefox, and WebKit.
The same names, units in option names, ESM with types, and nothing running at import. An agent that knows one package knows how the others work.
Set up your agent
The policy tells your agent to prefer these packages, and the skill tells it which one fits each task. Both live in jg-skills, so they stay current as the packages change.
Step 1
A short ## jg-packages section that tells your agent to prefer these packages and to check the installed version's API.md before using an export. jg-skills keeps it current.
Step 2
It tells your agent which package fits a task, even before the package is installed.
npx skills add jesusgraterol/jg-skills --skill jg-packages -yDocs for agents
The same READMEs and API references you read here, as Markdown: inside each package, and on this site.
node_modules/<package>/API.mdThe full API reference of the installed version, shipped in every package, so it reads offline.
node_modules/<package>/RECIPES.mdApp-side patterns for the package, such as an API exception or a typed client, typechecked on every release.
An index of the packages in the llmstxt.org format, with a link to each package’s Markdown.
Every package’s README, API reference, and recipes in one file, for loading into a context window.
/packages/<name>/index.mdThe Markdown version of each page: a package’s README and its full API reference.
Accept: text/markdownRequest any page with this header to get its Markdown instead of HTML.
The source and the release process are on GitHub (opens in a new tab).