eugenemind.com
← Back to blog

November 21, 2026 · 35 min read

What AI slop is and how to reduce it

#ai #ai-agents #code-review #architecture

Lately I keep noticing one unpleasant side of working with AI agents. Writing code has become much easier. Sometimes in a few minutes you get an implementation that used to take a whole day.

Reading, checking and maintaining that code has not become any easier.

An agent can create several classes, add abstractions, cover everything with tests and get the project to build. Task done. Then you open the diff and see that instead of a small change you got an entire system you still have to figure out.

Sometimes it looks neat. Good names, small functions, protocols, separation of concerns. You can’t fault any single line. So why was this whole construction needed?

What counts as AI slop

Here AI slop means code from an agent that works but fits poorly into the project. It is expensive to understand, check and change, and the task does not justify that. It usually comes in three forms.

AI slopcode from an agent works but fits poorly into the project
  • Overengineeringextra layers and abstractions "for the future"For example, a factory for a single variant or types that only pass the call along
  • Its own solutionthe project already solved the problem, but the agent does it its own wayFor example, a second network client or its own approach to error handling
  • Hard for a person to readclear to the agent, heavy for a humanFor example, one concept under three names or simple logic spread across files
All forms have the same cost. Such code is expensive to understand, check and change.

Overengineering. The most visible form. The agent adds extra layers and abstractions “for the future”. It can be subtler too. A simple operation is spread across several types that only pass the call along. Error handling logic lives apart from the part of the app that actually decides what to do when something fails.

Its own solution. The project has already solved the problem, but the agent does it its own way. For example, the project has an agreed approach to error handling, and the agent invents its own. The code works, but it diverges from the rest of the project for no reason. A separate document with key examples showing where to look would probably help here. But the agent can ignore that too.

Hard for a person to read. Human readability matters to me. Code should be understood not only by an agent but also by a person. Sometimes code works and is not overengineered, yet a person still finds it hard to read. One business term goes by three different names. Names drift away from how the team talks about the task, and simple logic has to be pieced together from several files. A linter can barely measure this. A glossary of domain terms and screen names partly helps here. Then the code at least speaks the language of the task.

A protocol, a long method or a separate actor proves nothing on its own. What matters is the constraints of the task and the solutions that already exist. Sometimes an extra layer is needed for security, testability or API compatibility. So I don’t really believe in a universal checklist that declares an architecture bad by the number of types or lines.

This is why it has become hard to tell whether you are looking at AI slop or not. Without experience in the domain and a good understanding of the task, it is easy to mistake an extra layer for a needed one, and a needed one for an extra one.

Here is roughly how I tell similar solutions apart.

Looks like AI slopMay be justified
A factory and a strategy for a single scenarioA protocol at a module boundary to swap a dependency in tests
A second networking layer next to the existing oneA separate layer for security or API compatibility
Caching on a screen where nobody asked for itA save queue so file writes don’t overwrite each other
Types that only pass the call alongData format migration between versions

Groundwork for the future or AI slop

An agent almost always explains an extra layer by the future. I check such groundwork with a few questions.

QuestionMore likely needed architectureMore likely AI slop
Is there a second case alreadyTwo real implementations, for example file storage and in-memory storage for testsA factory with a single option
Is it expensive to add this laterThe format of saved data, a public API, a schema versionAn internal class that is easy to extract when needed
Does the task require itA data migration the task requiresSync when the task says plainly there is no backend
Does it protect a boundarySwapping the clock so tests don’t depend on real timeA protocol nobody swaps
Who decided itA team decision written down in an ADR or the taskAn agent comment saying “for the future”

The second question matters most to me. Internal code is easy to make more complex later, when a real need shows up. But a data format that already sits on users’ devices, or a public API, is expensive to change, so that kind of groundwork is better done right away. In the experiment below one reviewer got exactly this wrong. It called the data schema version unnecessary groundwork, even though there were already two formats and the migration was required.

These problems are familiar. What has changed is how fast they pile up. A developer who knows the feature well may accept a large diff without having time to read it carefully. And someone from another stack can now change a Swift module while knowing almost nothing about its history. In both cases a compiling result arrives faster than the confidence that it will be easy to maintain.

There is a flip side. A person can’t always tell whether they’re looking at AI slop. If it’s not their domain, or they’ve never written code at all, a tidy diff looks convincing. It becomes clear later, when the feature has to change or when more bugs start showing up in that part of the app.

First I tried to solve it with a single skill

My first idea was an anti-neuroslop skill for Swift. A skill here means a set of instructions the agent loads for a specific task. I collected the rules I’d want to see in a review myself. For example, look for a similar implementation before creating a new one, stick to domain names, avoid huge functions, tangled nesting and excessive error handling. I added limits on abstractions and new states.

Once I tried to make this list universal, everything started to blur together. SwiftLint already checks method length and some formatting rules. Behavior that must not break should be protected by tests. And a rule like “don’t create an unnecessary protocol” quickly turns into a matter of taste in a real project. Sometimes even a protocol with a single implementation guards an important boundary.

If I break down my original list, some of the signs can be covered by tools. The rest still stays with review.

What I consider AI slopWhat can limit itWhat is left for review
Deep nesting of conditions and typesSwiftLint cyclomatic_complexity, nestingWhether the logic itself justifies the complex branch
Huge functions and typesfunction_body_length, type_body_length, file_lengthWhether the function was cut into pieces that only pass the call along
Unnecessary do/catch and swallowed errorscustom_rules for an empty catch and try? in selected modulesWhere the error should really be handled
A second network client, direct URLSession.sharedcustom_rules, Swift Package target boundariesWhy the agent didn’t find the existing client
Copy-pasteduplication detectors such as PMD CPDWhether it’s one rule spread across two places or two different rules
A factory for a single strategy, pass-through layersalmost nothing automaticIndependent review and knowledge of the task
Code that is hard for a person to readpartly a glossary and naming rulesWhether the code makes sense to someone who didn’t write it
Three names for one terma glossary in the repositoryChecking against the glossary during review

A ban on overengineering is especially hard to phrase. You can ask the agent to pick the simplest solution, yet it can convincingly explain why every new manager is necessary. Without knowing the original task and the neighboring code, there’s no way to verify that judgment.

Of the original idea, I kept the part that can’t be reliably formalized and started looking for other ways to reduce how much unnecessary complexity appears.

Approaches I found elsewhere

I watched several talks from the AI Engineer CODE 2026 conference. Separately I read Matt Pocock’s materials and Robert Martin’s posts. Everyone’s approaches are quite different.

Talks from AI Engineer CODE 2026

AuthorWhat they do about the problem
Lauren TanTurns recurring rules into constraints in the API and the dependency graph, plus automated checks.
Dmitry BuykinRegularly cleans up a growing system and checks changes against real scenarios.
Brian DouglasKeeps the comments of experienced colleagues so the next agents don’t repeat old mistakes.

Lauren Tan’s talk is called “All Code Is Slop (Except Mine)”. The joke lands. Your own code almost always seems clear, while in someone else’s, especially code written by an agent, you want to rewrite something.

One case from Lauren Tan’s talk stuck with me, about React useEffect. Agents kept applying it where it caused problems. The team restricted direct use of useEffect in product code within their framework and kept the needed scenarios inside controlled APIs.

Incorrect imports between Electron main and renderer also started getting caught by a dependency analyzer and a linter. That way recurring review comments stopped depending on how attentive the next reviewer happened to be.

She had another good point. A codebase is like a garden. Agents look for patterns in existing code, and along with the good solutions they copy old workarounds. If a repository has five ways to do one operation, the next agent may add a sixth. Taking care of the codebase now also affects what the next agents will generate.

She also showed an inverted pyramid. Most of the effort should go into deterministic layers, meaning the code, types, linter and tests. The least should go into text rules. When the agent needs correcting, it’s better to turn the correction into a check than to add one more line to AGENTS.md. I mapped a typical iOS project onto this pyramid.

  1. Codeclear APIs, one way to do an operation, Swift Package target boundaries
  2. Compiler and linterstrict compiler checks, SwiftLint, no unnecessary dependencies between modules
  3. Testsbehavior, user scenarios, XCUITest
  4. Running the appsimulator, screenshots, screen recordings
  5. Glossarydomain terms and screen names
  6. MD filesAGENTS.md, skills, rules
  7. Reviewan independent agent, then a person
The wider the layer, the more it's worth investing in it. The order comes from Lauren Tan, the iOS contents are mine.

Text rules haven’t gone smoothly for me either. Agents often ignore AGENTS.md, so it doesn’t work as a guarantee. Lauren Tan noticed another effect. In documentation, comments and skills, agents write down a justification for why they didn’t do things properly, and they turn a minor correction into a strict rule.

Her team ended up banning almost all comments. They go stale quickly and give the agent a loophole for justifications. I’m not sure yet that I’m ready to go that far.

Buykin described a similar problem from another angle. He substantially rewrote a system of business instructions maintained by agents, yet after a while the complexity came back. The process that produced it had stayed the same. So he moved to small regular cleanups and checks against real scenarios.

Matt Pocock and Robert Martin

AuthorWhat they do about the problem
Matt PocockWorks with a domain glossary, architectural examples, and separate checks for requirements and for project standards.
Robert C. MartinDoesn’t read agents’ code. Surrounds them with tests, mutation testing and quality metrics.

Matt Pocock writes that the codebase itself affects the result more than the prompt and AGENTS.md do. It’s the same idea as Lauren Tan’s garden. The README of his skills says that agents speed up not only writing code but also entropy. He is cautious about AI review. He suggests treating a reviewer subagent’s output as a hypothesis, and he calls a review in the same context “confirmation bias with a slash command”.

Where I would start in an iOS project

In an iOS project I would start with fairly down-to-earth things. In AGENTS.md I’d keep the build and test commands plus links to good implementations, and skip retelling the whole architecture. If the app is already split into Swift Package targets, I’d use dependency boundaries between modules. Recurring violations, such as calling URLSession.shared directly from the feature layer, can be caught by SwiftLint if the project really has such a rule.

Next come behavior tests. They pin down what a screen should do, and then an extra layer is not scary to delete. Without tests people are afraid to touch it, and it stays forever. Green tests still say nothing about whether the architecture is justified.

Even after these checks, some questions remain that a linter won’t answer. Is the new service really needed? Does it duplicate a neighboring one? How much effort will the next change take? For those I decided to try an independent architecture review.

An experiment with independent review

I made independent-feature-review. In it, a fresh agent studies a finished feature on its own, traces the calls, looks at neighboring implementations and explains exactly how the complexity it finds gets in the way. In the original version it first explored the code without the original task, then received short requirements. The authoring agent’s reasoning was never passed to it.

The full text of the skill and the prompts to run it are below. You can copy them as is. In the experiment the skill also had a section with checks for Swift and iOS. Here I replaced it with general rules so the skill fits any stack. This is my personal experiment, and it does not claim to be the truth.

SKILL.md
---
name: independent-feature-review
description: Independently review an implemented feature for unjustified architecture, overengineering, shallow abstractions, duplicate mechanisms, coupling, and maintenance cost. Inspect the actual repository in a fresh context, then evaluate against a short original task brief. Read-only.
---

# Independent Feature Architecture Review

## Mission
Review the COMPLETE feature like a maintainer encountering it for the first time. Decide whether its structure is proportionate to its actual requirements. Do not act as its author or justify the existing design by default. This is an architectural review, not a formatting, lint, generic bug, or security audit.

## Independence
- Use a fresh reviewer session. Do not consume the implementing agent's chat history, design plan, self-review, or explanation of why the implementation is good.
- User provides feature entry point(s), module, screen, or main symbols. Optionally a base commit to identify new versus existing debt.
- Inspect repository code, nearby modules, callers, tests, project `AGENTS.md`/`CLAUDE.md`, glossary, ADRs, and relevant framework constraints yourself. Project documents are evidence, not unquestionable truth.
- Inspect the entire relevant feature, not only a diff. Expand scope to real callers and similar implementations; avoid scanning unrelated code.
- READ-ONLY. Do not edit files, run formatters, perform refactors, or create files in the repo. Only run safe commands when they add evidence.
- Branch / MR target: read the code at the head revision and compare against the given base with `git diff <base>...<head>` and `git show <base>:<path>`. Do NOT read the MR/PR description, review comments or commit-message rationale before Pass 1 is done; they are the author's reasoning.

## Scope control for large features
- Trace the hot path first (entry -> decisions -> effects -> output), then widen to error handling, tests, debug/test-only code and callers.
- If the feature is large (roughly 40+ files or ~3000+ lines), say up front which parts you will skim and which you will read fully. Never imply coverage you do not have.
- Count tests and snapshots as evidence about maintainability, not as files to read line by line; read the ones that guard the riskiest behavior.

## Pass 1 — blind repository inspection
Do this BEFORE receiving or reading the original task brief or the implementing agent's reasoning.
1. Locate the user's interaction/API entry point and trace: entry -> state and decisions -> effects/persistence/network -> output.
2. Identify key types, protocols, factories, managers, adapters, state owners, error transformations, caches, and public API boundaries.
3. For each extra layer, ask what distinct responsibility it owns, which implementation details it hides, and which real callers depend on it.
4. Inspect existing tests, local conventions, and 1–2 closest analogues in the repository. The old code is evidence, not automatically a good model.
5. Produce a concise feature map and up to five *provisional* friction hypotheses with locations. If any boundary cannot be traced, say so. Do not issue final overengineering verdicts yet.

## Pass 2 — read the minimum original task brief
Now obtain only (a) requested observable behavior, (b) mandatory constraints, and (c) acceptance criteria. Do not take the implementing agent's architecture proposal or PR self-assessment as the original task.
6. Separate necessary complexity (real contracts, concurrency, compatibility, security, offline needs, domain requirements, proven shared variation) from complexity that lacks a demonstrated reason.
7. Challenge every suspected overengineering problem with the strongest argument for keeping it: real independent responsibility, shared consumer, extension contract, isolation boundary, test seam, lifecycle ownership, compatibility, or ADR.
8. Compare the current shape with the SMALLEST behavior-preserving alternative. Specify precisely which types, links or states could disappear, what would remain, and possible downsides.
9. If a diff base is available, distinguish problems introduced or worsened by the change from existing technical debt.

## Investigate these as hypotheses — NEVER automatic violations
- Pass-through wrappers, manager layers or factories that only forward calls.
- Protocols, strategies, generics or plugin systems justified only by imagined future callers. A single conformance or one consumer does NOT automatically make an abstraction bad.
- New networking, persistence, caching, navigation, retry, error or dependency mechanisms parallel to a working shared solution.
- Excessive dependency hops to understand one operation; a small change touches many unrelated files (change amplification).
- Business rules leaking across module boundaries, unnecessary public surface area, inconsistent domain terminology that duplicates concepts.
- Overly nested control flow, redundant error layers, unnecessary state ownership, pre-emptive optimizations or speculative offline sync.
- Unhelpful decomposition into tiny methods hiding a straightforward flow, or excessively broad objects owning unrelated decisions.
- Tests mirroring implementation rather than guarding observable behavior, when this affects maintainability.

## Platform and framework checks, when applicable
- Follow the layer and state boundaries THIS project already uses; do not impose a generic MVVM/Clean Architecture template.
- Examine module or package boundaries and dependency direction, access control, the concurrency and isolation model, state lifecycle, cancellation, and what the platform or framework already provides.
- Ask whether existing framework features, structured concurrency, cancellation, existing services and platform APIs already handle the problem before accepting a new mechanism. Do not assume that cancelling a task alone prevents every stale update.
- Preserve real interfaces for test seams, SDK contracts or isolation boundaries even if there is one implementation.
- Do not recommend combining mutable state, caches or services across feature or concurrency boundaries without verifying safety.
- Linter and compiler warnings are useful evidence, not a substitute for architectural judgement.

## Evidence and false-positive discipline
Report a finding ONLY if you can show current maintenance cost: unnecessary state or failure modes, duplicated policy, hard-to-trace call flow, coupling, or amplification of a concrete change. File length, number of types, unfamiliar architecture or stylistic preference are not evidence by themselves.

For each finding provide:
- **Where:** exact file and symbol/line, plus relevant callers.
- **Cost today:** the concrete behavior/change that is harder.
- **Evidence:** code references, tests, existing solution, constraints or contracts.
- **Best counterargument:** why the structure might be justified.
- **Minimal safe improvement:** what can change without losing behavior; what must remain.
- **Impact + confidence:** separate high/medium/low judgements.
- **Origin:** introduced/worsened versus pre-existing (if comparison provided).

Put uncertain observations in `Questions/unknowns`, not in actionable findings. A finding that is both low impact and low confidence belongs in `Questions/unknowns`. Zero findings is valid. Do not invent an architecture refactor just to produce output.

Duplication counts as a finding only if you can name the concrete change that must then be made twice, or the divergence that already exists. Debug/test-only code on a production path counts only if it widens the production surface or sits in a security-critical spot; verify how it is compiled out before claiming a leak.

## Outside the architecture lens
While reading you may notice a correctness, security, compatibility or flag-off/rollback risk. Do not turn it into an architecture finding and do not audit for more. List it in one line each under `Outside the architecture lens`, mark it `unverified` unless you traced it, and say how to verify it. These are often worth more than the findings, so do not drop them.

## Final report (concise, in user's language)
1. **Feature map:** entry points, flow, actual boundaries (one short paragraph).
2. **Coverage:** read fully / skimmed or grep only / not inspected. Mandatory.
3. **Verdict:** `proportionate / some unnecessary complexity / significant unnecessary complexity / insufficient evidence`.
4. **Findings:** zero to five, ordered by practical impact using evidence format above.
5. **Keep:** noteworthy complexity that is justified, if relevant.
6. **Minimal alternative:** optional before/after flow showing fewer levels/decisions without dropping requirements; avoid sweeping rewrites.
7. **Outside the architecture lens:** see above, or `none noticed`.
8. **Handoff for implementer:** see below, or `No change recommended`.
9. **Questions/unknowns.**

## Handoff for implementer
A block that a DIFFERENT agent or engineer can paste into a fresh implementation session without reading the rest of the report. For each finding worth acting on:
- **Action class:** `safe now` (behavior-preserving and covered by existing tests) / `needs decision` (product, backend or owner input required; say who and what) / `leave alone`.
- **Change:** the smallest edit, by file and symbol.
- **Must not change:** behavior, public API, test seams, flags, wire formats and tests that must stay green.
- **Verify:** the narrowest tests/commands to run, and any test to add first.
- **Stop and ask if:** the signal that the assumption was wrong.
Order items by safety, safest first. Never mark `safe now` something you could not trace end to end. Do not perform the changes yourself.

No code edits without a separate user request.
PROMPTS.md
# Running an independent feature review

Use a NEW chat/session on the same source revision, with read access to the real repository. Do not supply the implementing agent's conversation, architecture plan, self-review, or PR pitch. For a truly blind first pass use these TWO messages in order.

## Message A — send first

Use the `independent-feature-review` skill in read-only mode. You are a separate architecture reviewer, not the implementer. Review the COMPLETE feature, not just a recent diff. Read the relevant repository code, conventions, ADRs, callers and tests yourself.

Feature entry point(s): `<path / View / feature module / public API>`
Optional comparison base: `<branch or commit>`

Perform ONLY Pass 1: reconstruct actual behavior and architecture, identify up to five preliminary suspects with locations, and explain what each component appears to own. Do not propose refactors or issue final overengineering findings until I send the original task. No file changes.

## Message B — send after Pass 1

Original behavior requested by the product/task:
`<short description of the user-visible result>`

Mandatory constraints:
`<business, security, performance, compatibility, offline and concurrency constraints, or 'none known'>`

Acceptance criteria:
`<observable behavior to preserve>`

Perform Pass 2 of `independent-feature-review`. Evaluate whether the current architecture is proportionate. Pay special attention to unjustified abstractions, unnecessary state, duplicate mechanisms, overly wide responsibilities and change amplification. For every finding provide code evidence, the strongest reason to keep the design, and the smallest safe alternative. If no meaningful issue exists, say so. Do not edit files.

## One-message version (faster, less blind)

Use `independent-feature-review` to review feature `<path/symbol>`. Original behavior: `<short brief>`. Inspect the repository independently (not the implementation agent's plan), trace the complete feature and find evidence-backed unnecessary architecture. No code changes. Report only actionable findings; zero is fine.

## Branch / MR version

Use `independent-feature-review` read-only. Repository: `<path to checkout>` at `<head branch>`; comparison base `<base branch>`. Do NOT read the MR description or comments. Review the COMPLETE feature starting from `<entry points>`, separating what the change introduced from what was already there. Original behavior: `<brief>`. Mandatory constraints: `<list>`. Include Coverage, Outside the architecture lens and Handoff for implementer.

## Handoff to the implementer (second session)

Take the `Handoff for implementer` block of the report, paste it into a fresh implementer session, and add: apply only `safe now` items, one at a time, run the listed tests after each, and ask me about every `needs decision` item. Do not give the implementer the reviewer's prose, only the block.

## Context to give and withhold

Give: actual repository, feature locator, original small behavior brief, real mandatory constraints, and optional comparison base.

Withhold: author reasoning, implementation chat, author’s PR summary as a substitute for original requirements, original design proposal, previous positive AI-review. Independence is NOT isolation from the real repo or the task.

For testing I used the open-source Apple Food Truck. It’s a SwiftUI demo project from Apple, which I don’t consider an example of AI-generated code. On the original orders feature, a plain reviewer and a reviewer with the skill noticed the same inconsistencies in status handling. There was no obvious overengineering there, though, so that run said almost nothing about the value of the skill itself.

Then I made test branches where the answer was known in advance. The task was simple. Orders should survive an app restart, and a completed order should keep its completion time. Everything is stored locally, with no backend and no sync. An agent built the branches, and extra complexity was added on purpose so there was something to find. Justified complexity was left alongside, for example an atomic file write, migration of the old format, a save queue and the ability to swap the clock in tests. The reviewers couldn’t see what exactly had been added for the experiment.

The first branch had noticeable overengineering, sometimes with “for the future” comments. In the second branch the complexity was subtler, with no such comments.

In total there were 23 reviews by four Claude models, with and without the skill. In the first branch each condition got one run each of Fable, Opus, Sonnet and Haiku. The second branch added two more Sonnet repeats and three Sonnet runs with a plain prompt that got one extra line about risks. The runs with the skill used a single-step prompt, not the two-pass setup from the skill description. A finding counted if the report named the problem and suggested removing the extra part. A passing mention or advice to keep the layer didn’t count. The last column is my estimate of how much that piece will complicate future changes.

What was addedWith skillWithout skillGets in the way of new features
A strategy and a factory with a single option4 out of 44 out of 4a lot
A second order model, the “kitchen ticket”3 out of 42 out of 4a lot
Sync even though there is no backend3 out of 44 out of 4a lot
A cache on top of data that is already in memory4 out of 44 out of 4a lot
Three error layers4 out of 44 out of 4noticeably
A second search mechanism4 out of 44 out of 4noticeably
A pass-through repository3 out of 43 out of 4moderately
A pass-through class, second branch5 out of 62 out of 6slightly
A protocol for a single type, second branch5 out of 65 out of 6slightly

You can expand the code for each example below. It is shortened but not rewritten.

A strategy and a factory with a single option
/// Different trucks may run different workflows (for example, catering orders
/// that require a pickup confirmation), so the rule is injected rather than
/// hard-coded in the model.
public protocol OrderStatusTransitionStrategy {
    func complete(_ ticket: KitchenTicket, at date: Date) throws -> KitchenTicket
}

public struct DefaultOrderStatusTransitionStrategy: OrderStatusTransitionStrategy {
    public func complete(_ ticket: KitchenTicket, at date: Date) throws -> KitchenTicket {
        guard !ticket.isClosed else {
            throw OrderDomainError.invalidTransition
        }
        var completed = ticket
        completed.stage = .handedOff
        completed.closedAt = date
        return completed
    }
}

public enum OrderWorkflow: String, CaseIterable, Sendable {
    case standard
}

public enum OrderStatusTransitionStrategyFactory {
    public static func makeStrategy(for workflow: OrderWorkflow = .standard) -> OrderStatusTransitionStrategy {
        switch workflow {
        case .standard:
            return DefaultOrderStatusTransitionStrategy()
        }
    }
}

The justification is written right in the comment. Different trucks supposedly may follow different workflows, but there are no such trucks. The completion rule itself takes one line, and any change to it now goes through a protocol, an implementation and a factory.

A second order model, the "kitchen ticket"
public struct KitchenTicket: Identifiable, Equatable {
    public enum Stage: Int, Comparable {
        case queued
        case inProgress
        case awaitingPickup
        case handedOff
        // ...
    }

    public var id: Order.ID
    public var stage: Stage
    public var itemCount: Int
    public var openedAt: Date
    public var closedAt: Date?
    // ...
}

public enum OrderTicketMapper {
    public static func apply(_ ticket: KitchenTicket, to order: inout Order) {
        switch ticket.stage {
        case .queued:
            order.status = .placed
        case .inProgress:
            order.markAsPreparing()
        case .awaitingPickup:
            order.status = .ready
        case .handedOff:
            order.markAsComplete()
        }
    }

    static func stage(for status: OrderStatus) -> KitchenTicket.Stage {
        switch status {
        case .placed:
            return .queued
        case .preparing:
            return .inProgress
        case .ready:
            return .awaitingPickup
        case .completed:
            return .handedOff
        }
    }
    // ...
}

// FoodTruckModel.markOrderAsCompleted
let ticket = OrderTicketMapper.ticket(from: order)
let completedTicket = try orderTransitionStrategy.complete(ticket, at: .now)
OrderTicketMapper.apply(completedTicket, to: &orders[index])
orderCache.invalidate()

To complete an order, the model turns it into a ticket, runs it through the strategy and turns it back. All that’s really needed is a single markAsComplete() call. A new order status would have to be added to OrderStatus, to KitchenTicket.Stage and to both switch statements in the mapper. The word “ticket” doesn’t appear anywhere else in the project.

Sync even though there is no backend
/// Coordinates pending order changes and flushes them to the repository.
///
/// Changes are queued and coalesced, then written in the background. Failed
/// writes are retried with exponential backoff so a transient failure (for
/// example, the device being low on space for a moment) doesn't drop data, and
/// the queue keeps working offline until a write succeeds.
public actor OrderSyncCoordinator {
    public enum SyncState: Equatable {
        case idle
        case syncing
        case waitingToRetry(attempt: Int)
        case failed(OrderDomainError)
    }

    public private(set) var state: SyncState = .idle
    private var pendingChanges: [PendingChange] = []
    // ...

    private func write(_ change: PendingChange) async -> Bool {
        var attempt = 0
        while true {
            do {
                try await repository.save(change.orders)
                lastSyncDate = .now
                return true
            } catch {
                attempt += 1
                guard attempt <= maxRetryCount else {
                    state = .failed(OrderDomainError(error))
                    return false
                }
                state = .waitingToRetry(attempt: attempt)
                let delay = baseRetryDelay * pow(2, Double(attempt - 1))
                try? await Task.sleep(nanoseconds: .secondsToNanoseconds(delay))
            }
        }
    }
}

The task says plainly that there is no backend and no sync. Yet every save goes through a queue with retries and four states. To change anything about saving, you first have to figure out what state the queue is in and when the write will be retried.

A cache on top of data that is already in memory
@MainActor
public final class OrderCache {
    public let timeToLive: TimeInterval
    private var entries: [Order.ID: Order] = [:]
    private var orderedIDs: [Order.ID] = []
    private var lastRefresh: Date?
    // ...

    public func orders(refreshingFrom source: () -> [Order]) -> [Order] {
        if !isFresh {
            store(source())
        }
        return orderedIDs.compactMap { entries[$0] }
    }

    public func invalidate() {
        entries.removeAll()
        orderedIDs.removeAll()
        lastRefresh = nil
    }
}

// FoodTruckModel, where orders already live in memory
@Published public var orders: [Order] = []
private let orderCache = OrderCache()  // timeToLive defaults to 30 seconds

public func order(id: Order.ID) -> Order? {
    orderCache.order(id: id) { orders }
}

public var incompleteOrders: [Order] {
    orderCache.orders { orders }.filter { $0.status != .completed }
}

The orders already live in memory in orders. The cache duplicates them and refreshes every 30 seconds. A new order shows up in incompleteOrders only after the cache goes stale. Every new read or write path has to remember to call invalidate(), or the screen will show old data.

Three error layers
public enum OrderStoreError: Error, Equatable {
    case readFailed
    case writeFailed
    case corruptedData
    case unknown
}

public enum OrderRepositoryError: Error, Equatable {
    case failed
    case unknown
}

// DefaultOrderRepository
public func fetchOrders() async throws -> [Order] {
    do {
        return try await store.loadOrders()
    } catch {
        throw OrderRepositoryError.failed
    }
}

public enum OrderDomainError: Error, Equatable {
    case invalidTransition
    case persistenceFailed
    case unknown

    public init(_ error: Error) {
        switch error {
        case let error as OrderDomainError:
            self = error
        case is OrderRepositoryError:
            self = .persistenceFailed
        default:
            self = .unknown
        }
    }
}

Each layer catches the error and replaces it with its own, dropping the original cause. A corrupted file and a write failure reach the UI the same way, as persistenceFailed. A new kind of error would have to be passed through three enums, and by the time you debug it the cause is already lost.

A second search mechanism
// Order, already in the project
public func matches(searchText: String) -> Bool {
    if id.localizedCaseInsensitiveContains(searchText) {
        return true
    }
    // Search donuts...
    return false
}

// OrdersView, the orders list
order.matches(searchText: searchText) || order.donuts.contains(where: { $0.matches(searchText: searchText) })

// Added next to it, used only by the orders table
public struct OrderSearchIndex {
    private var tokensByOrderID: [Order.ID: Set<String>] = [:]
    // ...

    public func matches(orderID id: Order.ID, query: String) -> Bool {
        let queryTokens = Self.tokenize(query)
        guard !queryTokens.isEmpty else {
            return true
        }
        guard let tokens = tokensByOrderID[id] else {
            return false
        }
        return queryTokens.allSatisfy { queryToken in
            tokens.contains { $0.hasPrefix(queryToken) }
        }
    }
}

// OrdersTable
let searchIndex = OrderSearchIndex(orders: model.orders)

The orders list searches with the old matches, the table with the new index. The index is case sensitive and matches only the start of a word, so the same query already gives different results in the list and in the table. A new searchable field would have to be added in two places.

A pass-through repository
public protocol OrderRepository {
    func fetchOrders() async throws -> [Order]
    func save(_ orders: [Order]) async throws
    func deleteAll() async throws
}

public struct DefaultOrderRepository: OrderRepository {
    private let store: OrderPersisting

    public func fetchOrders() async throws -> [Order] {
        do {
            return try await store.loadOrders()
        } catch {
            throw OrderRepositoryError.failed
        }
    }

    // save and deleteAll repeat the same pattern
}

Each method only calls the store and replaces the error. A new store operation has to be added in two more places, the protocol and the implementation.

A pass-through class, second branch
public final class OrdersPersistenceController: Sendable {
    private let store: any OrderPersisting
    private let saveQueue: OrderSaveQueue
    private let migrator: LegacyOrdersMigrator?
    // init omitted

    @discardableResult
    public func migrateLegacyOrdersIfNeeded() async throws -> LegacyOrdersMigrator.Outcome {
        try await migrator?.migrateIfNeeded() ?? .nothingToMigrate
    }

    public func load() async throws -> [Order] {
        try await store.all()
    }

    @discardableResult
    public func save(_ orders: [Order]) -> Task<Void, Never> {
        saveQueue.enqueue(orders)
    }
}

The class has no logic of its own, just an extra step between the model and the store. Without the skill, reviewers more often called it pass-through but suggested keeping it.

A protocol for a single type, second branch
public protocol Repository {
    associatedtype Entity
    func all() async throws -> [Entity]
    func replaceAll(_ entities: [Entity]) async throws
}

public protocol OrderPersisting: Repository, Sendable where Entity == Order {}

The generic protocol is used only for orders. It doesn’t get in the way much, it just adds an extra level of abstraction when reading.

If you look at the cost of future changes, the ticket with the strategy, the sync and the cache get in the way the most. A new status rule would have to go through four types, and the cache threatens stale data with every change. Reviewers found these almost every time. The difference with the skill shows only on the pass-through class in the second branch, which barely gets in the way of new features. Six runs don’t prove much here.

The second branch also had two different rules for “today”. One counted in UTC, the other in local time. All 15 runs on the second branch caught this mismatch. There were almost no false positives. Only one reviewer without the skill called the data schema version unnecessary, even though there were already two formats and the migration was required.

Along the way the reviewers also found ordinary bugs that the agent had introduced by accident while preparing the branches. That’s a different problem, not AI slop, so I don’t go into them here.

The experiment has one main limitation. Almost all the AI slop in the test branches was added on purpose, and the answer was known in advance. The inconsistencies in Apple’s original code are real, but they aren’t AI slop. The only unintended problems turned out to be bugs, not unnecessary architecture. This experiment doesn’t show how reviewers would handle AI slop that an agent writes on its own in a real project.

The scoring was done by other Claude models. Some findings were confirmed against the source code, and a full iOS runtime was never launched. One repository and this number of repeats can’t prove that the skill is better.

What did become clearer is what I want from an independent reviewer. It should be able to defend justified complexity, name the concrete consequences of an unnecessary abstraction and honestly say what it didn’t check.

Does review need a human

Opinions differ most on whether a human belongs in review.

A human doesn't read the code
  • Robert Martinchecks tests, dependencies and complexity metrics
  • Lauren Tanlooks at videos, screenshots and diagrams
A human reads the code
  • Brian Douglasexperienced colleagues catch what the AI review missed
  • My viewa human is still needed for contracts, business rules and architectural boundaries

Robert Martin writes that he doesn’t review agents’ code. He looks at test coverage, dependency structure, cyclomatic complexity, module size and mutation testing, and leaves the code itself to AI. At the same time, in his words, all responsibility lies with the engineers, and they are the ones who check the architecture.

For Lauren Tan, review has shrunk to looking at verification artifacts, meaning videos, screenshots and diagrams.

Brian Douglas told how an agent wrote Rust code that compiled and got a positive AI review, yet experienced colleagues found violations of the team’s practices.

Many people want maximum automation, and I understand them. Still, it seems to me that review needs a human for now, especially for important contracts, complex business rules and architectural boundaries. I admit this may partly be my personal wish to keep the code under control.

I also find human reviews useful as a source of knowledge about the project. A comment from an experienced colleague explains why things aren’t done a certain way here, and that knowledge is easy to lose in a closed PR. Brian Douglas marks the sessions where people disagreed with the agent for this reason. I would also collect such comments in one place. The recurring ones can later become checks, and the rest will give the next reviewer context.

Where I ended up

I would start fighting AI slop with the recurring problems of a specific project. If the agent keeps creating a second network client, it’s worth figuring out why it doesn’t find the first one, fixing the cause and adding a check where possible.

Judging by my experiment, a separate skill is probably not needed. A regular review finds noticeable overengineering too, and the difference with the skill shows only on small things. The sample is small, so this isn’t a final answer. The skill text and the prompts are above in the experiment section, and also in a single archive.

I don’t think AI slop can be eradicated completely. Hard-to-understand code will always keep appearing, and if you stop watching for it, AI slop gradually wins. So reducing it becomes ordinary project maintenance, where each step lets you automate a little more. The linter, tests, dependency constraints and cleanup of old code take over the repetitive part. Independent review and a human remain for the debatable decisions.

Just like with protection against reverse engineering, AI slop AI always wins. All we can do is make its job harder.

Related posts