Skip to main content
jg-packages

Search

    TypeScript packages for coding agents

    Give your coding agenttested code to build on.

    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.

    View all 18 packages

    The packages

    One job each, one set of conventions.

    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.

    Browsers and Node.js

    Typechecked against both runtimes, so they use only the globals both have.

    • Coded errors for every jg package: an Exception with a stable code and JSON data, message extraction, code checks, and test assertions.
      v1.5.0Universal
    • jg-api-response

      API envelopes

      Build and recognise the success, data, and error envelope that services exchange over HTTP, with errors as a code, a message, and data.
      v1.1.1Universal
    • jg-utilities

      Utilities

      Validations, formatters, secure random generators, pagination cursors, and collection, async, and environment helpers.
      v1.4.0Universal
    • jg-bignumber

      Decimal math

      Exact decimal math on bignumber.js: rounding modes, formatting, and financial calculations such as percentage changes.
      v1.4.0Universal
    • jg-fetch

      HTTP requests

      A fetch wrapper that never throws: timeouts, retries that honour Retry-After, response size caps, and API envelopes.
      v0.3.0Universal
    • jg-env

      Environment

      Strict environment variable readers for process.env or import.meta.env, plus secret files, with errors that name the key and never the value.
      v0.1.1Universal

    Browsers and workers

    For pages and service workers, and safe to import during server rendering.

    • jg-storage

      Browser storage

      Typed key-value stores over localStorage, sessionStorage, IndexedDB, and memory, for pages and workers alike.
      v1.1.1Browser
    • jg-sw

      Service workers

      A generated caching worker with a Vite plugin and CLI, plus registration, updates that reload once, and app installation.
      v1.4.0BrowserNode.js
    • jg-clipboard

      Clipboard

      Copy and read text, HTML, and images on the browser clipboard, with support detection and coded errors that say why the browser refused.
      v0.2.0Browser
    • jg-react

      React hooks

      React hooks for online status, page visibility, Tailwind CSS breakpoints, and scroll thresholds, each safe in a server render.
      v0.3.0Browser
    • TanStack Query with safe defaults, opt-in IndexedDB persistence, and a sign-out clear that waits for the cache to finish restoring.
      v0.2.0Browser
    • jg-react-router

      React Router

      React Router helpers: a page outlet that focuses each new page and restores scroll on Back and Forward, and dialogs that close when the route changes.
      v0.2.0Browser

    Node.js

    For servers, command-line tools, and build scripts.

    • jg-fs

      Filesystem

      Filesystem helpers, async and sync: path checks, directories, text and JSON files, atomic writes, and bounded reads.
      v1.4.0Node.js
    • jg-process

      Child processes

      Run and stop child processes without a shell: timeouts, output limits, abort signals, and whole process trees.
      v1.3.0Node.js
    • jg-postgres

      PostgreSQL

      node-postgres helpers: transactions that report an unknown commit, advisory locks, SQLSTATE checks, cursor pages, and ordered lists.
      v0.3.0Node.js
    • A read-through cache that keeps working when Redis fails, and fail-closed one-time claims and single-use values, on node-redis.
      v0.2.0Node.js
    • jg-nestjs

      NestJS

      NestJS for HTTP APIs: an ApiException, a filter and an interceptor for the jg-api-response envelope, schema validation, CORS, and app bootstrap.
      v0.2.0Node.js
    • jg-crypto

      Crypto

      Hashing, random bytes and digits, and HMAC signatures with constant-time verification, for Node.js.
      v0.1.1Node.js

    Why agents use them

    Code your agent doesn't have to write.

    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.

    • Less code to generate and review

      Your agent imports a tested function instead of writing a new one, so there’s less code to generate, review, and maintain.

    • One error model, server to client

      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.

    • Docs inside each package

      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.

    • Examples that are checked

      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.

    • Tested as you install them

      Each release is packed and installed into a new project before it ships, and browser code is tested in Chromium, Firefox, and WebKit.

    • One set of conventions

      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

    Two steps to put your agent on them.

    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.

    1. Step 1

      Add the policy to your AGENTS.md

      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.

    2. Step 2

      Install the skill

      It tells your agent which package fits a task, even before the package is installed.

      Terminal
      npx skills add jesusgraterol/jg-skills --skill jg-packages -y

    Docs for agents

    Docs your coding agent can read.

    The same READMEs and API references you read here, as Markdown: inside each package, and on this site.

    • node_modules/<package>/API.md

      The full API reference of the installed version, shipped in every package, so it reads offline.

    • node_modules/<package>/RECIPES.md

      App-side patterns for the package, such as an API exception or a typed client, typechecked on every release.

    • /llms.txt

      An index of the packages in the llmstxt.org format, with a link to each package’s Markdown.

    • /llms-full.txt

      Every package’s README, API reference, and recipes in one file, for loading into a context window.

    • /packages/<name>/index.md

      The Markdown version of each page: a package’s README and its full API reference.

    • Accept: text/markdown

      Request 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).