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 等)を探して使う。見つからない場合のみ直接実行を検討する