Skip to content
Skillpedia
APIs & servers (backend)15k Β· #11036

ts-sdk-author

What it does

The skill guides building a TypeScript library that other developers install from npm. It is for teams creating an SDK from an existing codebase.

When to use it

  • βœ“When you want to pull a core library out of an app into its own TypeScript package.
  • βœ“When you need to design the public API of a TypeScript library.
  • βœ“When you prepare an npm package for release, including beta or canary versions.

Skill link

https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/ts-sdk-author/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/ts-sdk-author/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œTurn our internal API client into a TypeScript SDK package that we can publish to npm.”

5 new skills a week. 1 minute to read.

How it works

The agent sets up the workspace layout, designs the public interface and module boundaries, picks a build tool, configures package exports for different environments, and checks the package with verification tools before release.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

TypeScript SDK Author

End-to-end workflow for shipping a TypeScript SDK as a standalone npm package from inside a pnpm monorepo: workspace layout, public API design, build configuration, distribution shape, monorepo pipeline, verification, and the full release lifecycle including beta / rc / canary channels.

The seven references hold the depth. This file is the unified workflow plus a quick-reference for the patterns you reach for daily.


When to Use This Skill

  • Extracting a core library (e.g. packages/core, packages/sdk) out of an existing CLI or app inside a pnpm workspace
  • Designing the public API surface of a TypeScript library that strangers will consume β€” branded types, generic clients, plugin extension points
  • Choosing a build tool β€” tsdown vs tsup vs tsc-only vs unbuild
  • Authoring the package.json exports field with dual ESM+CJS, isomorphic runtime conditions, and subpath plugin entries
  • Configuring Turborepo so the SDK rebuilds only when its inputs change and downstream apps consume the SDK's build output (or raw src via a custom condition)
  • Wiring publint --strict and attw --pack into prepublishOnly or CI
  • Managing pre-release channels β€” canary per commit, next for the upcoming major, beta / rc for stabilization, latest for stable β€” and the transitions between them (beta.N β†’ rc.0 β†’ 1.0.0 β†’ 1.1.0-beta.0)
  • Setting up changesets with GitHub Actions changesets/action@v1 plus npm provenance

Execution Workflow

A single TS SDK build flows through these seven phases. Skip any phase and something will break later β€” the dependencies between phases are real.

Phase 1 β€” Workspace & Package Skeleton

Lay down the monorepo and create the empty SDK package.

Core moves:

  1. Adopt apps/ + packages/ + optional tools/ at the workspace root
  2. Place the SDK in packages/<sdk-name>/ (or packages/core/)
  3. Give it a scoped name (@<org>/<sdk-name>)
  4. Wire workspace-internal deps with the workspace:* protocol
  5. Decide BEFORE anything else: this package will eventually be published, so design the boundary and naming with that in mind
my-repo/
β”œβ”€β”€ pnpm-workspace.yaml
β”œβ”€β”€ package.json          # root: only devDeps + workspace scripts
β”œβ”€β”€ apps/
β”‚   └── example-app/      # consumer of the SDK
└── packages/
    β”œβ”€β”€ sdk/              # ← the SDK
    └── shared-tsconfig/  # internal-only, never published
# pnpm-workspace.yaml
packages:
  - "apps/*"
  - "packages/*"

Read next: references/workspace-and-layout.md β€” Β§2 layout, Β§3 SDK naming patterns, Β§4 internal package creation, Β§5 package.json skeleton, Β§7 multi -repo β†’ monorepo migration.

Phase 2 β€” Public API Surface

Before writing any code, decide what the SDK's public face looks like.

Two parallel concerns:

A. Module boundaries. The src/ tree splits cleanly into api/ (what gets re-exported and is part of the contract) and internal/ (do not import from outside the package). The package.json exports field is your cheapest enforcement mechanism β€” anything not listed there cannot be imported by consumers.

packages/sdk/src/
β”œβ”€β”€ index.ts          # barrel β€” re-exports from api/
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ client.ts
β”‚   └── types.ts
└── internal/
    β”œβ”€β”€ transport.ts  # NOT exported
    └── state.ts      # NOT exported

B. Type design. SDK types are consumed by strangers, must not leak internals, must be evolvable. Use:

  • Branded types for opaque IDs: type UserId = Brand<string, "UserId">
  • Generic clients with sensible defaults so adding type params later is non-breaking: createClient<Schema = DefaultSchema>(...)
  • Discriminated unions for result types: Result<T, E> with { ok: true; value: T } | { ok: false; error: E }
  • Builder pattern for type-safe configuration when option combinations matter
  • Interfaces (not type aliases) when users may need to extend the type via declaration merging

Read next:

  • references/module-boundaries-and-plugins.md β€” Β§2 src/ boundary, Β§3 runtime layering, Β§4 provider/adapter, Β§5 plugin extension, Β§6 boundary enforcement, Β§7 patterns vs anti-patterns
  • references/type-design-for-public-api.md β€” Β§1 branded types, Β§2 generic surfaces, Β§3 conditional/mapped types, Β§4 type guards, Β§5 builder, Β§6 utility types ship/internal, Β§7 tsconfig for libraries, Β§8 API evolution

Phase 3 β€” Build Configuration

You need (a) a tsconfig.json tuned for library outp

FAQ

Which build tools does it compare?

It compares tsdown with tsup, a plain TypeScript compiler setup, and unbuild.

Does it cover pre-release versions?

Yes. It covers canary, beta, and release candidate channels, and how to move between them.

Does it need a monorepo?

The skill is written for a pnpm monorepo setup.

Details

Original description by the author

Design, build, verify, and publish production-grade TypeScript SDKs as npm packages inside a pnpm monorepo. Covers workspace layout, public API and module boundaries, plugin extension points, branded types and library-tuned tsconfig, tsdown bundling (vs tsup/tsc-only/unbuild), package.json exports with dual ESM+CJS and isomorphic conditions (browser/workers/RN/deno), Turborepo pipelines, publint and @arethetypeswrong/cli verification, changesets pre-release mode, npm dist-tags (latest/next/beta/rc/canary), and the alpha→beta→rc→stable release lifecycle. Triggers on: build a TS SDK, extract cor

repo: mindfold-ai/Trellis

Popularity

GitHub stars
15k
Ranking position
#11036
License
AGPL-3.0
Updated
9/29/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills