antipattern-catalog
Document technical debt, anti-patterns, and patterns to avoid from analyzed frameworks. Use when (1) creating a "Do Not Repeat" list from framework analysis, (2) categorizing observed code smells and issues, (3) assessing severity of architectural problems, (4) generating remediation suggestions, or (5) synthesizing lessons learned across multiple frameworks.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o antipattern-catalog.zip https://jpskill.com/download/18848.zip && unzip -o antipattern-catalog.zip && rm antipattern-catalog.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18848.zip -OutFile "$d\antipattern-catalog.zip"; Expand-Archive "$d\antipattern-catalog.zip" -DestinationPath $d -Force; ri "$d\antipattern-catalog.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
antipattern-catalog.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
antipattern-catalogフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
アンチパターンカタログ
技術的負債と避けるべきパターンを文書化します。
プロセス
- 観測結果の収集 — フェーズ1および2の分析から問題点を集めます。
- 分類 — 構造、振る舞い、可観測性、パフォーマンスに分類します。
- 深刻度の評価 — 致命的、主要、軽微、外観に評価します。
- 改善策の生成 — 各パターンに対する修正案を提案します。
- チェックリストの作成 — 「繰り返さない」ためのガイドラインを作成します。
アンチパターンカテゴリ
構造的アンチパターン
コードの構成、継承、モジュール性に関する問題です。
| パターン | 症状 | 例 |
|---|---|---|
| 深い継承 | 5段階以上のクラス階層 | Agent → BaseAgent → RunnableAgent → ExecutableAgent → ... |
| 神クラス | 50以上のメソッドを持つ1つのクラス | ルーティング、実行、メモリ、ツールをすべて行う AgentExecutor |
| 循環依存 | モジュールAがBをインポートし、BがAをインポートする | agent.py ↔ tools.py |
| 漏洩する抽象化 | 実装の詳細が露出している | 基底クラスが特定のLLM応答形式を前提としている |
| 時期尚早な抽象化 | 柔軟性のために過剰に設計されている | 単一の実装に対して5つのインターフェース |
振る舞いのアンチパターン
実行時の振る舞いとロジックに関する問題です。
| パターン | 症状 | 例 |
|---|---|---|
| 隠れた状態変異 | 状態の変化が不明瞭 | tool.run() がエージェントのメモリを変更する |
| 暗黙の契約 | 文書化されていない前提 | ツールが特定のメッセージ形式を前提としている |
| サイレントな失敗 | エラーが飲み込まれる | ツール実行中の except: pass |
| 無限ループのリスク | 終了保証がない | エージェントループにステップ制限がない |
| 競合状態 | 状態への同時アクセス | ロックなしの共有辞書 |
可観測性のアンチパターン
デバッグと監視に関する問題です。
| パターン | 症状 | 例 |
|---|---|---|
| 隠れたLLM応答 | 生の応答にアクセスできない | トークン数が利用できない |
| 不透明なエラー | 一般的なエラーメッセージ | "Something went wrong" |
| トレーシングなし | 実行を追跡できない | リクエストID、スパンがない |
| コンテキストの消失 | 情報が失われる | ツールエラーがLLMにフィードバックされない |
| メトリクス不足 | パフォーマンスデータがない | レイテンシ、トークン、コストの追跡がない |
パフォーマンスのアンチパターン
速度とリソース使用量に影響する問題です。
| パターン | 症状 | 例 |
|---|---|---|
| 非同期中の同期 | 非同期コード内のブロッキング呼び出し | 非同期関数内の requests.get() |
| N+1クエリ | 類似する操作の繰り返し | 各ツール設定を個別にロードする |
| 無制限のメモリ | 履歴が永遠に増え続ける | エビクションポリシーがない |
| Eager Loading | 未使用のリソースをロードする | すべてのツールが起動時に初期化される |
| キャッシュなし | 高コストな操作の繰り返し | 呼び出しごとに同じスキーマを再解析する |
深刻度評価
致命的 (P0)
- セキュリティ脆弱性
- データ損失のリスク
- ガードなしの無限ループ
- 本番環境の停止リスク
主要 (P1)
- パフォーマンス問題 (2倍以上の速度低下)
- 不適切なエラー処理
- 拡張が困難
- 並行処理のバグ
軽微 (P2)
- コードスタイルの問題
- 軽微な非効率性
- ドキュメントの不足
- パターンの不整合
外観 (P3)
- 命名規則
- フォーマット
- 軽微な冗長性
カタログエントリテンプレート
### [パターン名]
**カテゴリ**: [Structural/Behavioral/Observability/Performance]
**深刻度**: [Critical/Major/Minor/Cosmetic]
**フレームワーク**: [どこで観測されたか]
#### 説明
[アンチパターンの簡単な説明]
#### 例
[問題を示すコードスニペット]
#### 影響
- [影響1]
- [影響2]
#### 改善策
[このパターンを修正または回避する方法]
#### コード例 (修正済み)
[修正されたコードスニペット]
一般的なアンチパターンの詳細
深い継承の地獄
問題:
class Agent(BaseAgent):
pass
class BaseAgent(RunnableAgent):
pass
class RunnableAgent(ExecutableAgent):
pass
class ExecutableAgent(ConfigurableAgent):
pass
class ConfigurableAgent(LoggableAgent):
pass
class LoggableAgent(ABC):
pass
# 6層!どのメソッドがどこから来ているのか?
改善策: 継承よりもコンポジションを優先する
class Agent:
def __init__(
self,
executor: Executor,
config: Config,
logger: Logger
):
self.executor = executor
self.config = config
self.logger = logger
サイレントなツール失敗
問題:
def run_tool(self, tool, args):
try:
return tool.execute(args)
except Exception:
return None # エラーが永遠に失われる!
改善策: エラーを捕捉して伝播させる
def run_tool(self, tool, args) -> ToolResult:
try:
output = tool.execute(args)
return ToolResult(success=True, output=output)
except Exception as e:
return ToolResult(
success=False,
error=f"{type(e).__name__}: {e}",
traceback=traceback.format_exc()
)
隠れたLLM応答
問題:
class LLMWrapper:
def generate(self, prompt: str) -> str:
response = self.client.chat(prompt)
return response.content # トークン数、モデル情報が失われる!
改善策: 完全な応答を公開する
class LLMWrapper:
def generate(self, prompt: str) -> LLMResponse:
response = self.client.chat(prompt)
return LLMResponse(
content=response.content,
model=response.model,
usage=TokenUsage(
prompt=response.usage.prompt_tokens,
completion=response.usage.completion_tokens
),
raw=response # 常に生データを保持する
)
出力テンプレート
# アンチパターンカタログ: [分析名]
## 要約
| 深刻度 | 件数 |
|----------|-------|
| 致命的 | 2 |
| 主要 | 5 |
| 軽微 | 8 |
| 外観 | 3 |
## 致命的な問題
### 1. [パターン名]
[完全なカタログエントリ]
### 2. [パターン名]
[完全なカタログエントリ]
## 主要な問題
### 1. [パターン名]
[完全なカタログエントリ]
...
## 繰り返さない 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Anti-Pattern Catalog
Documents technical debt and patterns to avoid.
Process
- Collect observations — Gather issues from Phase 1 & 2 analyses
- Categorize — Structural, behavioral, observability, performance
- Assess severity — Critical, major, minor, cosmetic
- Generate remediation — Suggest fixes for each pattern
- Create checklist — "Do Not Repeat" guidelines
Anti-Pattern Categories
Structural Anti-Patterns
Issues with code organization, inheritance, and modularity.
| Pattern | Symptom | Example |
|---|---|---|
| Deep Inheritance | 5+ levels of class hierarchy | Agent → BaseAgent → RunnableAgent → ExecutableAgent → ... |
| God Class | One class with 50+ methods | AgentExecutor doing routing, execution, memory, tools |
| Circular Dependencies | Module A imports B, B imports A | agent.py ↔ tools.py |
| Leaky Abstraction | Implementation details exposed | Base class assumes specific LLM response format |
| Premature Abstraction | Over-engineered for flexibility | 5 interfaces for a single implementation |
Behavioral Anti-Patterns
Issues with runtime behavior and logic.
| Pattern | Symptom | Example |
|---|---|---|
| Hidden State Mutation | State changes not obvious | tool.run() modifies agent's memory |
| Implicit Contracts | Undocumented assumptions | Tools assume specific message format |
| Silent Failures | Errors swallowed | except: pass in tool execution |
| Infinite Loop Risk | No termination guarantee | No step limit on agent loop |
| Race Conditions | Concurrent state access | Shared dict without locks |
Observability Anti-Patterns
Issues with debugging and monitoring.
| Pattern | Symptom | Example |
|---|---|---|
| Hidden LLM Response | Raw response not accessible | Token counts unavailable |
| Opaque Errors | Generic error messages | "Something went wrong" |
| No Tracing | Can't follow execution | No request IDs, no spans |
| Swallowed Context | Information lost | Tool error not fed back to LLM |
| Missing Metrics | No performance data | No latency, token, or cost tracking |
Performance Anti-Patterns
Issues affecting speed and resource usage.
| Pattern | Symptom | Example |
|---|---|---|
| Sync in Async | Blocking calls in async code | requests.get() in async function |
| N+1 Queries | Repeated similar operations | Loading each tool config separately |
| Unbounded Memory | History grows forever | No eviction policy |
| Eager Loading | Loading unused resources | All tools initialized at startup |
| No Caching | Repeated expensive operations | Re-parsing same schema each call |
Severity Assessment
Critical (P0)
- Security vulnerabilities
- Data loss risk
- Infinite loops without guards
- Production outage risk
Major (P1)
- Performance issues >2x slowdown
- Poor error handling
- Difficult to extend
- Concurrency bugs
Minor (P2)
- Code style issues
- Minor inefficiencies
- Documentation gaps
- Inconsistent patterns
Cosmetic (P3)
- Naming conventions
- Formatting
- Minor redundancy
Catalog Entry Template
### [Pattern Name]
**Category**: [Structural/Behavioral/Observability/Performance]
**Severity**: [Critical/Major/Minor/Cosmetic]
**Framework(s)**: [Where observed]
#### Description
[Brief explanation of the anti-pattern]
#### Example
[Code snippet showing the problem]
#### Impact
- [Impact 1]
- [Impact 2]
#### Remediation
[How to fix or avoid this pattern]
#### Code Example (Fixed)
[Corrected code snippet]
Common Anti-Patterns Deep Dive
Deep Inheritance Hell
Problem:
class Agent(BaseAgent):
pass
class BaseAgent(RunnableAgent):
pass
class RunnableAgent(ExecutableAgent):
pass
class ExecutableAgent(ConfigurableAgent):
pass
class ConfigurableAgent(LoggableAgent):
pass
class LoggableAgent(ABC):
pass
# 6 layers! Which method comes from where?
Remediation: Prefer composition over inheritance
class Agent:
def __init__(
self,
executor: Executor,
config: Config,
logger: Logger
):
self.executor = executor
self.config = config
self.logger = logger
Silent Tool Failures
Problem:
def run_tool(self, tool, args):
try:
return tool.execute(args)
except Exception:
return None # Error lost forever!
Remediation: Capture and propagate errors
def run_tool(self, tool, args) -> ToolResult:
try:
output = tool.execute(args)
return ToolResult(success=True, output=output)
except Exception as e:
return ToolResult(
success=False,
error=f"{type(e).__name__}: {e}",
traceback=traceback.format_exc()
)
Hidden LLM Response
Problem:
class LLMWrapper:
def generate(self, prompt: str) -> str:
response = self.client.chat(prompt)
return response.content # Token counts, model info lost!
Remediation: Expose full response
class LLMWrapper:
def generate(self, prompt: str) -> LLMResponse:
response = self.client.chat(prompt)
return LLMResponse(
content=response.content,
model=response.model,
usage=TokenUsage(
prompt=response.usage.prompt_tokens,
completion=response.usage.completion_tokens
),
raw=response # Always keep raw
)
Output Template
# Anti-Pattern Catalog: [Analysis Name]
## Summary
| Severity | Count |
|----------|-------|
| Critical | 2 |
| Major | 5 |
| Minor | 8 |
| Cosmetic | 3 |
## Critical Issues
### 1. [Pattern Name]
[Full catalog entry]
### 2. [Pattern Name]
[Full catalog entry]
## Major Issues
### 1. [Pattern Name]
[Full catalog entry]
...
## Do Not Repeat Checklist
- [ ] Never use more than 3 levels of inheritance
- [ ] Always expose raw LLM response with token counts
- [ ] Never swallow exceptions without logging
- [ ] Always include step limits on agent loops
- [ ] Never mutate shared state without locks
- [ ] Always provide structured error feedback to LLM
...
Integration
- Inputs from: All Phase 1 & 2 analysis skills
- Feeds into:
architecture-synthesisfor design decisions - Related:
comparative-matrixfor pattern comparison