
rust-npm-publish
Publish Rust binaries to npm using the optionalDependencies platform package pattern. Covers the full publish pipeline, version sync, workspace: protocol, and platform package architecture. Use when: (1) publishing Rust binaries to npm, (2) setting up the platform package pattern (main + per-OS packages), (3) debugging publish failures, (4) managing version sync across pnpm + Cargo workspaces, (5) working with workspace: protocol. Triggers on "publish", "platform packages", "optionalDependencies", "bin.js", "version sync", "workspace protocol", "npm tag", or "prepare-publish".
- Installs
- 61
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/onsager-ai/dev-skills --skill rust-npm-publish- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads rust-npm-publish automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Rust npm Publishing
Distribute Rust binaries to npm using the optionalDependencies platform package pattern.
When to Use This Skill
Activate when any of the following are true:
- Publishing Rust binaries to npm or debugging publish pipeline failures
- Setting up
publish.config.ts,bin.js, or platform package manifests - Managing version sync across workspace packages and
Cargo.toml - Working with
workspace:*protocol or prepare/restore scripts - Scripts matching
*publish*,*platform*,*version*, or*sync*exist
Decision Tree
What does the user need?
Setting up publishing for the first time?
→ The Pattern section + Configuration + Templates
Running the publish pipeline?
→ Publish Pipeline section
→ Full details: references/publish-pipeline.md
Adding a new platform?
→ Adding a New Platform section
→ Platform reference: references/platform-matrix.md
Version sync / bump?
→ Versioning section
→ Full strategy: references/version-strategy.md
→ workspace:* details: references/workspace-protocol.md
Debugging a failure?
→ references/troubleshooting.md
The Pattern
@scope/my-tool ← main package (thin JS wrapper + bin.js)
├── optionalDependencies:
│ ├── @scope/my-tool-darwin-arm64 ← macOS ARM (M-series)
│ ├── @scope/my-tool-darwin-x64 ← macOS Intel
│ ├── @scope/my-tool-linux-x64 ← Linux x86_64
│ └── @scope/my-tool-windows-x64 ← Windows x86_64
Each platform package contains only the pre-compiled binary for that target. npm installs only the one matching the user's OS/CPU at install time.
Same approach used by SWC, Turbopack, esbuild, and similar tools.
Configuration
Each repo provides a publish.config.ts (see examples/):
export default {
scope: '@myorg',
binaries: [{ name: 'my-cli', scope: 'cli', cargoPackage: 'my-cli-rs' }],
platforms: ['darwin-x64', 'darwin-arm64', 'linux-x64', 'windows-x64'],
mainPackages: [{ path: 'packages/cli', name: 'my-cli' }],
cargoWorkspace: 'Cargo.toml',
repositoryUrl: 'https://github.com/myorg/my-project',
};
Publish Pipeline
sync-versions → generate-manifests → add-platform-deps → copy-binaries
→ validate-binaries → prepare-publish → validate-workspace → publish-platforms
→ wait-propagation → publish-main → restore-packages
Critical ordering: Platform packages MUST be published and propagated before main packages, because main packages reference them as optionalDependencies.
See references/publish-pipeline.md for step-by-step details.
Main Package Wrapper (bin.js)
The main npm package is a thin JS wrapper — bin.js resolves the platform binary and spawns it. See templates/wrapper/ for the template.
Key details:
process.platformreturnswin32(notwindows) — mapwin32-x64→@scope/cli-windows-x64- Use
require.resolve('pkg/package.json')to find platform package, then readmainfor binary name - Use
execFileSyncand forward exit codes from the Rust process - Main package has NO
os/cpufields — it installs everywhere. Only platform packages use those.
Platform Package Manifests
Each platform package needs os/cpu fields and a postinstall.js for chmod:
{
"name": "@scope/cli-darwin-arm64",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "my-cli"
}
Platform Matrix
| Platform | Rust Target | os | cpu | Binary Extension |
|---|---|---|---|---|
darwin-arm64 | aarch64-apple-darwin | darwin | arm64 | (none) |
darwin-x64 | x86_64-apple-darwin | darwin | x64 | (none) |
linux-x64 | x86_64-unknown-linux-gnu | linux | x64 | (none) |
windows-x64 | x86_64-pc-windows-msvc | win32 | x64 | .exe |
See references/platform-matrix.md for adding new platforms.
Adding a New Platform
- Add to
platformsarray inpublish.config.ts - Add Rust target:
rustup target add <target-triple> - Add to CI matrix in publish workflow
- Regenerate manifests:
pnpm tsx scripts/generate-platform-manifests.ts
Versioning
Root package.json is the single source of truth. Never manually edit version elsewhere.
root package.json (version: "0.2.15")
├── packages/cli/package.json → 0.2.15 (via sync-versions.ts)
├── Cargo.toml → 0.2.15
└── platform-packages/*/ → 0.2.15 (via generate-manifests)
Version Sync Flow
npm version patch # Bump root: 0.2.15 → 0.2.16
pnpm tsx scripts/sync-versions.ts # Propagate to all packages + Cargo.toml
Dev Builds
CI computes: 0.2.15 → 0.2.16-dev.{github_run_id} Published with --tag dev. Install: npm install my-cli@dev
Cargo.toml stays at base version (0.2.15) for dev builds — Cargo pre-release handling differs from npm.
Version Bump Guide
| Change | Command | Example |
|---|---|---|
| Breaking API | npm version major | 1.0.0 → 2.0.0 |
| New feature | npm version minor | 0.2.0 → 0.3.0 |
| Bug fix | npm version patch | 0.2.15 → 0.2.16 |
| CI/testing | Automatic (CI) | 0.2.15 → 0.2.16-dev.123 |
workspace:* Protocol
pnpm uses workspace:* for internal deps during development. Replace before publish, restore after:
pnpm tsx scripts/prepare-publish.ts # Replace workspace:* → real versions
pnpm tsx scripts/validate-no-workspace-protocol.ts # Safety gate
npm publish
pnpm tsx scripts/restore-packages.ts # Restore workspace:*
See references/workspace-protocol.md for details. See references/version-strategy.md for the full strategy.
Troubleshooting Quick Reference
| Problem | Likely Cause | Fix |
|---|---|---|
Unsupported platform | Missing platform in bin.js | Add platform key mapping |
| Platform pkg not found on npm | Registry propagation delay | Wait; check publish logs |
workspace:* in published pkg | prepare-publish didn't run | Run prepare-publish.ts |
| Binary not executable | postinstall didn't run | chmod +x the binary |
| Version mismatch | Forgot to sync | Run sync-versions.ts |
See references/troubleshooting.md for detailed diagnostics.
Templates
| Directory | Contents |
|---|---|
| templates/scripts/ | All 11 publish pipeline scripts |
| templates/wrapper/ | bin.js + main package package.json |
| examples/ | Real publish.config.ts from consuming projects |
Setup & Activation
npx skills add -g onsager-ai/dev-skills --skill rust-npm-publish -a claude-code -y
Auto-activates when: publish.config.ts present, scripts matching *publish* or *platform* exist, user mentions "publish", "platform packages", or "version sync".
FAQ
What does the rust-npm-publish skill do?
Publish Rust binaries to npm using the optionalDependencies platform package pattern. Covers the full publish pipeline, version sync, workspace: protocol, and platform package architecture. Use when: (1) publishing Rust binaries to npm, (2) setting up the platform package pattern (main + per-OS packages), (3) debugging publish failures, (4) managing version sync across pnpm + Cargo workspaces, (5) working with workspace: protocol. Triggers on "publish", "platform packages", "optionalDependencies", "bin.js", "version sync", "workspace protocol", "npm tag", or "prepare-publish".
How do I install rust-npm-publish?
Run npx skills add https://github.com/onsager-ai/dev-skills --skill rust-npm-publish in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/rust-npm-publish/ (personal) or .claude/skills/rust-npm-publish/ (project).
Which AI agents can use rust-npm-publish?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is rust-npm-publish safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains rust-npm-publish?
It is published by onsager-ai in onsager-ai/dev-skills. It has 61 recorded installs.
More from onsager-ai/dev-skills
codegraph
onsager-ai/dev-skills
Pre-indexed code knowledge graph (MCP, SQLite + tree-sitter) for faster, lower-token exploration of brownfield codebases. Use when starting work on a repo larger than 500 files or when the task involves cross-file traversal — "where is X used", "what calls Y", "what breaks if I change Z", "trace flow from A to B", "explain this subsystem". Skip for single-file edits or sessions shorter than the cold-start cost. Triggers include "codegraph", "code graph", "index this repo", "where is X defined", "find callers of", "callees of", "blast radius of changing X", "explore this codebase". Cuts the grep + Read loops needed to orient, via O(1) SQLite lookups and FTS5 search over 8 MCP tools — but it's an unsound tree-sitter approximation, so grep stays the completeness backstop for renames/exhaustive callers.
git-commit
onsager-ai/dev-skills
Best practices for creating clean, atomic git commits with good messages. Use when: (1) staging and committing changes, (2) writing commit messages, (3) deciding what to group in a single commit, (4) handling pre-commit hook failures, (5) choosing between amend and new commit. Triggers on "commit", "stage", "git add", "write a commit message", or "commit my changes".
web-testing
onsager-ai/dev-skills
Open the skill to read its SKILL.md instructions.
issue-spec
onsager-ai/dev-skills
Create or revise a focused specification issue when explicitly requested or required by the repository contribution policy. Discover existing work, capture intent and acceptance criteria, and reconcile decisions before implementation.
agent-browser
onsager-ai/dev-skills
Open the skill to read its SKILL.md instructions.
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.