Skip to main content

anti-patterns

Common software anti-patterns, code smells, and how to avoid them

跳到安装

来源信息

仓库
NeuralBlitz/Mito
最近来源活动
2026年3月22日 13:29
检测到的 SKILL.md 语言
英语
星标
0
分支
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
anti-patterns
description
Common software anti-patterns, code smells, and how to avoid them
license
MIT
compatibility
opencode
metadata
{"audience":"developers","category":"software-development"}
## What I do - Identify code anti-patterns in existing code - Suggest refactoring solutions - Avoid common mistakes in design and implementation - Improve code quality and maintainability - Recognize technical debt indicators ## When to use me When reviewing code, improving designs, or fixing maintainability issues. ## Code Anti-Patterns ### Object-Oriented - **God Object**: Single class doing too much - **Spaghetti Code**: Unstructured, tangled control flow - **Magic Numbers**: Hard-coded values without constants - **Feature Envy**: Excessive use of another class's data - **Data Clumps**: Groups of variables passed together - **Refused Bequest**: Not using inherited methods - **Switch Statements**: Complex conditionals instead of polymorphism - **Parallel Inheritance**: Duplicate class hierarchies ### Design Anti-Patterns - **Singleton Abuse**: Overuse of singletons - **Dependency Hell**: Complex dependency chains - **Circular Dependencies**: A→B→C→A - **Interface Bloat**: Overly complex interfaces - **Leaky Abstractions**: Exposing internal details - **Golden Hammer**: Using one solution for everything - **Reinvention**: Not using built-in features - **Analysis Paralysis**: Over-planning ### Database Anti-Patterns - **Database as IPC**: Using DB for communication - **God Table**: One table for everything - **EAV**: Entity-Attribute-Value pattern - **Naive Enum**: Storing enums as strings without constraints - **Missing Indexes**: Slow queries due to full table scans - **N+1 Queries**: Loading related data inefficiently ### Concurrency - **Race Conditions**: Uncoordinated concurrent access - **Deadlock**: Circular wait dependencies - **Blocking Operations**: Synchronous calls in async code - **Shared Mutex**: Global locks causing contention ### Testing - **Testing the Implementation**: Instead of behavior - **Happy Path Only**: Only testing success cases - **Manual Testing**: No automated tests - **Tight Coupling**: Tests depend on implementation details ## Code Smells - Long methods - Large classes - Duplicate code - Long parameter lists - Primitive obsession - Data classes - Comments explaining bad code ## Refactoring Strategies - Extract Method - Move Method - Replace Conditional with Polymorphism - Introduce Parameter Object - Replace Magic Numbers - Extract Class - Inline Class - Introduce Null Object
在 GitHub 查看