| name | jsr |
| description | Create and maintain JSR (JavaScript Registry) packages. Use this whenever the user wants to publish a package to JSR, set up a new JSR project, configure exports, write documentation, or troubleshoot JSR publishing. |
JSR is a modern package registry for JavaScript and TypeScript. This skill covers creating, configuring, documenting, and publishing ESR packages with minimal overhead.
To create a package:
- Write code in TypeScript as ESM (using
import/export)
- Create config -
jsr.json (or add JSR properties to deno.json):
{
"name": "@scope/package-name",
"version": "1.0.0",
"exports": "./mod.ts"
}
- Publish -
npx jsr publish or deno publish
Key Differences from npm:
- ESM-only: No CommonJS. All modules must use
import/export.
- Direct specifiers in code: Use
npm:lodash@4 or jsr:@std/encoding@1 directly in imports without package.json entries.
- TypeScript source preferred: Publish
.ts files directly, not compiled .js + .d.ts. JSR handles compilation and auto-generates docs.
- Auto-generated docs: JSDoc comments on functions, interfaces, classes become your package documentation. No need for separate docs.
Publishing
npx jsr publish --dry-run
npx jsr publish
GitHub Actions (OIDC)
- Link repo to package in JSR settings (jsr.io → package → settings → GitHub repo)
- Create
.github/workflows/publish.yml:
name: Publish
on:
push:
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- run: npx jsr publish
No secrets needed.
Configuration (jsr.json or deno.json)
Minimal: (preferred for new packages as it is the most simple)
{
"name": "@scope/pkg",
"version": "1.0.0",
"exports": "./mod.ts"
}
Equivalent to:
{
"name": "@scope/pkg",
"version": "1.0.0",
"exports": {
".": "./mod.ts"
}
}
With file filtering:
{
"name": "@scope/pkg",
"version": "1.0.0",
"exports": "./mod.ts",
"publish": {
"include": ["LICENSE", "README.md", "src/**/*.ts"],
"exclude": ["src/**/*.test.ts"]
}
}
Un-gitignoring files (e.g., publish dist/ even if in .gitignore):
{
"publish": {
"exclude": ["!dist"]
}
}
Documentation (JSDoc)
All JSDoc comments in exported symbols generate package docs visible on jsr.io and in editor completions.
Module documentation (top of file):
Function documentation:
export function search(query: string, limit?: number): string[]
Interfaces & Classes:
export interface SearchOptions {
limit?: number;
skip?: number;
}
export class Database {
name: string;
constructor(name: string) { this.name = name }
close(): void { }
}
Use {@link symbol} to link between documented symbols.
Full Documentation