Packaging Distribution logo

Packaging Distribution

Organization
staple-lab
packaging-distribution

Use when publishing a design system as an npm package or setting up its build and release - exports maps, dual ESM/CJS, sideEffects and CSS delivery, peer dependencies, "use client" for RSC, tree-shaking, versioning with changesets, and verifying with publint and attw. Triggers on "publish the design system", "npm package", "exports map", "changesets", "monorepo package".

Overview

Publisherstaple-lab
Repositorydesign-system-skills
Skill namepackaging-distribution
Stars
7
Forks
0
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by staple-lab on GitHub. Read the source before you install it.

Installation

Install the Packaging Distribution AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/packaging-distribution
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/staple-lab/design-system-skills.git /tmp/design-system-skills
mkdir -p .claude/skills
cp -r /tmp/design-system-skills/plugins/design-system/skills/packaging-distribution .claude/skills/packaging-distribution
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Packaging Distribution in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Packaging Distribution on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Packaging Distribution is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Packaging and distribution

First: should this be a package at all?

ModeWhen
In-repo (src/design-system/)One app. No version boundary, no release step, change and use in the same commit. The right default.
Workspace packageMonorepo, 2+ sibling apps. Versionless internally, real boundary.
Private npmConsumers outside the repo, inside the company.
Public npmExternal consumers. Everything below becomes mandatory, and so does a deprecation policy.

A package adds a version boundary, a release process, and a lag between a fix and its use. That cost is worth paying at two or more consumers and rarely worth it at one. Say this plainly when someone asks to publish on day one.

The exports map

The most common way a design system release breaks consumers.

jsonc
{
  "name": "@acme/ui",
  "type": "module",
  "sideEffects": ["*.css"],
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js",
      "require": "./dist/index.cjs"
    },
    "./button": {
      "types": "./dist/button.d.ts",
      "import": "./dist/button.js",
      "require": "./dist/button.cjs"
    },
    "./styles.css": "./dist/styles.css",
    "./tokens": "./dist/tokens/index.js",
    "./tokens.css": "./dist/tokens/tokens.css",
    "./package.json": "./package.json"
  },
  "files": ["dist"],
  "peerDependencies": { "react": ">=18", "react-dom": ">=18" },
  "peerDependenciesMeta": { "react-dom": { "optional": true } }
}

The details that bite:

  • types first in every condition. Conditions resolve in order; if import precedes types, TypeScript takes the JS path and consumers get any with no error to explain it.
  • Subpath entries, not a wildcard. "./button" is a supported API; "./*": "./dist/*" exposes every internal file as public surface and freezes your directory layout forever.
  • Export ./package.json. Some tooling reads it and hard-fails without this line.
  • sideEffects: ["*.css"]. false makes bundlers drop your stylesheet — the component library that renders unstyled in production and works locally. Listing CSS keeps tree-shaking for JS while protecting the styles.
  • React in peerDependencies, never dependencies. Two copies of React is an instant hook-error crash, and it is confusing to diagnose from the consumer's side.

Build

tsdown (Rolldown-based) or tsup (esbuild-based). Both do ESM + CJS + .d.ts from one config.

ts
import { defineConfig } from 'tsdown';

export default defineConfig({
  entry: ['src/index.ts', 'src/button.ts', 'src/dialog.ts'],
  format: ['esm', 'cjs'],
  dts: true,
  sourcemap: true,
  clean: true,
  external: ['react', 'react-dom'],
  // Preserve the directive — bundlers strip it by default and RSC apps then fail at runtime.
  banner: { js: '' },
});

Ship ESM-first. CJS remains necessary for Jest setups and older Node tooling, so dual-format is still the safe answer in 2026, but ESM is the one to optimise.

RSC and "use client"

If any consumer uses React Server Components, interactive components need the directive — on the components that need it, not blanketed across the entry point. A "use client" on your barrel file drags the entire library into the client bundle and silently destroys the consumer's server-rendering.

tsx
'use client';
export { Button } from './Button';

Keep purely presentational components (a Badge, a Card with no handlers) free of it so they can render on the server. Verify in a real Next.js app before release; nothing else catches this.

CSS delivery

Depends on the CSS system, and the README must state which:

SystemConsumer does
CSS Modules / vanilla-extractimport '@acme/ui/styles.css' — one file, simplest story
Tailwind@import '@acme/ui/tokens.css' + @source '../node_modules/@acme/ui' so their build scans your classes
PandaConsume your preset in panda.config.ts
StyleXConsumers must run the StyleX build plugin — the heaviest requirement here, say so loudly

Always ship tokens.css separately from component CSS. Consumers who want your tokens without your components are a real and common case, and serving them costs you nothing.

Versioning

Changesets. Every PR that changes behaviour adds a changeset; release notes generate themselves.

Semver for a design system, interpreted honestly:

  • major — a removed or renamed prop, a changed default, a DOM structure change consumers style against, a raised peer range.
  • minor — new component, new prop, new token.
  • patch — bugfix with no API change.

A visual change is at least a minor. It is not a bugfix if every screen in the consuming product looks different afterwards, even when the old rendering was wrong.

Deprecate before removing, always: mark with @deprecated in JSDoc (so it strikes through in the editor — the most effective deprecation channel there is), keep it working for at least one minor, ship a codemod if the migration is mechanical, and give a removal version.

Verify before publishing

bash
npm run build
npx publint                       # packaging correctness
npx @arethetypeswrong/cli --pack  # do the types actually resolve, per condition
npm pack --dry-run                # exact file list + unpacked size

Then install the tarball into a scratch app and import it — ESM and CJS, and in a Next.js app if RSC matters. Every packaging bug that reaches consumers passed the unit tests, because unit tests import from source, not from the built package.

Publishing is outward-facing and irreversible for a given version. Confirm with the user before npm publish, every time, and show them the pack output first. Use --provenance in CI for public packages.

Bundle discipline

  • Per-component entry points so consumers pay for what they import.
  • size-limit in CI with a budget per entry; fail on regression.
  • Watch the primitives — each Radix package is small, but twenty of them are not.
  • Icons are the classic blowout. Never re-export an icon set from the barrel; let consumers import icons directly.
  • Publish the numbers in the inventory's status board. A component library that quietly grows 40kb loses its own argument.

Frequently asked questions

What does the Packaging Distribution AI skill do?

Use when publishing a design system as an npm package or setting up its build and release - exports maps, dual ESM/CJS, sideEffects and CSS delivery, peer dependencies, "use client" for RSC, tree-shaking, versioning with changesets, and verifying with publint and attw. Triggers on "publish the design system", "npm package", "exports map", "changesets", "monorepo package".

Why use Packaging Distribution on TypingMind?

Because you install it once and use it with any model. Packaging Distribution is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Packaging Distribution in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/staple-lab/design-system-skills/tree/main/plugins/design-system/skills/packaging-distribution. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Packaging Distribution?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Packaging Distribution?

As many as you like. As long as a model supports skills, you can use Packaging Distribution with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Packaging Distribution AI skill free?

Yes. It is published on GitHub by staple-lab under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇