ts-sdk-author
यह क्या करती है
यह स्किल एक TypeScript लाइब्रेरी बनाने का मार्गदर्शन देती है, जिसे दूसरे डेवलपर्स npm से इंस्टॉल करें। यह उन टीमों के लिए है जो मौजूदा कोडबेस से SDK बना रही हैं।
कब इस्तेमाल करें
- ✓जब आप ऐप से मुख्य लाइब्रेरी निकालकर उसे अलग TypeScript पैकेज बनाना चाहते हैं।
- ✓जब आपको TypeScript लाइब्रेरी का सार्वजनिक API डिज़ाइन करना है।
- ✓जब आप npm पैकेज को release के लिए तैयार करते हैं, जिसमें beta या canary संस्करण शामिल हों।
Skill का लिंक
https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/ts-sdk-author/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हमारे आंतरिक API client को एक TypeScript SDK पैकेज में बदलिए, जिसे हम npm पर प्रकाशित कर सकें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट workspace की संरचना तय करता है, सार्वजनिक इंटरफ़ेस और मॉड्यूल की सीमाएँ डिज़ाइन करता है, build tool चुनता है, अलग वातावरणों के लिए package exports सेट करता है, और release से पहले verification tools से पैकेज जाँचता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.jsonexportsfield 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
srcvia a custom condition) - Wiring
publint --strictandattw --packintoprepublishOnlyor CI - Managing pre-release channels —
canaryper commit,nextfor the upcoming major,beta/rcfor stabilization,latestfor 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@v1plus 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:
- Adopt
apps/+packages/+ optionaltools/at the workspace root - Place the SDK in
packages/<sdk-name>/(orpackages/core/) - Give it a scoped name (
@<org>/<sdk-name>) - Wire workspace-internal deps with the
workspace:*protocol - 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— §2src/boundary, §3 runtime layering, §4 provider/adapter, §5 plugin extension, §6 boundary enforcement, §7 patterns vs anti-patternsreferences/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
अक्सर पूछे जाने वाले सवाल
कौन-से build tools की तुलना होती है?
tsdown की तुलना tsup, सादे TypeScript compiler सेटअप और unbuild से होती है।
क्या यह pre-release संस्करण कवर करती है?
हाँ। यह canary, beta और release candidate channels और उनके बीच जाने का तरीका कवर करती है।
क्या इसके लिए monorepo चाहिए?
स्किल pnpm monorepo सेटअप के लिए लिखी गई है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 15k
- रैंकिंग में स्थान
- #11036
- लाइसेंस
- AGPL-3.0
- अपडेट की गई
- 29/9/2026
कमेंट
- …
इस repository की और skills
first-principles-thinking
15kयोजना या डिज़ाइन को बुनियादी सच्चाइयों में तोड़कर और उनसे ऊपर तर्क करके जाँचने में आपके एजेंट की मदद करती है, आदत या परंपरा पर भरोसा किए बिना।
python-design
15kसाफ़ मॉड्यूल, सरल इंटरफ़ेस और कम छिपी जटिलताओं वाली Python command-line स्क्रिप्ट लिखने और समीक्षा करने में आपके एजेंट की मदद करती है।
trellis-before-dev
15kकोड लिखना शुरू करने से पहले प्रोजेक्ट के कोडिंग दिशानिर्देश और कार्य-नोट्स पढ़ने में आपके एजेंट की मदद करती है, ताकि वह टीम की परंपराओं का पालन करे।
trellis-brainstorm
15kएक समय में एक उपयोगी सवाल पूछकर, कोड जाँचकर और एक संकीर्ण दायरे पर सहमति बनाकर नए फ़ीचर या अस्पष्ट काम को स्पष्ट करने में आपके एजेंट की मदद करती है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।