paulpas/agent-skill-router/design-pattern-anti-patterns

Claude Code and agent skill by paulpas/agent-skill-router

Trust tier 2
  • community
  • ext:[{"type":"config","description":"Configuration overrides"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Identifies and remediates anti-patterns arising from misuse of GoF design patterns including over-engineering, gold plating, dependency inversion violations, and structural code smells in Python systems.

Install

npx vskill@latest install paulpas/agent-skill-router/design-pattern-anti-patterns

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as paulpas/agent-skill-router/design-pattern-anti-patterns.

Design Pattern Anti-Patterns & Code Smells

Senior engineer auditing code for design pattern misuse and SOLID principle violations. This skill makes the model recognize when GoF patterns are applied incorrectly — over-engineered, under-justified, or structurally harmful — and provide concrete remediation that collapses unnecessary abstractions while preserving legitimate extensibility points.

TL;DR Checklist

  • [ ] Count GoF patterns per module; more than 3 without clear responsibility separation is a red flag
  • [ ] Verify every interface has at least one concrete current consumer (no phantom polymorphism)
  • [ ] Check that Factory classes have non-trivial creation logic (simple __init__ does not justify a factory)
  • [ ] Audit Singleton usage — only appropriate for true shared resources with controlled lifecycle
  • [ ] Replace inheritance-based Template Method with composition-based Strategy when variation is behavioral
  • [ ] Ensure each class has exactly one reason to change (SRP) and no hidden global coupling

When to Use

Use this skill when:

  • A codebase feels over-factored — too many interfaces, factories, or wrapper layers for simple operations
  • New developers struggle to trace what happens because behavior is split across ten classes instead of one function
  • Code reviews repeatedly flag "this could be simpler" comments on specific modules
  • A team has adopted design patterns dogmatically without understanding when each pattern earns its keep
  • Technical debt audits reveal factories, observers, and decorators layered atop straightforward logic

When NOT to Use

Avoid this skill for:

  • Critiquing algorithmic efficiency or data structure choices — use coding-algorithms instead
  • Evaluating API surface design or HTTP endpoint structure — that is an API architecture concern
  • Analyzing runtime behavior issues like memory leaks or race conditions — those are debugging tasks
  • Codebases that genuinely require the patterns being critiqued (e.g., a plugin system with 50+ independently loaded modules)

Core Workflow

  1. Scan for pattern overuse — Count how many GoF patterns are employed in a single module or class hierarchy. If more than three distinct patterns coexist without clear separation of concern, flag for review. Check the number of interfaces defined per implementation class. Checkpoint: Does each declared interface have at least one concrete consumer?
  1. Check for YAGNI violations — Identify abstractions that exist solely for hypothetical future needs: extra interfaces with zero implementations, unused factory classes, phantom strategies that no caller instantiates. Trace every import and constructor argument to verify the abstraction is actually exercised. Checkpoint: Is there a concrete current use case justifying this abstraction?
  1. Audit SOLID compliance — Verify SRP (can you describe what this class does in one sentence without "and"?), LSP (can any subclass replace its parent without changing program behavior?), and DIP (do high-level modules depend on abstractions, not concretions?). Check OCP (can new behaviors be added without modifying existing code?). Checkpoint: Can you add a new payment processor or shipping method without touching the core order processing class?
  1. Remediate detected anti-patterns — Apply the specific remediation strategy for each identified issue: collapse unnecessary hierarchies, inline over-factored methods, replace phantom abstractions with direct calls. Prioritize by severity — fix blocking issues first (hidden coupling, impossible-to-test classes), then nagging issues (unnecessary indirection). Checkpoint: Do all existing unit tests pass after the remediation?

Anti-Pattern Catalog

Gold Plating

Applying design patterns where simple code would suffice. Creating unnecessary factory layers, strategy interfaces, and observer chains for problems that do not need them. This is the most common GoF-related anti-pattern: the pattern fits a toy example but adds real cost to production code. It inflates complexity without delivering matching benefits.

python
# ❌ BAD — Gold plating: three layers of indirection for what amounts to loading config from JSON
class ConfigReader:
"""Interface that exists only because someone thought it might be useful."""
def read(self) -> dict: ...
class JsonConfigReader(ConfigReader):
def __init__(self, file_path: str) -> None:
self._path = file_path
def read(self) -> dict:
with open(self._path, "r") as f:
return json.load(f)
class ConfigReaderFactory:
"""Factory that creates exactly one type of reader. Zero flexibility gained."""
@staticmethod
def create(file_path: str) -> ConfigReader:
# Always returns JsonConfigReader — the abstraction adds nothing
return JsonConfigReader(file_path)
class AppConfig(ConfigReader):
"""Wraps the factory + interface just to follow "patterns" from a tutorial."""
def __init__(self, path: str) -> None:
self._reader = ConfigReaderFactory.create(path)
@property
def data(self) -> dict:
return self._reader.read()
def load_app_config(path: str) -> dict:
"""Caller needs to know about AppConfig class instead of just reading a file."""
app_config = AppConfig(path)
return app_config.data
# ✅ GOOD — Direct, simple, and does exactly what it says
import json
from pathlib import Path
def load_app_config(file_path: str) -> dict:
"""Load application configuration from a JSON file.
Args:
file_path: Absolute or relative path to the configuration file.
Returns:
Parsed configuration as a dictionary.
Raises:
FileNotFoundError: If the configuration file does not exist.
json.JSONDecodeError: If the file contains invalid JSON.
"""
with open(file_path, "r", encoding="utf-8") as f:
return json.load(f)

Why this is worse: Gold plating creates 4 classes and 2 factory methods for what should be a single function call. Every future developer must navigate through AppConfig → ConfigReaderFactory → JsonConfigReader → ConfigReader to understand how config loads. The "extension point" (adding XML config) was never needed and likely never will be — it was designed for a hypothetical future that may never arrive.

When this occurs: Developers who learned design patterns from tutorials or books often apply them reflexively, assuming every problem is the toy example from the pattern documentation. Code reviews that reward "good architectural practices" without scrutinizing actual need amplify this problem.


Over-Engineering / Over-Abstraction

Designing abstractions for hypothetical future requirements rather than current needs. Too many interface levels, phantom polymorphism, and excessive indirection through patterns when direct calls would work. The code becomes harder to read, harder to debug, and harder to modify correctly because the real logic is buried under layers of indirection.

python
# ❌ BAD — Over-abstraction: five layers deep for simple email sending
class EmailMessage(Protocol):
"""Abstract message contract that adds no value over a dataclass."""
@property
def recipient(self) -> str: ...
@property
def subject(self) -> str: ...
@property
def body(self) -> str: ...
class MessageBuilder(Protocol):
"""Abstract builder for messages that have no complex construction logic."""
def build(self) -> EmailMessage: ...
class SimpleMessageBuilder(MessageBuilder):
"""The only implementation — builder pattern overkill for immutable data."""
def __init__(self, recipient: str, subject: str, body: str) -> None:
self._recipient = recipient
self._subject = subject
self._body = body
def build(self) -> EmailMessage:
return EmailData(self._recipient, self._subject, self._body)
class EmailData(EmailMessage):
def __init__(self, recipient: str, subject: str, body: str) -> None:
self._recipient = recipient
self._subject = subject
self._body = body
@property
def recipient(self) -> str: return self._recipient
@property
def subject(self) -> str: return self._subject
@property
def body(self) -> str: return self._body
class EmailTransport(Protocol):
"""Abstract transport layer for sending messages."""
def send(self, message: EmailMessage) -> None: ...
class SmtpEmailTransport(EmailTransport):
"""Only email transport ever used — the abstraction prevents testing by hiding SMTP details."""
def __init__(self, smtp_host: str = "localhost", smtp_port: int = 587) -> None:
self._smtp_host = smtp_host
self._smtp_port = smtp_port
def send(self, message: EmailMessage) -> None:
# Complex SMTP logic buried here — but we can't test without a real server
import smtplib
server = smtplib.SMTP(self._smtp_host, self._smtp_port)
server.starttls()
server.send_message(message.body) # type: ignore[attr-defined]
server.quit()
class EmailNotificationService:
"""Coordinates builder + transport through the protocol layers."""
def __init__(self, transport: EmailTransport) -> None:
self._transport = transport
def send_welcome_email(self, recipient: str, name: str) -> None:
builder = SimpleMessageBuilder(recipient, f"Welcome, {name}!", f"Hi {name}, welcome!")
message = builder.build()
self._transport.send(message)
# ✅ GOOD — Straightforward function that is easy to read, test, and modify
import smtplib
from dataclasses import dataclass
@dataclass(frozen=True)
class EmailMessage:
recipient: str
subject: str
body: str
def send_welcome_email(recipient: str, name: str, *, smtp_host: str = "localhost") -> None:
"""Send a welcome email to a new user.
Args:
recipient: The recipient's email address.
name: The recipient's display name.
smtp_host: SMTP server hostname (default: localhost).
Raises:
smtplib.SMTPException: If the email cannot be delivered.
"""
subject = f"Welcome, {name}!"
body = f"Hi {name}, welcome!"
message = EmailMessage(recipient, subject, body)
with smtplib.SMTP(smtp_host, 587) as server:
server.starttls()
# In production, authenticate here — but the test can mock smtplib.SMTP directly
server.sendmail("noreply@example.com", [recipient], f"Subject: {subject}\n\n{body}")

Why this is worse: The over-abstracted version has 7 classes and 2 protocols for a single email-sending operation. Testing requires either mocking EmailTransport or spinning up a test SMTP server. Adding a new message format means creating new concrete builders, transports, and factories — not because the current code lacks flexibility, but because the abstraction was designed for flexibility that doesn't exist yet.

When this occurs: Teams working on greenfield projects often design "extensible" systems before they know what needs extension. The result is a framework that solves problems which don't exist while creating real problems with testing and debugging that do.


Dependency Inversion Violation

High-level modules depending on low-level concrete implementations directly, or the opposite: forcing dependency injection everywhere even for simple utility classes where it adds boilerplate without benefit. DIP should reduce coupling, but inverted incorrectly it either increases coupling or creates DI container bloat.

python
# ❌ BAD — High-level module depends on low-level concrete class directly
import sqlite3
class DatabaseConnection(sqlite3.Connection):
"""Concrete database connection — hard dependency on SQLite implementation."""
def __init__(self, db_path: str) -> None:
super().__init__(db_path)

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 93 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
4
7-day trend score
8

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • configConfiguration overrides

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/paulpas/agent-skill-router/design-pattern-anti-patterns/badge)](https://verified-skill.com/skills/paulpas/agent-skill-router/design-pattern-anti-patterns)

Something wrong with this skill or its page? Tell us.