跳到正文
cccskills
免费在 GitHub 公开

node-project-setup

Configure a Node.js project with pnpm, TypeScript, latest versions, and parallel script patterns following modern best practices

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md5.0 KB
  • README.md1.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Node.js プロジェクトを現代のベストプラクティスに従ってセットアップ・設定します。 既存プロジェクトへの適用も、新規プロジェクトの初期化も対象とします。

1. Package Manager: pnpm を選択

pnpm を基本パッケージマネージャーとして使用します。

最新版のインストール:

# 最新バージョンを確認してからインストール
npm install -g pnpm@latest
# または Corepack を使う場合
corepack enable && corepack prepare pnpm@latest --activate

package.json に packageManager フィールドを設定して pnpm バージョンを固定します:

{
  "packageManager": "pnpm@X.Y.Z"
}

バージョンは pnpm --version で確認した実際のバージョンを記載します。

2. Version Configuration

Node.js の最新バージョン確認:

# 最新の LTS バージョンを確認
node --version            # 現在の環境
# 公式サイト https://nodejs.org で最新 LTS を確認

package.json の engines フィールドで Node.js と pnpm のバージョン制約を明示します:

{
  "engines": {
    "node": ">=X.Y.Z",
    "pnpm": ">=X.Y.Z"
  }
}

バージョンには node --version / pnpm --version で確認した現在の最新版を記載します。

3. ESM (ES Modules) をデフォルトに

package.json に "type": "module" を設定して ESM を標準とします:

{
  "type": "module"
}

4. TypeScript のセットアップ

TypeScript を開発依存としてインストールします:

pnpm add -D typescript @types/node

tsconfig.json を作成します(strict + ESM 対応):

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "outDir": "dist",
    "rootDir": "src",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "skipLibCheck": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

5. Lint / Format ツール

Rust 製の高速ツールを採用します:

pnpm add -D oxlint @oxc-project/oxfmt
  • oxlint — ESLint 互換の高速 linter
  • oxfmt — Biome 互換の高速 formatter

6. Script Organization: parallel check/fix パターン

pnpm run --parallel "/^check:.*/" パターンを使って、check: プレフィックスを持つスクリプトをすべて並列実行します。 同様に fix: プレフィックスで自動修正系タスクをまとめます。

{
  "scripts": {
    "build": "tsc",
    "check": "pnpm run --parallel \"/^check:.*/\"",
    "check:types": "tsc --noEmit",
    "check:lint": "oxlint",
    "check:fmt": "oxfmt --check",
    "fix": "pnpm run --parallel \"/^fix:.*/\"",
    "fix:lint": "oxlint --fix",
    "fix:fmt": "oxfmt"
  }
}

パターンの原則:

  • 並列実行可能なチェック系タスクはすべて check: プレフィックスを付ける
  • 自動修正系タスクはすべて fix: プレフィックスを付ける
  • check / fix スクリプトは常に正規表現 + parallel で実行する(個別スクリプトを直接列挙しない)
  • 新しいチェック/修正を追加する際は check:xxx / fix:xxx として追加するだけで自動的に含まれる

同様のパターンを test: など他のカテゴリにも適用できます:

{
  "test": "pnpm run --parallel \"/^test:.*/\""
}

7. .npmrc 設定

pnpm のデフォルト挙動を守るために .npmrc を作成します:

shamefully-hoist=false
strict-peer-dependencies=false

8. package.json の完成形

以下を組み合わせた package.json の例:

{
  "name": "my-project",
  "version": "0.1.0",
  "type": "module",
  "packageManager": "pnpm@X.Y.Z",
  "engines": {
    "node": ">=X.Y.Z",
    "pnpm": ">=X.Y.Z"
  },
  "scripts": {
    "build": "tsc",
    "check": "pnpm run --parallel \"/^check:.*/\"",
    "check:types": "tsc --noEmit",
    "check:lint": "oxlint",
    "check:fmt": "oxfmt --check",
    "fix": "pnpm run --parallel \"/^fix:.*/\"",
    "fix:lint": "oxlint --fix",
    "fix:fmt": "oxfmt"
  },
  "devDependencies": {
    "@oxc-project/oxfmt": "latest",
    "@types/node": "latest",
    "oxlint": "latest",
    "typescript": "latest"
  }
}

Verification

セットアップ完了後に以下を実行して確認します:

pnpm install
pnpm check        # 型チェック・lint・フォーマットをすべて並列実行
pnpm fix          # lint・フォーマットの自動修正をすべて並列実行
pnpm build        # TypeScript のビルド確認

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

This skill should be used when the user asks to "プロジェクトを解析して", "コードベースを調べてドキュメント化して", "移行作業の準備をして", "新機能実装の前にプロジェクトを整理して", "analyze this codebase", "document the project structure", "既存プロジェクトのCLAUDE.mdを作って", or wants to prepare CLAUDE.md and architecture docs before a migration, feature development, or onboarding.

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

This skill should be used when the user asks to "このエラーを直して", "help me debug this", "fix this stack trace", "なぜこのエラーが出るの", "CI が落ちた", or pastes an error message or stack trace and wants help diagnosing it. Classifies the error type, identifies related files, and proposes up to three root-cause hypotheses with concrete fix plans.

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

doc-sync

免费

This skill should be used when the user asks to "ドキュメントを更新して", "sync the docs", "update CLAUDE.md after this change", "実装に合わせてドキュメントを直して", or notices that docs have drifted from the codebase. Diffs git history to identify what changed, proposes targeted updates to CLAUDE.md, docs/architecture.md, docs/requirements.md, and README.md, then applies only approved changes.

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

explain

免费

Explain selected code or a specified file/function in plain language, including what it does, why it exists, and potential pitfalls

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

This skill should be used when the user asks to "このファイルを変えたら何が壊れる?", "what depends on this function", "影響範囲を調べて", "show me what imports this module", or wants to understand the blast radius before modifying a shared utility, exported type, or public API. Traces import/require references up to two levels deep and lists affected test files.

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

This skill should be used when the user asks to "このIssueを実装して", "implement this issue", "fix this bug", "このタスクをやって", "Issue

中文简介正在准备中。当前显示原文说明。

t6adev/claude-code-tools32026年4月9日 更新

查看 t6adev 的全部技能

报告此技能的问题