.agents/skills/wireit-monorepo/SKILL.md
npm/pnpmベースのモノレポでWireitを使用してビルドパイプラインの依存関係を管理し、キャッシュと並列実行を活用する場合に使用する。
npx skillsauth add ymkz/demo-monorepo wireit-monorepoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Wireitを使用して、npm/pnpmベースのモノレポでビルドスクリプトの依存関係を宣言的に管理し、キャッシュと並列実行によりビルドを高速化する。
build → test → deploy のような依存チェーンを管理したい場合{
"name": "my-monorepo",
"packageManager": "[email protected]",
"scripts": {
"dev": "wireit",
"build": "wireit",
"typecheck": "wireit",
"test": "wireit",
"coverage": "wireit",
"check": "wireit",
"lint": "biome check",
"format": "biome check --write"
},
"wireit": {
"dev": {
"dependencies": [
"./apps/web-form:dev",
"./apps/web-tool:dev"
]
},
"build": {
"dependencies": [
"./apps/web-form:build",
"./apps/web-tool:build"
]
},
"typecheck": {
"dependencies": [
"./apps/web-form:typecheck",
"./apps/web-tool:typecheck"
]
},
"test": {
"dependencies": [
"./apps/web-form:test",
"./apps/web-tool:test"
]
},
"coverage": {
"dependencies": [
"./apps/web-form:coverage",
"./apps/web-tool:coverage"
]
},
"check": {
"dependencies": [
"lint",
"typecheck",
"build"
]
}
},
"devDependencies": {
"wireit": "catalog:"
}
}
{
"name": "web-form",
"scripts": {
"dev": "wireit",
"build": "wireit",
"typecheck": "wireit",
"test": "wireit",
"generate:openapi": "wireit"
},
"wireit": {
"generate:openapi": {
"command": "openapi-ts"
},
"dev": {
"command": "next dev --turbopack -p 3000",
"service": true,
"dependencies": ["generate:openapi"]
},
"build": {
"command": "next build",
"dependencies": ["generate:openapi"]
},
"typecheck": {
"command": "tsc --noEmit",
"dependencies": ["generate:openapi"]
},
"test": {
"command": "vitest --run",
"dependencies": ["generate:openapi"]
}
}
}
| プロパティ | 説明 |
|-----------|------|
| command | 実行するシェルコマンド |
| dependencies | 実行前に完了する必要があるスクリプト |
| service | 起動後も継続して実行されるプロセス(dev server等) |
| files | キャッシュキーに含める入力ファイル |
| output | キャッシュ対象の出力ファイル/ディレクトリ |
{
"wireit": {
"build": {
"dependencies": [
"../shared:build"
]
}
}
}
{
"wireit": {
"build": {
"dependencies": ["generate:types"]
},
"test": {
"dependencies": ["build"]
}
}
}
{
"wireit": {
"test:e2e": {
"command": "playwright test",
"dependencies": ["dev:server"]
},
"dev:server": {
"command": "next dev",
"service": true
}
}
}
{
"wireit": {
"build": {
"command": "tsc",
"files": [
"src/**/*.ts",
"tsconfig.json"
],
"output": [
"dist/**"
]
},
"test": {
"command": "vitest --run",
"files": [
"src/**/*.ts",
"tests/**/*.ts"
],
"dependencies": ["build"]
}
}
}
# .github/workflows/ci.yml
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- uses: google/wireit@setup-github-actions-caching/v2
- run: pnpm check
{
"wireit": {
"generate:openapi": {
"command": "openapi-ts",
"files": [
"../../apps/api/src/main/resources/static/openapi/openapi.json"
],
"output": [
"src/generated/**"
]
},
"dev": {
"command": "next dev",
"service": true,
"dependencies": ["generate:openapi"]
},
"build": {
"command": "next build",
"dependencies": ["generate:openapi"]
}
}
}
{
"wireit": {
"typecheck": {
"command": "tsc --noEmit",
"files": ["src/**/*.ts", "tsconfig.json"]
},
"test": {
"command": "vitest --run",
"dependencies": ["typecheck"],
"files": ["src/**/*.ts", "tests/**/*.ts"]
},
"coverage": {
"command": "vitest --run --coverage",
"dependencies": ["test"]
}
}
}
{
"wireit": {
"check": {
"dependencies": [
"lint",
"typecheck",
"test"
]
}
}
}
上記の設定により、lint, typecheck, test は並列に実行される。
{
"wireit": {
"build": {
"command": "tsc",
"files": ["src/**"],
"output": ["dist/**"],
"clean": "if-file-deleted"
}
}
}
{
"wireit": {
"build": {
"command": "rm -rf dist && tsc", // 不要: cleanがある
"dependencies": ["build"] // 循環依存!
}
}
}
{
"wireit": {
"dev": {
"command": "next dev",
"service": true,
"dependencies": ["generate:types"]
}
}
}
| 問題 | 原因 | 解決策 | |------|------|--------| | 無限ループ | 循環依存 | 依存グラフを見直す | | キャッシュヒットしない | files/output設定不足 | 入力出力ファイルを明示 | | Serviceが停止しない | シグナル処理 | graceful shutdown実装 | | 並列実行でエラー | リソース競合 | dependenciesで順序制御 |
{
"scripts": {
"check": "npm run lint && npm run typecheck && npm run test",
"dev": "npm-run-all --parallel web-form:dev web-tool:dev"
}
}
問題:
{
"scripts": {
"check": "wireit",
"dev": "wireit"
},
"wireit": {
"check": {
"dependencies": ["lint", "typecheck", "test"]
},
"dev": {
"dependencies": [
"./apps/web-form:dev",
"./apps/web-tool:dev"
]
}
}
}
利点:
tools
このプロジェクトでは1リクエストあたりの全イベントを1つのJSONログに集約する「ワイドイベントロギング」を採用している。MDCとThreadLocalを組み合わせ、リクエスト処理のトレーサビリティ向上とパフォーマンス分析を実現する。
testing
単体テストとインテグレーションテストを使い分ける場合に使用する。テストピラミッドに基づき、テストの責務、実行速度、メンテナンスコストを考慮して適切なテスト戦略を選択する。
development
Spiceflow is a super simple, fast, and type-safe API and React Server Components framework for TypeScript. Works on Node.js, Bun, and Cloudflare Workers. Use this skill whenever working with spiceflow to get the latest docs and API reference.
tools
pnpmワークスペースでcatalog機能を使用して複数パッケージの依存バージョンを一元管理する場合に使用する。strictモードによる厳格なバージョン管理を実現する。