ts-package

A command for preparing a TypeScript library for publication to npm, the package registry commonly used by JavaScript and TypeScript projects. It configures package metadata, generated type declarations, and import support for both module formats.

In plain words
What is it for?
Use it to check and configure a library’s package.json and build setup before publishing browser, Node.js, React, Vue, or utility packages.
Why use it?
It helps avoid publishing a package with missing metadata, incorrect entry points, or unavailable TypeScript types.

Command

Part of the typescript-pro plugin — 5 skills, 10 commands, 8 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/andronics/claude-plugin-typescript-pro/ts-package
Clone the repo
git clone --depth 1 https://github.com/andronics/claude-plugin-typescript-pro

Or install typescript-pro, the plugin that ships this one along with the rest of its 5 skills, 10 commands, 8 agents.

Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,093 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00014 $0.02093
Opus 5 $0.00007 $0.01046
Sonnet 5 $0.00003 $0.00419
Haiku 4.5 $0.00001 $0.00209

Measured 2d ago against content hash da958144084d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ts-package 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 2d 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.

commands/ts-package.md · 357 lines

How it starts

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

Prepare TypeScript library for npm publication:

  1. Validate Library Setup

    Check if this is a publishable library:

    • Is there a package.json?
    • Is this intended for npm publication?
    • What type of library: React, Vue, utility, Node?
    • Target environments: Browser, Node, both?
  2. Configure package.json

    Essential Fields:

    {
      "name": "@scope/package-name",
      "version": "1.0.0",
      "description": "Library description",
      "author": "Name <email>",
      "license": "MIT",
      "repository": {
        "type": "git",
        "url": "https://github.com/user/repo.git"
      },
      "keywords": ["typescript", "library"],
    
      "type": "module",
      "main": "./dist/index.cjs",
      "module": "./dist/index.js",
      "types": "./dist/index.d.ts",
    
      "exports": {
        ".": {
          "types": "./dist/index.d.ts",
          "import": "./dist/index.js",
          "require": "./dist/index.cjs"
        }
      },
    
      "files": [
        "dist",
        "README.md",
        "LICENSE"
      ],
    
      "sideEffects": false,
    
      "engines": {
        "node": ">=18"
      }
    }
    

    Verify and fix any missing or incorrect fields.

  3. Set Up Build Configuration

    Recommended: tsup (Simple & Fast)

    // tsup.config.ts
    import { defineConfig } from 'tsup';
    
    export default defineConfig({
      entry: ['src/index.ts'],
      format: ['esm', 'cjs'],
      dts: true,
      splitting: false,
      sourcemap: true,
      clean: true,
      treeshake: true,
      external: [], // Add peer dependencies
    });
    

    Or configure tsc for dual package:

    // tsconfig.build.json
    {
      "extends": "./tsconfig.json",
      "compilerOptions": {
        "declaration": true,
        "declarationMap": true,
        "sourceMap": true,
        "removeComments": false
      },
      "exclude": ["**/*.test.ts", "**/*.spec.ts"]
    }
    
  4. Generate Type Declarations

    Ensure high-quality .d.ts files:

    • Enable declaration: true
    • Enable declarationMap: true for IDE navigation
    • Keep JSDoc comments (removeComments: false)
    • Export all public types explicitly
    • Bundle declarations if multiple files
  5. Configure Dual Package (ESM + CJS)

    Support both module systems:

    "exports": {
      ".": {
        "types": "./dist/index.d.ts",
        "import": "./dist/index.js",
        "require": "./dist/index.cjs"
      },
      "./utils": {
        "types": "./dist/utils.d.ts",
        "import": "./dist/utils.js",
        "require": "./dist/utils.cjs"
      }
    }
    
  6. Verify Public API

    Check src/index.ts exports:

    • All public APIs exported
    • Types exported separately
    • No internal implementation leaked
    • Clear module boundaries
    // Good exports
    export type { User, CreateUserInput } from './types';
    export { createUser, updateUser } from './api';
    export { default as UserService } from './UserService';
    
  7. Add JSDoc Documentation

    Document public APIs:

    /**
     * Creates a new user with the provided details.
     *
     * @param input - The user details
     * @returns A promise resolving to the created user
     * @throws {ValidationError} If input is invalid
     *
     * @example
     * ```typescript
     * const user = await createUser({
     *   name: 'Alice',
     *   email: '[email protected]'
     * });
     * ```
     */
    export async function createUser(
      input: CreateUserInput
    ): Promise<User>;
    
  8. Configure Files to Publish

    package.json files field:

    {
      "files": [
        "dist",
        "README.md",
        "LICENSE",
        "CHANGELOG.md"
      ]
    }
    

    Or create .npmignore:

    src/
    tests/
    *.test.ts
    *.spec.ts
    tsconfig.json
    .eslintrc
    
  9. Set Up Pre-Publish Scripts

    {
      "scripts": {
        "build": "tsup",
        "type-check": "tsc --noEmit",
        "test": "vitest run",
        "prepublishOnly": "npm run build && npm test"
      }
    }
    

Read the full file on GitHub · 357 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. 2d ago First seen · 357 lines · 14 tokens per session scan A da958144084d

Subscribe to this mod's changes

ts-package is a command published in the GitHub repository andronics/claude-plugin-typescript-pro (4 stars, last pushed 10mo ago), licensed MIT. It adds 14 tokens to every session and 2,093 once invoked, about $0.0001 per session on Opus 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.