rust-node-bootstrap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Rust+Node.js Bootstrap

Rust+Node.js 项目初始化

Scaffold a Rust+Node.js hybrid project with all infrastructure in one pass.
一键搭建包含所有基础设施的Rust+Node.js混合项目。

When to Use This Skill

何时使用该技能

Activate when any of the following are true:
  • User says "bootstrap", "scaffold", "new project", "set up from scratch"
  • Repo has
    Cargo.toml
    or
    package.json
    but is missing the other
  • Missing
    .github/workflows/
    ,
    scripts/
    , or
    publish.config.ts
  • Incrementally adding forge infrastructure to an existing project
满足以下任一条件时激活:
  • 用户提及"bootstrap"、"scaffold"、"new project"、"set up from scratch"
  • 仓库已有
    Cargo.toml
    package.json
    但缺少另一个文件
  • 缺少
    .github/workflows/
    scripts/
    publish.config.ts
  • 为现有项目逐步添加Forge基础设施

Decision Tree

决策树

Starting from scratch?
  YES → Full scaffold (all steps in order below)
  NO  → Incremental setup ↓

Has package.json?       → NO: Create root package.json + pnpm-workspace.yaml
Has Cargo.toml?         → NO: Create Cargo workspace
Has .github/workflows/? → NO: Generate from rust-node-ci skill templates
Has scripts/?           → NO: Generate from rust-npm-publish skill templates
Has publish.config.ts?  → NO: Create from rust-npm-publish skill examples
Has specs/?             → NO: Initialize LeanSpec
是否从零开始?
  是 → 完整搭建(按以下顺序执行所有步骤)
  否 → 增量搭建 ↓

是否有package.json?       → 否:创建根package.json + pnpm-workspace.yaml
是否有Cargo.toml?         → 否:创建Cargo工作区
是否有.github/workflows/? → 否:从rust-node-ci技能模板生成
是否有scripts/?           → 否:从rust-npm-publish技能模板生成
是否有publish.config.ts?  → 否:根据rust-npm-publish技能示例创建
是否有specs/?             → 否:初始化LeanSpec

Gather Project Info

收集项目信息

FieldExampleRequired
Project name
my-tool
Yes
npm scope
@myorg
Yes
Rust binary name(s)
my-cli
Yes
Cargo package name(s)
my-cli-rs
Yes
Main npm packages
packages/cli
Yes
Repository URL
github.com/myorg/my-tool
Yes
Platforms
darwin-x64, darwin-arm64, linux-x64, windows-x64
No (default: all 4)
字段示例是否必填
项目名称
my-tool
npm作用域
@myorg
Rust二进制名称
my-cli
Cargo包名称
my-cli-rs
主npm包路径
packages/cli
仓库URL
github.com/myorg/my-tool
目标平台
darwin-x64, darwin-arm64, linux-x64, windows-x64
否(默认:全部4个)

Scaffold Structure

项目结构

See references/project-structure.md for the full annotated tree.
my-tool/
├── .github/workflows/       ← CI + publish workflows
├── .lean-spec/config.json   ← LeanSpec configuration
├── specs/                   ← Spec-driven development
├── packages/cli/            ← Main npm package (thin JS wrapper)
│   ├── package.json         ← bin + optionalDependencies
│   └── bin.js               ← Resolves platform binary, spawns it
├── rust/                    ← Rust workspace
├── scripts/                 ← Publish & version scripts
├── publish.config.ts        ← Publish pipeline configuration
├── package.json             ← Root (version source of truth)
├── pnpm-workspace.yaml      ← pnpm workspace definition
└── Cargo.toml               ← Rust workspace manifest
完整带注释的目录结构请参考references/project-structure.md
my-tool/
├── .github/workflows/       ← CI + 发布工作流
├── .lean-spec/config.json   ← LeanSpec配置文件
├── specs/                   ← 规范驱动开发目录
├── packages/cli/            ← 主npm包(轻量JS封装层)
│   ├── package.json         ← 二进制配置 + 可选依赖
│   └── bin.js               ← 解析平台二进制文件并启动
├── rust/                    ← Rust工作区
├── scripts/                 ← 发布与版本管理脚本
├── publish.config.ts        ← 发布流水线配置
├── package.json             ← 根配置(版本唯一来源)
├── pnpm-workspace.yaml      ← pnpm工作区定义
└── Cargo.toml               ← Rust工作区清单

File Generation Order

文件生成顺序

Order matters — later files depend on earlier ones:
  1. Root configs
    package.json
    ,
    pnpm-workspace.yaml
    ,
    Cargo.toml
    ,
    turbo.json
    Use templates/bootstrap/.
  2. Publish config
    publish.config.ts
    (drives script + workflow generation)
  3. Main package wrapper
    bin.js
    +
    package.json
    from rust-npm-publish skill templates, fill in scope/binary name/platforms
  4. Scripts — Copy from rust-npm-publish skill templates
  5. Workflows — Copy from rust-node-ci skill templates, customize matrix
  6. LeanSpec — Initialize
    .lean-spec/config.json
    and
    specs/
  7. AGENTS.md — Project-level agent instructions listing installed skills
顺序至关重要——后续文件依赖于前置文件:
  1. 根配置文件
    package.json
    pnpm-workspace.yaml
    Cargo.toml
    turbo.json
    使用templates/bootstrap/中的模板。
  2. 发布配置
    publish.config.ts
    (驱动脚本与工作流生成)
  3. 主包封装层 — 从rust-npm-publish技能模板生成
    bin.js
    +
    package.json
    , 填充作用域/二进制名称/平台信息
  4. 脚本文件 — 复制rust-npm-publish技能模板中的脚本
  5. 工作流文件 — 复制rust-node-ci技能模板中的工作流,自定义矩阵配置
  6. LeanSpec — 初始化
    .lean-spec/config.json
    specs/
    目录
  7. AGENTS.md — 项目级Agent说明文档,列出已安装的技能

Verify

验证

bash
pnpm install && pnpm build && cargo check --workspace && pnpm tsx scripts/sync-versions.ts
See references/checklist.md for the full post-bootstrap checklist.
bash
pnpm install && pnpm build && cargo check --workspace && pnpm tsx scripts/sync-versions.ts
完整的初始化后检查清单请参考references/checklist.md

Install Companion Skills

安装配套技能

After scaffolding, install skills for ongoing development:
bash
undefined
搭建完成后,安装用于后续开发的技能:
bash
undefined

CI/CD workflows and composite actions

CI/CD工作流与复合动作

npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y
npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y

npm publishing pipeline and versioning

npm发布流水线与版本管理

npx skills add -g onsager-ai/dev-skills --skill rust-npm-publish -a claude-code -y
undefined
npx skills add -g onsager-ai/dev-skills --skill rust-npm-publish -a claude-code -y
undefined

Templates

模板目录

DirectoryContents
templates/bootstrap/Root configs:
package.json
,
Cargo.toml
,
pnpm-workspace.yaml
,
turbo.json
,
publish.config.ts
目录内容
templates/bootstrap/根配置文件:
package.json
Cargo.toml
pnpm-workspace.yaml
turbo.json
publish.config.ts

Setup & Activation

安装与激活

bash
npx skills add -g onsager-ai/dev-skills --skill rust-node-bootstrap -a claude-code -y
Auto-activates when: user says "bootstrap", "scaffold", "new project", or "init" in a Rust+Node.js context.
bash
npx skills add -g onsager-ai/dev-skills --skill rust-node-bootstrap -a claude-code -y
自动激活条件:在Rust+Node.js场景中,用户提及"bootstrap"、"scaffold"、"new project"或"init"时。