Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

npm-packagenpm 包

Agent Skill

npm-package 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,256

周安装

219

GitHub Stars

67

下载量

1,752
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:npm-package(npm 包)
来源仓库:https://github.com/jwynia/agent-skills
仓库路径:skills/npm-package
安装命令:
npx skills add https://github.com/jwynia/agent-skills --skill npm-package
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jwynia/agent-skills --skill npm-package

简介

用于处理 GitHub 仓库和协作信息。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 适合围绕代码变更和 Issue 进行整理。
  • 可结合原始 README 进一步验证功能细节。
  • 安装前建议确认权限范围和维护状态。npm-package 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 注意可能触发联网或命令执行,需评估安全风险。

SKILL.md

npm Package Development (Bun-First)

Build and publish npm packages using Bun as the primary runtime and toolchain, producing output that works everywhere npm packages are consumed.

When to Use This Skill

Use when:

  • Creating a new npm library package from scratch
  • Setting up build/test/lint tooling for an existing package
  • Fixing CJS/ESM interop, exports map, or TypeScript declaration issues
  • Publishing a package to npm
  • Reviewing or improving package configuration

Do NOT use when:

  • Building an npx-executable CLI tool (use the npx-cli skill)
  • Building an application (not a published package)
  • Working in a monorepo (this skill targets single-package repos)

Toolchain

ConcernToolWhy
Runtime / package managerBunFast install, run, transpile
BundlerBunupBun-native, dual output,.d.ts generation
Type declarationsBunup (via tsc)Integrated with build
TypeScriptmodule: "nodenext", strict: true + extrasMaximum correctness for published code
Formatting + basic lintingBiome v210-25x faster than ESLint, single tool
Type-aware lintingESLint + typescript-eslint40+ type-aware rules Biome can't do
TestingVitestTest isolation, mature mocking, coverage
VersioningChangesetsFile-based, explicit, monorepo-ready
Publishingnpm publish --provenanceTrusted Publishing / OIDC

Scaffolding a New Package

Run the scaffold script to generate a complete project:

bun run <skill-path>/scripts/scaffold.ts ./my-package \
  --name my-package \
  --description "What this package does" \
  --author "Your Name" \
  --license MIT

Options:

  • --dual — Generate dual CJS/ESM output (default: ESM-only)
  • --no-eslint — Skip ESLint, use Biome only

Then install dependencies:

cd my-package
bun install
bun add -d bunup typescript vitest @vitest/coverage-v8 @biomejs/biome @changesets/cli
bun add -d eslint typescript-eslint  # unless --no-eslint

Project Structure

my-package/
├── src/
│   ├── index.ts            # Package entry point — all public API exports here
│   └── index.test.ts       # Tests co-located with source
├── dist/                   # Built output (gitignored, included in published tarball)
├── .changeset/
│   └── config.json
├── package.json
├── tsconfig.json
├── bunup.config.ts
├── biome.json
├── eslint.config.ts        # Type-aware rules only
├── vitest.config.ts
├── .gitignore
├── README.md
└── LICENSE

Critical Configuration Details

Read these reference docs before modifying any configuration. They contain the reasoning behind each decision and the sharp edges that cause subtle breakage:

Key Rules (Non-Negotiable)

These are the rules that, when violated, cause the most common and painful bugs in published packages. Follow these without exception.

Package Configuration

  1. Always use "type": "module" in package.json. ESM-only is the correct default. require(esm) works in all supported Node.js versions.
  2. Always use exports field, not main. main is legacy. exports gives precise control over what consumers can access.
  3. types must be the first condition in every exports block. TypeScript silently fails to resolve types if it isn't.
  4. Always export "./package.json": "./package.json". Many tools need access to the package.json and exports encapsulates completely.
  5. Use files: ["dist"] in package.json. Whitelist approach prevents shipping secrets. Never use .npmignore.
  6. Run npm pack --dry-run before every publish. Verify the tarball contains exactly what you intend.

TypeScript

  1. Use module: "nodenext" for published packages. Not "bundler". Code satisfying nodenext works everywhere; the reverse is not true.
  2. strict: true is non-negotiable. Without it, your.d.ts files can contain types that error for consumers using strict mode.
  3. Enable noUncheckedIndexedAccess. Catches real runtime bugs from unguarded array/object access.
  4. Ship declarationMap: true. Enables "Go to Definition" to reach original source for consumers.
  5. Do not use path aliases (paths) in published packages. tsc does not rewrite them in emitted code. Consumers can't resolve them.

Code Quality

  1. any is banned. Use unknown and narrow. Suppress with // biome-ignore suspicious/noExplicitAny: <reason> only when genuinely unavoidable, and always include the reason.
  2. Prefer named exports over default exports. Default exports behave differently across CJS/ESM boundaries.
  3. Always use import type for type-only imports. Enforced by both verbatimModuleSyntax and Biome's useImportType rule.

Build

  1. Build with Bunup using format: ['esm'] (or ['esm', 'cjs'] for dual). Bunup handles.d.ts generation, external detection, and correct file extensions.
  2. Set engines.node to >=20.19.0 in package.json. This documents the minimum supported Node.js version (first LTS with stable require(esm)).

Testing

  1. Use Vitest, not bun:test. bun:test lacks test isolation — module mocks leak between files. Vitest runs each test file in its own worker.
  2. Set coverage thresholds (branches, functions, lines, statements all ≥ 80%). Enforced in vitest.config.ts.

Development Workflow

# Write code and tests
bun run test:watch    # Vitest watch mode

# Check everything
bun run lint          # Biome + ESLint
bun run typecheck     # tsc --noEmit
bun run test          # Vitest run

# Build
bun run build         # Bunup → dist/

# Prepare release
bunx changeset        # Create changeset describing changes
bunx changeset version  # Bump version, update CHANGELOG

# Publish
bun run release       # Build + npm publish --provenance

Adding Subpath Exports

When the package needs to expose multiple entry points:

  1. Add the source file: src/utils.ts
  2. Add to bunup.config.ts entry: entry: ['src/index.ts', 'src/utils.ts']
  3. Add to package.json exports:
{
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "default": "./dist/index.js"
    },
    "./utils": {
      "types": "./dist/utils.d.ts",
      "default": "./dist/utils.js"
    },
    "./package.json": "./package.json"
  }
}

Reminder: Adding or removing export paths is a semver-major change.

Switching to Dual CJS/ESM Output

If consumers require CJS support for Node.js < 20.19.0:

  1. Update bunup.config.ts: format: ['esm', 'cjs']
  2. Update package.json exports to include module-sync, import, and require conditions
  3. See reference/esm-cjs-guide.md for the exact exports map structure

Bun-Specific Gotchas

  • bun build does not generate.d.ts files. Use Bunup (which delegates to tsc) or run tsc --emitDeclarationOnly separately.
  • bun build CJS output is experimental. Always use target: "node" for npm-publishable CJS. target: "bun" produces Bun-specific wrappers.
  • bun build does not downlevel syntax. Modern ES2022+ syntax ships as-is. If targeting older runtimes, additional transpilation is needed.
  • bun publish does not support --provenance. Use npm publish for provenance signing.
  • bun publish uses NPM_CONFIG_TOKEN, not NODE_AUTH_TOKEN. CI pipelines may need adjustment.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.35%
按下载量换算567

Claude

31.67%
按下载量换算555

Cursor

17.83%
按下载量换算312

Gemini CLI

8.62%
按下载量换算151

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills