rslib-modern-package
БесплатноБез исполняемых скриптовНе проверенDesign, modernize, or review JS/TS npm packages using an opinionated Rslib baseline for ESM, exports, types, dependencies, and release readiness.
от rstackjs★ 101 звезда на GitHubОб этом скилле
Rslib modern package
Use this skill when creating a new Rslib library, modernizing an existing JS/TS package, or reviewing a package against an opinionated modern library standard.
This skill is opinionated: it describes a recommended modern package contract and may suggest breaking changes when they make the package simpler, safer, and easier for modern consumers.
Standard
Default recommendation for new JS/TS libraries:
- ESM-first, preferably pure ESM.
- Strict TypeScript and correct declaration files.
- Explicit public API through
package.json#exports. - Small named-export API surface.
- Few runtime dependencies, without treating zero dependencies as a religion.
- Small, tree-shakeable output with accurate
sideEffects. - Clear dependency placement: runtime dependencies, peer dependencies, optional dependencies, and dev dependencies are not interchangeable.
- Published package is tested as an artifact, not just as source files.
- Release flow is automated, traceable, and SemVer-aware.
- README.md explains usage for humans; AGENTS.md preserves package invariants for future agents.
Workflow
Inspect the package contract first
- Read
package.json, lockfile/package manager,rslib.config.*,tsconfig*, CI/release config, README.md, AGENTS.md, and existingdistoutput. - Identify package kind: Node utility, browser library, isomorphic utility, CLI, UI/component library, framework plugin, SDK, or adapter.
- List supported runtimes, current entry points, deep imports, runtime dependencies, peer dependencies, optional integrations, files with side effects, and published files.
- Run
npm pack --dry-runearly when changing package shape so the real tarball contents guide the review.
- Read
Define target environments explicitly
- Do not say "supports modern environments" without defining them.
- Verify the current Node.js release schedule before choosing
engines. - As of May 9, 2026, Node.js 22 and 24 are LTS, and Node.js 20 is EOL. For new Node-facing packages, recommend
engines.node >=22unless real consumers need an older runtime. - Browser packages should state whether they require native ESM, a bundler, Workers support, SSR compatibility, DOM APIs, CSS processing, or specific browser baselines.
- Compatibility drops are breaking changes: old Node/browser versions, undocumented deep imports, default/named export shape, bundled vs external dependency behavior, and import side effects.
Prefer pure ESM, but explain compatibility cost
- New packages should use
"type": "module"and ESM source/output. - Rslib's default format is ESM; keep that default unless there is a clear reason to add another format.
- Evaluate compatibility from real consumers and supported runtimes instead of assuming every historical module format is required.
- Modern Node.js can load synchronous ESM from CommonJS via
require(esm); do not assume CJS consumers always require a separate CJS build. - If you rely on
require(esm)compatibility, document and test its constraints: supported Node versions, no top-levelawaitin the loaded graph, namespace-object return shape, default export behavior, and CJS/ESM cycle limits. - Prefer Node built-in specifiers such as
node:fs/promises.
- New packages should use
Make
exportsthe public API- Treat
package.json#exportsas the product contract. - Export only paths users are meant to import.
- Do not allow imports like
pkg/dist/foo.jsby exporting./dist/*. That makes the generated output layout part of the public API and turns internal file moves into breaking changes. - Instead, expose only intentional public paths such as
pkgandpkg/foo.js, mapped to the actual files indist. - Keep subpath style consistent: either all with extensions such as
./foo.js, or all without extensions. Prefer paths with extensions when browser import maps matter. - Keep
"types"first inside conditional exports. - Adding
exportsto an older package can be breaking because undeclared deep imports stop working. - Add
./package.jsononly when consumers legitimately need package metadata.
- Treat
Design a small API surface
- Prefer named exports for multi-API packages.
- Avoid default-export objects that gather every function into one object.
- Public functions should be few, stable, well-named, and semver-maintained.
- Keep internal types, caches, helper functions, adapter details, and error internals private unless they are part of the contract.
- Avoid top-level work during import: file scans, network calls, timers, process mutation, global registration, DOM access, prototype mutation, or environment detection with side effects.
- Async APIs that may be canceled should accept
AbortSignal. - Prefer stable error classes, error codes, or typed error shapes over string matching.
Use Rslib as the implementation path, not the whole standard
- For detailed Rslib configuratio
Установить rslib-modern-package в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл rslib-modern-package?
Design, modernize, or review JS/TS npm packages using an opinionated Rslib baseline for ESM, exports, types, dependencies, and release readiness.
Как установить скилл rslib-modern-package?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rslib-modern-package запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic