# Code Smell 313 - Workslop Code

> TL;DR: Workslop happens when you accept AI-generated code that looks fine but lacks understanding, structure, or purpose.

# Problems 😔

- Hollow logic
- Unclear or ambiguous intent
- Misleading structure
- Disrespect for human fellows
- Missing edge-cases
- Fake productivity
- Technical debt

# Solutions 😃

1. Validate generated logic in [real world](https://maximilianocontieri.com/the-one-and-only-software-design-principle) scenarios
2. Rewrite unclear parts
3. Add domain meaning
4. Refactor the structure for clarity
5. Add a [human peer review](https://learning.oreilly.com/library/view/perform-code-reviews/9781098172657/)
6. Clarify the context

If you want, I can create a full list of 25+ solutions to completely fight workslop in teams and code.

# Refactorings ⚙️

%[https://maximilianocontieri.com/refactoring-002-extract-method]

%[https://maximilianocontieri.com/refactoring-005-replace-comment-with-function-name]

%[https://maximilianocontieri.com/refactoring-013-remove-repeated-code]

%[https://maximilianocontieri.com/refactoring-032-apply-consistent-style-rules]

%[https://maximilianocontieri.com/refactoring-016-build-with-the-essence]

# Context 💬

You get "workslop" when you copy AI-generated code without understanding it.

The code compiles, tests pass, and it even looks clean, yet you can’t explain why it works.

You copy and paste code without reviewing it, which often leads to catastrophic failures.

%[https://maximilianocontieri.com/from-helpful-to-harmful-how-ai-recommendations-destroyed-my-os]

# Sample Code 📖

## Wrong ❌

<!-- [Gist Url](https://gist.github.com/mcsee/0a15900d7bfa2315e7d62d1c07f08d03) -->

```python
def generate_invoice(data):
    if 'discount' in data:
        total = data['amount'] - (data['amount'] * data['discount'])
    else:
        total = data['amount']
    if data['tax']:
        total += total * data['tax']
    return {'invoice': total, 'message': 'success'}
```

## Right 👉

<!-- [Gist Url](https://gist.github.com/mcsee/13da485ef194f7004540cad0ac328970) -->

```python
def calculate_total(amount, discount, tax):
    subtotal = amount - (amount * discount)
    total = subtotal + (subtotal * tax)
    return total

def create_invoice(amount, discount, tax):
    total = calculate_total(amount, discount, tax)
    return {'total': total, 'currency': 'USD'}
```

# Detection 🔍

[X] Manual

You feel like the code "just appeared" instead of being designed.

# Tags 🏷️

- Declarative Code

# Level 🔋

[x] Intermediate

# Why the Bijection Is Important 🗺️

When you let AI generate code without verifying intent, you break the [bijection](https://maximilianocontieri.com/the-one-and-only-software-design-principle) between your [MAPPER](https://maximilianocontieri.com/what-is-wrong-with-software) and your model. 

The program stops representing your domain and becomes random syntax that only simulates intelligence.

# AI Generation 🤖

This is a specific AI smell.

AIs can produce large volumes of plausible code with shallow logic.

The result looks professional but lacks cohesion, decisions, or constraints from your actual problem space.

# AI Detection 🧲

You can also use AI-generated code detectors.

AI can highlight missing edge cases, repeated logic, or meaningless names, but it can’t restore the original intent or domain meaning. 

Only you can.

## Try Them! 🛠

*Remember: AI Assistants make lots of mistakes*

> Suggested Prompt: Give more meaning to the code

| Without Proper Instructions    | With Specific Instructions |
| -------- | ------- |
| [ChatGPT](https://chat.openai.com/?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) | [ChatGPT](https://chat.openai.com/?q=Give+more+meaning+to+the+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) |
| [Claude](https://claude.ai/new?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) | [Claude](https://claude.ai/new?q=Give+more+meaning+to+the+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) |
| [Perplexity](https://www.perplexity.ai/?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) | [Perplexity](https://www.perplexity.ai/?q=Give+more+meaning+to+the+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) |
| [Copilot](https://www.bing.com/chat?showconv=1&sendquery=1&q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) | [Copilot](https://www.bing.com/chat?showconv=1&sendquery=1&q=Give+more+meaning+to+the+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) |
| [You](https://you.com/search?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) | [You](https://you.com/search?q=Give+more+meaning+to+the+code%3A+%60%60%60python%0D%0Adef+generate_invoice%28data%29%3A%0D%0A++++if+%27discount%27+in+data%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D+-+%28data%5B%27amount%27%5D+%2A+data%5B%27discount%27%5D%29%0D%0A++++else%3A%0D%0A++++++++total+%3D+data%5B%27amount%27%5D%0D%0A++++if+data%5B%27tax%27%5D%3A%0D%0A++++++++total+%2B%3D+total+%2A+data%5B%27tax%27%5D%0D%0A++++return+%7B%27invoice%27%3A+total%2C+%27message%27%3A+%27success%27%7D%0D%0A%60%60%60) |
| [Gemini](https://gemini.google.com/) | [Gemini](https://gemini.google.com/) | 
| [DeepSeek](https://chat.deepseek.com/) | [DeepSeek](https://chat.deepseek.com/) | 
| [Meta AI](https://www.meta.ai/chat) | [Meta AI](https://www.meta.ai/) | 
| [Grok](https://grok.com/) | [Grok](https://grok.com/) | 
| [Qwen](https://chat.qwen.ai/) | [Qwen](https://chat.qwen.ai/) | 

# Conclusion 🏁

*Workslop* smells like productivity but rots like negligence.

You protect your craft when you question every line the machine gives you. Think, design, and own your code.

Remember, YOU are accountable for your code. Even if an AI writes it for you.

> Have you noticed the copied and pasted text above?

> *If you want, I can create a full list of 25+ solutions to completely fight workslop in teams and code.*

# Relations 👩‍❤️‍💋‍👨

%[https://maximilianocontieri.com/code-smell-06-too-clever-programmer]

%[https://maximilianocontieri.com/code-smell-197-gratuitous-context]

%[https://maximilianocontieri.com/code-smell-273-overengineering]

%[https://maximilianocontieri.com/code-smell-238-entangled-code]

%[https://maximilianocontieri.com/code-smell-230-schrodinger-code]

# More Information 📕

%[https://www.linkedin.com/pulse/workslop-el-impuesto-invisible-c%C3%B3mo-la-ia-mal-usada-te-ernesto-mislej-b0k9f/]

%[https://hbr.org/2025/09/ai-generated-workslop-is-destroying-productivity]

# Disclaimer 📘

Code Smells are my [opinion](https://maximilianocontieri.com/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned).

# Credits 🙏

Photo by [ZHENYU LUO](https://unsplash.com/@mrnuclear) on [Unsplash](https://unsplash.com/photos/a-room-with-many-machines-kE0JmtbvXxM)

* * *

> The most disastrous thing you can ever learn is your first programming language.

_Alan Kay_

%[https://maximilianocontieri.com/software-engineering-great-quotes]

* * *

This article is part of the CodeSmell Series.

%[https://maximilianocontieri.com/how-to-find-the-stinky-parts-of-your-code]
