# Other Smells

> Smells that do not fit the main groups, currently the gap left when a library class you cannot edit lacks an operation you need.

- kind: category
- category: refactoring
- canonical: https://aipatterns.dev/refactoring/smells/other
- inspired-by: https://refactoring.guru/refactoring/smells/other

## What these smells share

This group holds smells that cross the boundaries of the main categories. The current member concerns code you do not own. You cannot refactor a third-party or generated class directly, so the usual moves, such as adding a method where the data lives, are not available. The smell is in how your code works around that limit.

## Members

- [Incomplete Library Class](https://aipatterns.dev/refactoring/smells/incomplete-library-class.md): a library type lacks a method you need, and workarounds for it are duplicated across your code.

## How to choose within this category

- If the type you want to change is yours, this is not the right category. Look at [Feature Envy](https://aipatterns.dev/refactoring/smells/feature-envy.md) or [Duplicate Code](https://aipatterns.dev/refactoring/smells/duplicate-code.md) instead.
- If the type is from a library and you need one or two extra operations, treat it as [Incomplete Library Class](https://aipatterns.dev/refactoring/smells/incomplete-library-class.md) with [Introduce Foreign Method](https://aipatterns.dev/refactoring/techniques/introduce-foreign-method.md).
- If you need many extra operations on the same library type, use [Introduce Local Extension](https://aipatterns.dev/refactoring/techniques/introduce-local-extension.md), or an [Adapter](https://aipatterns.dev/design-patterns/adapter.md) when you also want to hide the library's interface.

## For agents

- Check whether an installed dependency or a newer version of the library already provides the operation before writing one.
- Use the language's extension mechanism where one exists: C# extension methods, Kotlin extension functions, Swift extensions, Rust traits.
- Never patch the library's prototype or vendored source to add the method.
