Zum Inhalt springen
Skillpedia
APIs & Server (Backend)15k · #11036

ts-sdk-author

Was er macht

Dieser Skill führt durch den Bau einer TypeScript-Bibliothek, die andere Entwickler über npm installieren. Er ist für Teams gedacht, die aus einer bestehenden Codebasis ein SDK erstellen.

Wann du ihn nutzt

  • ✓Wenn du einen Kernbestandteil einer App als eigenes TypeScript-Paket auslagern willst.
  • ✓Wenn du die öffentliche API einer TypeScript-Bibliothek entwerfen musst.
  • ✓Wenn du ein npm-Paket für die Veröffentlichung vorbereitest, auch als Beta- oder Canary-Version.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/ts-sdk-author/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Mach aus unserem internen API-Client ein TypeScript-SDK-Paket, das wir auf npm veröffentlichen können.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent richtet das Arbeitsbereich-Layout ein, entwirft die öffentliche Schnittstelle und die Modulgrenzen, wählt ein Build-Werkzeug, konfiguriert die Paket-Exporte für verschiedene Umgebungen und prüft das Paket vor der Veröffentlichung mit Prüfwerkzeugen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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

Häufige Fragen

Welche Build-Werkzeuge vergleicht er?

Er vergleicht tsdown mit tsup, einer einfachen TypeScript-Compiler-Einrichtung und unbuild.

Deckt er Vorabversionen ab?

Ja. Er deckt Canary-, Beta- und Release-Candidate-Kanäle ab und zeigt, wie man zwischen ihnen wechselt.

Braucht er ein Monorepo?

Der Skill ist für ein pnpm-Monorepo-Setup geschrieben.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
15k
Platz im Ranking
#11036
Lizenz
AGPL-3.0
Aktualisiert
29.9.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills