From 425f929134d7e9f81cae0f44bb63a9541c4c12ce Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Wed, 18 Feb 2026 09:58:00 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=87=E3=82=A3=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E3=83=9D=E3=83=AA=E3=82=B7=E3=83=BC=E3=81=AB=E3=80=8C?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=82=B8=E3=82=A7=E3=82=AF=E3=83=88=E3=82=B9?= =?UTF-8?q?=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E5=84=AA=E5=85=88=E3=80=8D?= =?UTF-8?q?=E3=83=AB=E3=83=BC=E3=83=AB=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npx等の直接実行によるlockfile迂回を防ぐため、プロジェクト定義のスクリプトを優先する原則とREJECT項目を追加 --- builtins/en/policies/coding.md | 2 ++ builtins/ja/policies/coding.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/builtins/en/policies/coding.md b/builtins/en/policies/coding.md index 1296a9a..d658b28 100644 --- a/builtins/en/policies/coding.md +++ b/builtins/en/policies/coding.md @@ -13,6 +13,7 @@ Prioritize correctness over speed, and code accuracy over ease of implementation | File size | ~300 lines as a guideline. Be flexible depending on the task | | Boy Scout | Leave touched areas a little better than you found them | | Fail Fast | Detect errors early. Never swallow them | +| Project scripts first | Use project-defined scripts for tool execution. Direct invocation is a last resort | ## No Fallbacks or Default Arguments @@ -288,3 +289,4 @@ function formatPercentage(value: number): string { ... } - **Internal implementation exported from public API** - Only export domain-level functions and types. Do not export infrastructure functions or internal classes - **Replaced code surviving after refactoring** - Remove replaced code and exports. Do not keep unless explicitly told to - **Workarounds that bypass safety mechanisms** - If the root fix is correct, no additional bypass is needed +- **Direct tool execution bypassing project scripts** - `npx tool` and similar bypass the lockfile, causing version mismatches. Look for project-defined scripts (npm scripts, Makefile, etc.) first. Only consider direct execution when no script exists diff --git a/builtins/ja/policies/coding.md b/builtins/ja/policies/coding.md index dafb098..df77a33 100644 --- a/builtins/ja/policies/coding.md +++ b/builtins/ja/policies/coding.md @@ -13,6 +13,7 @@ | ファイルサイズ | 目安として300行。タスクに応じて柔軟に | | ボーイスカウト | 触った箇所は少し改善して去る | | Fail Fast | エラーは早期に検出。握りつぶさない | +| プロジェクトスクリプト優先 | ツール実行はプロジェクト定義のスクリプトを使う。直接実行は最後の手段 | ## フォールバック・デフォルト引数の禁止 @@ -288,3 +289,4 @@ function formatPercentage(value: number): string { ... } - **内部実装のパブリック API エクスポート** - 公開するのはドメイン操作の関数・型のみ。インフラ層の関数や内部クラスをエクスポートしない - **リファクタリング後の旧コード残存** - 置き換えたコード・エクスポートは削除する。明示的に残すよう指示されない限り残さない - **安全機構を迂回するワークアラウンド** - 根本修正が正しいなら追加の迂回は不要 +- **プロジェクトスクリプトを迂回するツール直接実行** - `npx tool` 等の直接実行は lockfile を迂回しバージョン不一致を起こす。プロジェクトが定義したスクリプト(npm scripts, Makefile 等)を探して使う。見つからない場合のみ直接実行を検討する