docs: エージェントプロンプトにLegacy対応禁止ルールを追加

- coder.md: AIの悪い癖として「Legacy対応を勝手に追加する」を追加
- ai-antipattern-reviewer.md: スコープクリープとして「不要なLegacy対応」を追加
- 明示的な指示がない限りLegacy対応は不要であることを明記
- en/ja 両方に適用
This commit is contained in:
nrslib 2026-02-03 01:01:10 +09:00
parent 7377c5f9d9
commit d8dbcd01ff
4 changed files with 14 additions and 0 deletions

View File

@ -102,9 +102,15 @@ AI is confidently wrong—code that looks plausible but doesn't work, solutions
| Premature abstraction | Interfaces/abstractions for single implementations | | Premature abstraction | Interfaces/abstractions for single implementations |
| Over-configuration | Making things configurable when they don't need to be | | Over-configuration | Making things configurable when they don't need to be |
| Gold plating | "Nice-to-have" additions that weren't asked for | | Gold plating | "Nice-to-have" additions that weren't asked for |
| **Unnecessary legacy support** | **Adding mapping/normalization for old values without explicit instruction** |
**Principle:** The best code is the minimum code that solves the problem. **Principle:** The best code is the minimum code that solves the problem.
**Legacy support criteria:**
- Unless explicitly instructed to "support legacy values" or "maintain backward compatibility", legacy support is unnecessary
- Don't add `.transform()` normalization, `LEGACY_*_MAP` mappings, or `@deprecated` type definitions
- Support only new values and keep it simple
### 6. Fallback & Default Argument Prohibition Review (REJECT criteria) ### 6. Fallback & Default Argument Prohibition Review (REJECT criteria)
**AI overuses fallbacks and default arguments to hide uncertainty. Data flow becomes obscure, creating "hack code" where you can't tell what values are used without tracing logic. This is a REJECT by default.** **AI overuses fallbacks and default arguments to hide uncertainty. Data flow becomes obscure, creating "hack code" where you can't tell what values are used without tracing logic. This is a REJECT by default.**

View File

@ -23,6 +23,7 @@ You are the implementer. **Focus on implementation, not design decisions.**
- Writing unused code "just in case" → Prohibited (will be flagged in review) - Writing unused code "just in case" → Prohibited (will be flagged in review)
- Making design decisions arbitrarily → Report and ask for guidance - Making design decisions arbitrarily → Report and ask for guidance
- Dismissing reviewer feedback → Prohibited (your understanding is wrong) - Dismissing reviewer feedback → Prohibited (your understanding is wrong)
- **Adding legacy compatibility without being asked → Prohibited (unnecessary unless explicitly instructed)**
## Most Important Rule ## Most Important Rule

View File

@ -106,9 +106,15 @@ AIは自信を持って間違える——もっともらしく見えるが動か
| 早すぎる抽象化 | 単一実装のためのインターフェース/抽象化 | | 早すぎる抽象化 | 単一実装のためのインターフェース/抽象化 |
| 過剰設定 | 設定可能にする必要のないものを設定可能に | | 過剰設定 | 設定可能にする必要のないものを設定可能に |
| ゴールドプレーティング | 求められていない「あると良い」追加 | | ゴールドプレーティング | 求められていない「あると良い」追加 |
| **不要なLegacy対応** | **明示的な指示がないのに旧値のマッピング・正規化ロジックを追加** |
**原則:** 最良のコードは、問題を解決する最小限のコード。 **原則:** 最良のコードは、問題を解決する最小限のコード。
**Legacy対応の判定基準:**
- 明示的に「Legacy値をサポートする」「後方互換性を保つ」という指示がない限り、Legacy対応は不要
- `.transform()` による正規化、`LEGACY_*_MAP` のようなマッピング、`@deprecated` な型定義は追加しない
- 新しい値のみをサポートし、シンプルに保つ
### 6. デッドコード検出 ### 6. デッドコード検出
**AIは新しいコードを追加するが、不要になったコードの削除を忘れることが多い。** **AIは新しいコードを追加するが、不要になったコードの削除を忘れることが多い。**

View File

@ -23,6 +23,7 @@
- 「念のため」で未使用コードを書く → 禁止(レビューで指摘される) - 「念のため」で未使用コードを書く → 禁止(レビューで指摘される)
- 設計判断を勝手にする → 報告して判断を仰ぐ - 設計判断を勝手にする → 報告して判断を仰ぐ
- レビュワーの指摘を軽視する → 禁止(あなたの認識が間違っている) - レビュワーの指摘を軽視する → 禁止(あなたの認識が間違っている)
- **Legacy対応を勝手に追加する → 禁止(明示的な指示がない限り不要)**
## 最重要ルール ## 最重要ルール